I couldn't find an answer in the Wiki about failing the build in case of any of the rules are violated. I am not sure this is the right place to ask for clarification, but what I would like to do is to fail the build for the violation of any of the rules which are not disabled. e.g. todo, trailing_comma, valid_docs, etc.. basically almost every rule violation should fail the build.
What would be the way of doing this properly?
Thanks you for your suggestions, I'm not sure if this is the proper place for asking this type of question, but feel free to move my issue.
You can use swiftlint lint --strict. See #834.
Perfect, thanks for your help and the quick reply.
Feel free to reopen if you have more questions!
--strict is nice, but it would be even nicer to be able to be able to set error as default for every rule via .swiftlint.yml and turn it down to warning for selected other rules.
Use case: For a commit hook which only runs on added/modified files, we like to be strict and have a lot of errors which prevent committing. For the whole code base, reports are generated on CI, it should include more finegrained reports including warnings for rules that should be ignored or have a higher threshold on the commit hook. E.g. warn for method body lines > 40, error for > 100.
@marcelofabri I was looking for the same thing as @fabb suggested. Any plans on adding such a feature? Would be really nice.
For inspiration: and eslint supports --max-warnings=0 as a command line parameter.
https://eslint.org/docs/user-guide/command-line-interface
Most helpful comment
--strictis nice, but it would be even nicer to be able to be able to seterroras default for every rule via.swiftlint.ymland turn it down towarningfor selected other rules.Use case: For a commit hook which only runs on added/modified files, we like to be strict and have a lot of errors which prevent committing. For the whole code base, reports are generated on CI, it should include more finegrained reports including warnings for rules that should be ignored or have a higher threshold on the commit hook. E.g. warn for method body lines > 40, error for > 100.