-
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 picking the wrong configuration with —path #1745
Conversation
Generated by 🚫 Danger |
Codecov Report
@@ Coverage Diff @@
## master #1745 +/- ##
==========================================
- Coverage 87.75% 87.73% -0.02%
==========================================
Files 218 218
Lines 10704 10707 +3
==========================================
+ Hits 9393 9394 +1
- Misses 1311 1313 +2
Continue to review full report at Codecov.
|
I looked at this in case it would affect #1748. (Apparently we wrote some of the same code without communicating. Haha...) Unfortunately, I think there is more to the bug than this. The related bug report (#1744) states that the bug was already manifest in 0.21.0. The code affected by this pull request did not even exist in 0.21.0, so I doubt these changes actually get to the root of the problem. (They will not fix it for any situation that does no merging.) I advise verifying that 0.21.0 really does exhibit the bug before proceeding. |
I mean before assuming the bug is gone. There is nothing wrong with merging the changes proposed here. |
Actually, I think is not related to the merge of configurations. It's just how we look to parent directories if we don't find one configuration in the current one. |
I'm not sure this actually works with |
rootPath: projectMockSwift0, | ||
optional: false, quiet: true) | ||
let file = File(path: projectMockSwift0)! | ||
XCTAssertEqual(configuration.configuration(for: file), configuration) |
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.
this test should pass, right?
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.
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.
This happens locally on my Mac. I'm pretty sure it's not a bug of comparison, but a consequence of the bug that this PR fixes. However, this PR currently only fixes it for implicit configs.
...which was all refactored to integrate with merging (searching now needs to continue past the first configuration found). The edits here are all in |
They were refactored just to be in different extensions. |
No idea why I'm getting different results on Linux and macOS 🤔 |
I’ve thought more about this. I think this is a broader issue than we initially realized. While the bug addressed here predated configuration merging, merging is now live in master, and configuration merging broke the very design of What does
|
This is an interesting use case for both config and path. I think you should have a look at a few popular linters to figure out the best use case for these configurations. This problem has been solved before. |
I don't think it's the same bug. If you look the log for this PR, the configurations are totally different (not just the order of rules). |
Sorry. I did not look at this log that close. You’re right then that there is another problem in addition to the one I mentioned. The left side is the configuration for SwiftLint, the right side is the configuration for the mock project. Does |
Should we continue the discussion in #1693? |
They are only loosely related. This is about fixing I like the code you have written, @marcelofabri. It is a great improvement to predictability. I honestly suspect the only thing still stopping the tests is that I was just aware that people are already using As for me, I do not—and probably never will—have a need to use I apologize if this has been frustrating. I truly wish you a nice day, @marcelofabri. |
Thanks for that detailed comment BTW. It made me realize that we might be overcomplicating things (see #1693 (comment)).
I'm not so sure: we use
Not at all! I just wanted to keep the discussion here focused on that single issue. I do think we have issues with how configurations work (see all the issues in the previous releases). |
38beb8c
to
3f28502
Compare
3f28502
to
843ca9c
Compare
If I disable the configuration (memory) cache, the tests pass on Linux 🤔 |
So, turns out mutability causes issues 😅 |
f133f84
to
d4248e9
Compare
Fixes #1744
Pending tests.