-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Adjust --strict to treat warnings as errors instead of only altering exit code #3372
Conversation
strict
mode to treat warnings as errors instead of only altering exit code
Generated by 🚫 Danger |
Codecov Report
@@ Coverage Diff @@
## master #3372 +/- ##
==========================================
+ Coverage 90.48% 90.52% +0.03%
==========================================
Files 417 417
Lines 20508 20512 +4
==========================================
+ Hits 18557 18568 +11
+ Misses 1951 1944 -7
Continue to review full report at Codecov.
|
Correct, this is unfortunate, and ideally I'd like to get rid of our pbxproj Xcode project altogether, which would then make it easier to add a test target just using the SwiftPM manifest that can test the |
Thanks, I think that's the right call too! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, I probably should have done it this way originally. Thanks!
} | ||
|
||
case (true, true): | ||
queuedFatalError("Invalid command line options: 'lenient' and 'strict' are mutually exclusive.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Implements #3312 with @jpsim's suggested solution.
I tested that this works manually by building via
swift build -c release
and running.build/release/swiftlint --strict
and it worked just as expected. Without that option, I had 1 warning & 1 error reported, with that options 2 errors were reported, so I can confirm it works. But I did not add any unit tests because there seem to be no unit tests for the CLI product, other options like--lenient
seem also not to be unit tested.Note that I did not mess with any tresholds (like
lenient
does), I think we could think about those things after seeing how people are using this new option, so I'd rather keep this simple for now.Also note that I have decided to put the Changelog entry into the "Breaking Changes" section as some people might have been relying on the fact that using
--strict
was still making a distinction between warnings & errors when using the output of reporters directly. As this is changing this documented behavior, I feel like it would be wrong to place the change into the "Bug Fixes" section. But I can also move it there if needed, I do not have a strong opinion here.