-
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
Fix finding the nested config when a single file path is passed #3342
Conversation
Source/SwiftLintFramework/Extensions/Configuration+Merging.swift
Outdated
Show resolved
Hide resolved
Generated by 🚫 Danger |
This approach turned out not to be a complete fix. I think I have this working a lot better in a branch by completely rewriting the merging algorithm. I'll get the PR updated in the next 24 hours |
beb232d
to
4a9e1c1
Compare
Rewriting the merging algorithm wasn't necessary after all. Ended up discovering a much simpler fix. Changes pushed, and I've updated the PR description to reflect the new change. Part of the problem was |
Codecov Report
@@ Coverage Diff @@
## master #3342 +/- ##
==========================================
- Coverage 90.52% 90.51% -0.02%
==========================================
Files 417 417
Lines 20434 20432 -2
==========================================
- Hits 18498 18494 -4
- Misses 1936 1938 +2
Continue to review full report at Codecov.
|
@jpsim @marcelofabri @keith Sorry for the ping, not sure who to reach out to - just looked at recent PR reviewers. I'm not sure why the buildkite build failed. There doesn't seem to be any info in the log other than
Does one of you mind taking a look? 🙏🏻 |
2a290fc
to
f5aaeb3
Compare
@jpsim @marcelofabri @keith Looks like the CI failure from before was just a flake. Should be good to go here |
Thanks for the PR! |
* master-upstream: (98 commits) Fix some false positives in rule `explicit_self` (realm#3368) Update SourceKitten to 0.30.1 (realm#3367) Fix issues with analyzer rules, Xcode 12 & SwiftUI (realm#3366) Add empty changelog section release 0.40.3 Fix false positives for 'multiple_closures_with_trailing_closure' (realm#3353) [UnusedDeclarationRule] Work around SR-11985 (realm#3363) Revert "Fix finding the nested config when a single file path is passed (realm#3342)" (realm#3362) [CONTRIBUTING] Add building & running tips (realm#3360) Fix finding the nested config when a single file path is passed (realm#3342) Include Linux zip in list of GitHub release binaries (realm#3350) [UnusedDeclarationRule] Add more tests (realm#3359) Test CI with official Swift 5.3 release (realm#3356) Don't mark `@NSApplicationMain` or `@UIApplicationMain` classes as unused (realm#3355) [Fix] `UnusedCaptureListRule`: implicit self in @escaping closures (realm#3352) Skip correcting files with parser diagnostics (realm#3349) [SwiftLintFile] Remove lock in favor of UUID (realm#3347) [UnusedDeclarationRule] Speed up and detect more dead code (realm#3340) Add empty changelog section release 0.40.2 ... # Conflicts: # Source/swiftlint/Helpers/LintableFilesVisitor.swift
* master: (98 commits) Fix some false positives in rule `explicit_self` (realm#3368) Update SourceKitten to 0.30.1 (realm#3367) Fix issues with analyzer rules, Xcode 12 & SwiftUI (realm#3366) Add empty changelog section release 0.40.3 Fix false positives for 'multiple_closures_with_trailing_closure' (realm#3353) [UnusedDeclarationRule] Work around SR-11985 (realm#3363) Revert "Fix finding the nested config when a single file path is passed (realm#3342)" (realm#3362) [CONTRIBUTING] Add building & running tips (realm#3360) Fix finding the nested config when a single file path is passed (realm#3342) Include Linux zip in list of GitHub release binaries (realm#3350) [UnusedDeclarationRule] Add more tests (realm#3359) Test CI with official Swift 5.3 release (realm#3356) Don't mark `@NSApplicationMain` or `@UIApplicationMain` classes as unused (realm#3355) [Fix] `UnusedCaptureListRule`: implicit self in @escaping closures (realm#3352) Skip correcting files with parser diagnostics (realm#3349) [SwiftLintFile] Remove lock in favor of UUID (realm#3347) [UnusedDeclarationRule] Speed up and detect more dead code (realm#3340) Add empty changelog section release 0.40.2 ...
… is passed (realm#3342)" (realm#3362)" This reverts commit a67b0f2.
… is passed (realm#3342)" (realm#3362)" This reverts commit a67b0f2.
… is passed (realm#3342)" (realm#3362)" This reverts commit a67b0f2.
… is passed (realm#3342)" (realm#3362)" This reverts commit a67b0f2.
This was previously attempted in #3342, but produced a bug in the case where `--config` is used to specify a config from outside of the source tree. The `--config` argument wasn't always being used as an override, and was being merged with the config in the source tree. This has now been addressed and reverts the revert done in #3362. Fixes #3341
Fixes #3341
When SwiftLint searches for nested configurations and only one file has been passed in via the
paths
argument, SwiftLint returns early after inadvertently comparing the containing directory of the file-to-be-linted to itself. This happens becauserootDirectory
is calculated fromrootPath
, which is set to the file being linted in this scenario.