-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
warn if we find multiple clippy configs #8326
Conversation
Hm, I'm actually wondering now if there are projects that have one clippy config in a root directory and another one in a subproject and whether we should warn in this case or not.. 🤔 |
I was also wondering about then when I saw the code. I think those configs should actually be merged. Someone might want to deny functions, macros, and names on a workspace level and have some other configuration for a project. I feel like the configs from the workspace should propagate to projects unless they are overridden 🤔 |
And it looks like high-five bot didn't assign anyone to this one. It looks interesting, I'll r? @xFrednet |
IMO it's unusual and sub-optimal to continue searching for a config after finding one. Instead we should document which filename takes precedence and maybe have a way (verbose mode?) to print which config file is unused. In general we can take inspiration from rustfmt (source). |
I have no strong opinions on how workspace and project configuration files should be handled. I think there are compelling arguments for either side. One thing that speaks for only using one configuration file is that this is the current behavior (I think). In either case, we should definitely document how Clippy selects the configuration file. Thanks for pointing that out 🙃. Also cc: @rust-lang/clippy maybe someone else has some thoughts on this 🙃 |
Ideally it would be nice to merge configs too. And we should probably support But I'm fine with landing this as-is too |
I think merging configs and figuring out hierarchies probably is a whole other issue. I think a separate |
Agreed, I didn't expect it to be done in this PR, it's just something that came up 🙃. You could also change to note to just clearly state: "Clippy will be using {} as a config file, others will be ignored". I think it wouldn't hurt to specify it every time. Either message is fine, the current version also works IMO. 🙃 |
I think it's a good idea to handle the Clippy config file in the same way as other config files are handled in the Rust ecosystem. I think a warning if a config file gets ignored is a nice improvement though. |
Hey @matthiaskrgr, besides the discussion, have you seen my review comment at the start? Once that one is resolved, I think we can merge this PR 🙃 |
I've tweaked the message a bit:
and added some tests. |
41b1836
to
4f639b2
Compare
Looks good to me, thank you to the changes 🙃 @bors r+ |
📌 Commit 4f639b2 has been approved by |
warn if we find multiple clippy configs Fixes #8323 --- *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: warn if we find multiple clippy configs
💔 Test failed - checks-action_test |
diff of stderr:
-Using config file `$SRC_DIR/tests/ui-cargo/multiple_config_files/warn/.clippy.toml`
-Warning: `$SRC_DIR/tests/ui-cargo/multiple_config_files/warn/clippy.toml` will be ignored.
+Using config file `/?/$SRC_DIR/tests/ui-cargo/multiple_config_files/warn/.clippy.toml`
+Warning: `/?/$SRC_DIR/tests/ui-cargo/multiple_config_files/warn/clippy.toml` will be ignored. It seems like windows is not quite happy with the |
mmmh
|
4f639b2
to
cb758b3
Compare
I canonicalized the paths now, no idea if that helps but worth a shot. 🤷 |
We'll give it a try 🙃 @bors r+ |
📌 Commit cb758b3 has been approved by |
warn if we find multiple clippy configs Fixes #8323 --- *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: warn if we find multiple clippy configs
💔 Test failed - checks-action_test |
Well, that doesn't seem to be working. We might have to restrict the tests to only one OS if the replacement doesn't work correctly 🤔 |
:/ |
I'm not sure. Taking a deep dive into compiletest-rs is on my todo list, but so are countless other things as well ^^. I can imagine that the replacement regex tries to only target paths in compiler message and might not be ideal for this case, but I can be wrong. |
cb758b3
to
2335fbc
Compare
I tried to fiddle a bit with relative paths but couldn't work out a solution (we'd have to un-relativize the path somehow..??) so I just ignored the test on windows now :I |
…nd paths properly there
2335fbc
to
aae64e9
Compare
Alright, still looks good to me, let's see what bors thinks @bors r+ |
📌 Commit aae64e9 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #8323
Please write a short comment explaining your change (or "none" for internal only changes)
changelog: warn if we find multiple clippy configs