-
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
Suggestion: run clippy for specific package in workspace #2518
Comments
I've started prototyping. It looks as if I think we would end up with a help message like that below (c.f. the current one at https://github.com/rust-lang-nursery/rust-clippy/blob/master/src/main.rs#L14). Thoughts? It'll be a minor functional change (you can no longer specify
|
yes please! no more args parsing! |
It saves us from having to parse std::env::args manually, though at the cost of mandating that --all/--manifest-path come before any other arguments. Will make adding additional clippy-specific args easier - see rust-lang#2518
Now that we're using cargo check, we can stop needing to find out the manifest path ourselves. Instead, we can delegate to cargo check, which is perfectly capable of working out for itself what needs to be built. This fixes rust-lang#1707 and rust-lang#2518. Note that this PR will change the output. We will no longer output `bin: foo` before each crate. This a bit unfortunate. However, given that we're now going to be building in parallel (which is *much* faster), I think this is acceptable - we'll be no worse than cargo itself.
not sure why this was closed, it looks like you still can't run clippy on a specific package in your workspace |
@mimoo could you share an example of what does not work for you? If you refer to the ability of running Clippy only on the package, excluding its dependencies (#3025), that will be fixed in a couple of days after rust-lang/cargo#8758 is merged. |
Ah, indeed I was getting hits on its dependencies (which are other packages in my workspace) and didn't understand why |
If one package depends on another package the workspace, clippy will still check the extra package. To avoid that, pass the
If you run clippy as part of a script that runs other cargo commands, clippy may just exit right away without reporting any errors. The workaround is to clean the package just before running clippy:
|
We now have the
--all
option, and this is very helpful when testing a workspace.However, when developing, it would be convenient to be able to run clippy over only a specified package in the workspace. i.e. similar to the
cargo test
option-p SPEC, --package SPEC ... Package to run tests for
.Unless anyone objects, I'll have a look at implementing this - it should be a fairly simple extension of the current handling for
--all
.The text was updated successfully, but these errors were encountered: