Revert "Fix finding the nested config when a single file path is passed"#3362
Conversation
Generated by 🚫 Danger |
|
@jpsim Interesting! Thanks for the tag. Lmk once you're able to get a repro case together; I'd be more than happy to take another stab at a fix! |
|
Yeah, sorry for the lack of details yet. I have to reduce what we're doing to something I can share here. |
|
It has something to do with specifying an out-of-tree config file while linting a directory that already has a |
|
@jpsim That's helpful, thanks! Is the behavior you're seeing that the passed in file is ignored in favor of the root .swiftlint.yml? |
|
I think so. |
|
What is the expected behavior in that scenario @jpsim? Should the root file be completely ignored in favor of the passed in file, or would we expect them to be merged? |
|
Hmmm, good question. I can see arguments for either way. In almost every other case we merge configurations with parents. |
|
@jpsim Personally I would expect the config argument to be treated as an override. "Ignore what I have, just test my project out with this config". You mentioned that there was a regression here though, so I wanted to check what the expected behavior was for your project |
|
Yes, for an explicit config passed as an argument, I'd also expect that to take precedence. |
* 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 ...
|
Just had time to set up a repro for this. Using the sample project (out-of-tree config not included in the zip):
Will see if I can figure out how to fix this, but is this consistent with what you were seeing @jpsim? |
… is passed (realm#3342)" (realm#3362)" This reverts commit a67b0f2.
|
That sounds like what I was seeing, yes. Thanks for taking the time to do this! |
… 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
Reverts #3342
This caused a regression in one of my projects. cc @sethfri
It's a closed source project so it'll take some time for me to craft a repro case.