Open wolfAle opened 7 months ago
This is the expected behavior. If SwiftLint found errors, it also exits with an error code other than 0 (2 actually).
According to that, it doesn't break the pipeline, but the pipeline decided to break when it got an error code other than 0 from SwiftLint.
Ok, I see your point. Problem with that is that the pipeline is considered failed (and that's fine) but in that case no artifacts are available, hence neither the swiflint's output (html in my case) is available. And I can't see the result of the linting.
How'd you suggest to proceed in this case?
This still sounds to me like this should be fixable in the pipeline configuration. But that's just guessing.
On the SwiftLint side, I wouldn't dare to change the behavior as other folk might rely on it. Also, I think it's reasonable to exit with a non-zero error code in --strict
mode.
Perhaps for you it's possible to go without --strict
and just configure certain (or all) rules to emit errors. Then, SwiftLint will exit with 0 and you still get (some) errors in the log or the output file.
Perhaps for you it's possible to go without --strict and just configure certain (or all) rules to emit errors. Then, SwiftLint will exit with 0 and you still get (some) errors in the log or the output file.
This part is interesting, is it possible to configure rules to emit errors? is there documentation about it? or can you explain me how?
Thanks!
In the configuration file, to every rule, you can add a severity
option than can be set to error
or warning
. For example:
force_try:
severity: error
Oh that's just great, I didn't know 😄 I'll give it a go and I'll close the issue if everything goes as expected, thanks for your help, appreciated! 😉
Describe the bug
I've setup a Gitlab pipeline that executes the
fastlane swiftlint
command as follows:The command gets correctly executed as follow:
Environment
SwiftLint version (run
swiftlint version
to be sure)? SwiftLint (0.54.0)Installation method used (Homebrew, CocoaPods, building from source, etc)? Cocoapods
Ad additional info: the analysis gets correctly executed, the output file created and the warnings are considered as errors, but the pipeline fails with that error. If I remove the strict param then it doesn't raise an error, but of course the pipeline job completes successfully because the warnings are not considered errors.
Thanks for your help, Alessandro