-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lint] Ability to treat warnings as errors and return non-0 exit code #747
Comments
@welandaz why not configure your rules to have errors instead of warnings? This is the "recommended" rules: lint:
rules:
info-description: warn
info-contact: off
info-license: warn
info-license-url: warn
tag-description: warn
tags-alphabetical: off
parameter-description: off
no-path-trailing-slash: error
no-ambiguous-paths: warn
path-declaration-must-exist: error
path-not-include-query: error
path-parameters-defined: error
operation-description: off
operation-2xx-response: warn
operation-4xx-response: warn
operation-operationId: warn
operation-summary: error
operation-operationId-unique: error
operation-operationId-url-safe: error
operation-parameters-unique: error
operation-tag-defined: off
operation-security-defined: error
operation-singular-tag: off
no-unresolved-refs: error
no-enum-type-mismatch: error
boolean-parameter-prefixes: off
paths-kebab-case: off
spec: error
no-invalid-media-type-examples:
severity: warn
disallowAdditionalProperties: true
no-server-example.com: warn
no-server-trailing-slash: error
no-empty-servers: error
no-example-value-and-externalValue: error
no-unused-components: warn
no-undefined-server-variable: error You could find/replace "warn" to "error". |
Hey @adamaltman! Yes, this will definitely work, however it means that one must keep track of all the rules in order to re-mark them as errors (e.g. if the new one appeared it has to be adjusted too) What do you think of adding this as an additional flag to the "lint" command? Or, perhaps, a possibility to specify it in the config file under "lint" (e.g. "lint.apply-to-all-rules: error" or smth like that). |
Hi @welandaz, |
I also vote for implementing some sort of strict versions of rules preset - |
Hey @tatomyr , Having 2 lists isn't practical in my opinion, since in that case the user would have to track all rules explicitly and make sure they are getting (re)marked. Just to clarify your proposal regarding |
Hi @welandaz, By default, we use the BTW, are you using |
Hey @tatomyr, No, we just use the default setting by invoking the "lint" command...and based on what you've described, our use case can be covered with this existing config - https://github.com/Redocly/redocly-cli/blob/master/packages/core/src/config/all.ts, right? (if we just want to make sure everything is enabled and is treated as error) Please, correct me if I'm wrong, but |
Hi @welandaz, Unfortunately not that straight 🙂 The P. S. And if we decide to introduce the |
Hi @tatomyr , Understood, thanks a lot! I'll close the issue then, we'll stick with config file and later the |
Sorry for digging up this issue, but I've ran into exactly the same problem. Basically, I was looking for a It seems a We are using the Does it make sense to re-open this issue or open a new issue for this problem? |
@tsauerwein please, open a new issue about the |
Just in case some of you have missed that, we added the |
Describe the solution you'd like
It would be really nice to have an ability to treat lint warnings as errors and return non-0 exit code.
This would be beneficial for the cases where one want's to know whether there are any issues with the document
in general (both errors and warnings) and return code could signal that.
Describe alternatives you've considered
This feature could be enabled by an additional flag to the "lint" command (everything else would stay the same, but if there are 0 errors and at least 1 warning - non-0 exit code is returned)
The text was updated successfully, but these errors were encountered: