-
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
Adds force-exlucde flag to ling/autocorrect commands #2056
Conversation
Generated by 🚫 Danger |
Codecov Report
@@ Coverage Diff @@
## master #2056 +/- ##
==========================================
- Coverage 89.69% 89.66% -0.04%
==========================================
Files 256 256
Lines 14907 14937 +30
Branches 973 973
==========================================
+ Hits 13371 13393 +22
- Misses 1519 1526 +7
- Partials 17 18 +1
Continue to review full report at Codecov.
|
Okay, got it to run but it's not behaving as I'd expect. Will mark the PR as a WIP. |
Coooooool, had to |
What should happen if you pass |
That's a good question. I would expect that the other files in the directory would be linted, but any files in |
@ashfurrow you probably need to filter in https://github.com/realm/SwiftLint/pull/2056/files#diff-27e9905d3d17e50e5263bb7cae0fd09aR24 too. I'd also make sure that we have tests for what happens if we have
|
Okay so it turns out I didn't quite understand the semantics of how SwiftLint resolves config files. I re-tested your earlier question:
This does work as I'd expect: SwiftLint picks up the other files but not the ones in swiftlint lint --path . --force-exclude --config .swiftlint.yml And this lints everything but does exclude the files in |
Ack! Just saw the failures, will fix. |
CHANGELOG.md
Outdated
* None. | ||
* Adds `--force-exclude` option to `lint` and `autocorrect` commands, which will | ||
force SwiftLint to exclude files specified in the config `excluded` even if | ||
they are explicitly specified with `--path`. |
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.
Can you add two trailing whitespaces after .
?
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.
Sure can. Would you like a separate PR that checks for these missing spaces using Danger? Could save you some time chasing after contributors 😄
@ashfurrow Sorry for the delay. This looks good! ✅ Just added a small comment, but other than that and fixing the conflict, this is ready to be merged. |
Any update on this? I don’t understand the nature of the CI failure. |
@ashfurrow I just manually merged this. I had to rebase to get rid of the merge commit and also I had to run Sourcery to make sure the new tests were being run on Linux (f231e6d). Thanks and sorry for the delay! |
Cool, thanks a lot! |
This adds a
--force-exclude
option to thelint
andautocorrect
commands which will force SwiftLint to exclude a file if it matches theexcluded
config options, even if that file is explicitly passed with the--path
option.I could not test locally because I got the following exception:Fixed this, ran into #1466.
➜ Moya git:(master) ✗ swiftlint Loading configuration from '.swiftlint.yml' Fatal error: Loading sourcekitd.framework/Versions/A/sourcekitd failed: file /Users/ashfurrow/SwiftLint/.build/checkouts/SourceKitten.git-6484296299232452758/Source/SourceKittenFramework/library_wrapper.swift, line 61 [1] 71720 illegal hardware instruction swiftlint
Tested this locally:
It fails because it "can't find" any files, but I think that makes sense.
Fixes #2051.