question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

User story. As a user, I can add exceptions to certain rules to ignore failures so that I can guard against new changes but run against legacy descriptions.

Is your feature request related to a problem?

For API descriptions that have a “pre-linting” era, but with linting rules that should be enforced for new changes, it would be nice to have some kind of mechanism similar to eslint’s // eslint-disable-line no-use-before-define.

Describe the solution you’d like

I couldn’t find any talks about this feature in issues / PRs, let me know if it exists already. I can see different ways of tackling this.

  • YAGNI: Users are expected to run spectral in a custom way, running only against new changes / diffs. Or maybe expected to write custom JS rules and do the filtering there.

  • Users are expected to handle this with given’s JSON PATH entirely.

  • A new rule attribute:

  paths-kebab-case:
    description: Should paths be kebab-case.
    message: '{{property}} is not kebab-case: {{error}}'
    severity: error
    recommended: true
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: "^(\/[a-z0-9-{}]+)+$"
  except:
    - <json_path_matching-legacy-paths>
  • An eslint style convention directly on API specifications (Tricky since users would be required to strip this out before making public)
x-spectral-disable: "paths-kebab-case"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
philsturgeoncommented, Nov 7, 2019

The CLI has —skip-rule Which probably doesn’t help, and the config files (rulesets) allow turning entire rules off, but we don’t support specific exceptions on a line or file basis just yet. I think x- extensions would be the way to go for now yeah.

1reaction
philsturgeoncommented, Dec 23, 2019

@idosal so far efforts have been going into v5.0 and cleaning out some of the old cruft which has been deprecated throughout v4.2. With that work nearing an end, we can look at new functionality like this.

@P0lip @marbemac I would love to see this coming for v5.1 so we can work on getting it into Studio too? A Right Click > “Ignore this instance” to accompany the Right Click > “Ignore this rule” option I’ve heard mentioned before. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception that proves the rule
In this sense, the phrase does not mean that an exception demonstrates a rule to be true or to exist, but that it...
Read more >
Exceptions to the Rules - Spelling
RULE: If a word ends in y preceded by a vowel, then the y is kept when a suffix is added. annoy +...
Read more >
The exception that proves the rule
The proverb the exception that proves the rule is often used to justify something that seems to contradict a rule. However, the term...
Read more >
The exception that proves the rule definition and meaning
The exception that proves the rule definition: If you are making a general statement and you say that something is the exception that....
Read more >
Idiom Corner: The Exception That Proves the Rule
As such, an exception can “prove” a rule if it makes us question it (or even reject it). For example, we might believe...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found