-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Rename clippy-preview to clippy and stabilize it #7382
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @ehuss |
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.
should get final review from cargo team, but good to go from our side!
I imagine we will need to add the docs changes that @ehuss mentioned in rust-lang/rust-clippy#3837 (comment) before this is actually ready for merge. |
Looks good to me! Want to go ahead and merge the stabilization of |
Thanks @yaahc! This looks good. For the documentation: I would just pick a command like cargo-vendor and just duplicate what it does. The
|
There was some prior discussion where the clippy team may want to delay the fix command because the suggestions aren't quite ready (the machine-applicable ones have a tendency to fail). So I think we'll want to delay that part until they're comfortable with it, and it has had more testing. |
Oops sorry, I thought the approval here from the clippy folks also covered |
Proposal to merge this PR to make @rfcbot merge What is stabilizedThis adds a new built-in command named Why?This makes it easier to provide a better experience using the Some specific differences:
ImpactIn my belief this will have negligible maintenance burden. Notes
References
|
Team member @ehuss has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@rfcbot concern overall-ux-of-cargo I've skimmed through the issues tracking the work on cargo/clippy integration this year and I can see that a lot has been done. I think that's great, and I'd like the lints in clippy to be accessible through cargo on stable Rust. But here's my comment from about a year ago in rust-lang/rust-clippy#1358, all of which I still think today:
Unfortunately, this post didn't get a lot of engagement from people involved in clippy a year ago. I don't know if there are other threads that are relevant that I should read that would contain more information on this subject that would convince me these concerns should not be blocking on stabilizing the I don't think we need to have a fully configurable linting infrastructure today. But I do think we need to design the interface to be forward compatible with that. I think Concretely, I think my concern boils down to two things:
I know that I've been a very absentee member of the cargo team this past year, and I apologize if this has been discussed at length in cargo team meetings I've not been present for. I'll gladly make resolving this concern a priority for me and I hope clippy's lints can be accessible by default to all users of stable Rust very soon. |
@withoutboats to be clear, Clippy is already shipped by rustup on stable as The subcommand already exists with this name, we're replacing it with a cleaner implementation, and With that in mind, and with stability guarantees, at a bare minimum this PR must add So onto that topic: I would rather add such a command when it is easy to hook more lints into the compiler. The way clippy does it is not scalable when it comes to tooling (replacing the rustc means that all other tools get confused: a bunch of the bugs this PR fixes arises from that, and this is also why RLS needs to know about clippy). Furthermore, I think not calling it Given that we're trying to deprecate plugins, we're moving in the direction of making custom lints harder to do, not easier. Clippy has discussed supporting a reduced set of custom lints based on a Coccinelle-like syntax. This arises from a bunch of refactorings we're planning internally to make lints easier to write (rust-lang/rust-clippy#3875), though there's a long way to go before any of this can be pluggable. Once we're closer to that it might be worth imagining what a custom lint interface for Ultimately I don't consider the name to be a significant barrier to learning. I don't think the name To some extent, "cargo lint" may actually give off the wrong impression, since in many ecosystems "linter" is really their equivalent of a non-autofixing |
Also, note that the lints are also namespaced under We basically need to keep some name around for the lint set, and if that name exists then we'd need If we're going to be adding support for custom lint sets in the future, giving the interface a more neutral name now while keeping decent UX seems like a bad idea to me. It seems like if we were to figure out what custom lint sets would look like, then it might be easier to design this neutral interface, but without that I'm wary of predesigning an interface. There has been very little interest in supporting easy-to-implement custom lint sets from the rustc side, and while clippy may have a viable path for this we're not sure and our primary interest in that direction for now is making clippy's own lints easier to maintain. This is quite a ways away from happening. |
It seems like we could keep shipping the cargo-clippy external subcommand if this were shipped as
My guess is that the lints would stay name spaced under
Not sure I'm understanding the point here correctly, but I don't think its a particularly big deal for clippy changes to require PRs to cargo or rustc. Clippy depends on rustc internals so I think thats already a constraint on clippy. And as for cargo's PR process my experience with it has always been easy and positive. I do see the value to a generic lint interface and I would love to see one, and more linter sources. But I do think I lean in Manish's direction on this one. I think its fine to stabilize this as clippy and then we could immediately open an issue for |
Yes, and it's not just "won't fix", it's also often "can't fix".
Right, which means that people need to learn the name "clippy" anyway. |
This comment has been minimized.
This comment has been minimized.
Sorry, my previous comment was unproductive. Spoke a bit to @Manishearth just now, and clarified some things. The division line that I see us crossing here (and that I've been concerned about, including in the comment last year) is when we ship a cargo subcommand pre-installed to everyone by default. If the user has to take special action to get cargo clippy installed as a valid command on their machine (even if that action involves adding rustup components and not From that perspective, I have these concerns with the current
I prefer what I think is already the status quo (but I admit I've had difficulty piecing it together from these threads): an external |
That's fair. Anyway, I'll wait for y'all to discuss this and come to consensus within yourselves, and we'll see how to move forward from there. |
I think we can have our 🍰 and eat it, too. If I understood the suggestions and positions correctly, we have one uncontroversial way forward:
This will keep the custom name and special cased |
@oli-obk I mean, we don't need to yet introduce This way we don't have to tie the design of the |
Oh yea, we can definitely start out by just doing that and slowly iterating the unstable design.
Oh I definitely didn't mean to suggest this to be the final design. I just wanted something that we can reach quickly. |
Keeping the command unstable seems to do a good job of not tying down the design and it existing would in theory introduce people to the concept of a future |
Should not the name of a future |
On October 5, 2019 8:47:09 AM GMT+02:00, spunit262 ***@***.***> wrote:
Should not the name of a future `lint` command just be `check`? I
always just think of `clippy` as just `check` but with more lints.
Agreed. We should fully integrate the two so that check runs both and provides all the output by line/column, rather than all the compiler output followed by all the clippy output.
I don't think we should have a separate `cargo lint` at all. I do think we should have a separate `cargo clippy`that just runs clippy, but it can be an alias for an option to check, too.
|
I think that's already the case? The compiler and clippy lints get printed together. No other compiler output is mixed in because of the way the compiler pipeline works. |
slight difference: you want to rerun lints each time you run the command |
Sorry I missed this for so long, I have been absolutely drowning in GitHub notifications lately :-( First off, I think there is a lot of very valid discussion here and given the permanent nature of a change due to back-compat, I think we should not rush this decision. There are too many points to quote and reply so here is a random selection of thoughts in random order:
I think that my preferred solution (mentioned by @withoutboats and @spunit262) is that clippy linting should be an argument to I'm not sure of the exact syntax, but I think something like |
Not sure what you mean by that --
This pedigree is somewhat tainted: in some communities it's more on the side of My pushback against starting off with I also want it to be easy to run clippy, CLI flags are not easy. This is a major criticism of Git, for example -- common tasks are often hidden behind CLI flags that you need to memorize (and Git, at least, ships with bash completion!). I think this is a far worse problem than "our verbs are inconsistent", actually. I can't think of any common task that is currently behind a flag in Cargo, it's all "cargo dothething", and that's a very good thing. It's not that I don't use flags, it's just that I typically only use flags in exceptional situations (cross compilation, features, etc). This is not a problem if we also ship the alias (which can be done through rustup as it's done right now), but we shouldn't deprecate it. Furthermore, one of the reasons behind this PR is to make To reclarify my current positions
|
I agree with this statement, but come to the opposite conclusion. Although we're used to thinking of Clippy as an action (i.e., a thing to do), I think that is because of history. As a user, I don't actually want to run Clippy, I want to check my code for errors or attempt to build my code, but I want to get Clippy's input as well as the compilers (i.e., the thing I want to do is to
I mean that I want to try build my program and see Clippy warnings at the same time as the compilers, i.e., I want a single command that does |
☔ The latest upstream changes (presumably #7450) made this pull request unmergeable. Please resolve the merge conflicts. |
As a user I strongly agree with the sentiment that Clippy lints should just integrate into the normal build process. My preference would even be to note in the I believe having lint providers configured in the |
There has historically been a lot of pushback from other teams to running
Clippy as part of the standard build process. That option isn't being put
on the table here.
…On Wed, Oct 16, 2019, 2:27 AM Nemo157 ***@***.***> wrote:
As a user I strongly agree with the sentiment that Clippy lints should
just integrate into the normal build process. My preference would even be
to note in the Cargo.toml that Clippy should be active for this crate,
and have the lints run during all kinds of builds (these is the issue I
assumed @nrc <https://github.com/nrc> meant about integrating cargo clippy
and cargo build better, they might share output *files* but they don't
share output *warnings*). This would allow me as a project maintainer to
not have to tell contributors anything about running Clippy, they would
just run cargo test as normal and either see Clippy warnings output, or a
warning like this project has registered the `clippy` lint provider, but
you do not have it installed, you can get it by running `rustup component
add clippy` .
I believe having lint providers configured in the Cargo.toml would also
help integrating with other ecosystem tools, e.g. RLS currently requires
you to explicitly add #![warn(clippy::all)] in order for it to detect
that it should be using Clippy when producing warnings.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7382?email_source=notifications&email_token=AAMK6SHWSURAIQHX5EORUXLQO3NBTA5CNFSM4IYDTLEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBL2AAA#issuecomment-542613504>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMK6SEOVZE3KIK2WIXNHB3QO3NBTANCNFSM4IYDTLEA>
.
|
The Cargo team discussed the issues brought up here, and we'd like to propose the following alternative: Given the primary motivator here is to fix the fingerprint/caching issue, we'd like to extend Cargo in such a way that the Background: Currently The proposal is to add a @yaahc indicated they'd be willing to implement this, which will initially be only used behind the Some of the other issues with This maintains the status quo of the current solution while providing a fix for the immediate concern. If there is a desire in the future to have a more extensible or integrated linting experience (however you want to define that), and someone willing to drive it, then that can be a separate project for the future, but I don't foresee that happening soon. How does this plan sound to everyone? Were there any other motivators that would cause issues with this arrangement? (Note: I have a separate comment on #7383 for integrating with |
This plan gets a big +1 from me. Also I'd like to point out for everyone else that the internal variable in cargo that is being set via |
@ehuss i'm concerned about including it in the fingerprint: won't this mean that cargo clippy will delete existing metadata from a previous check run? i'd rather clippy not cause problems with other workflows, it should be able to read and write the same metadata Otherwise this sounds great. I'm not a huge fan of the wrapper model -- i feel like PRIMARY_RUSTC would be better than PRIMARY_RUSTC_WRAPPER -- but I'd defer to y'all for which plugin interface you want to encourage. |
Oh, I should have been clearer on that. It should include it in the metadata hash, not the fingerprint (it doesn't really matter if it is in the fingerprint, it's probably not necessary). That way, the clippy artifacts will have a separate filename, and won't collide with As for I just realized in my note on |
oh, yeah build scripts do make this an issue. Let's stick to the wrapper then. |
Hmm, ideally they should be able to share artefacts since clippy doesn't do anything to change the generated artefact, but i guess this is fine |
Yea, there's not much that can be done about that for now. The only consequence is a little wasted disk space. The dependencies will all be shared, just the workspace members might have two copies. I personally would also be fine with just putting it in the fingerprint if the extra disk space usage is a concern, I don't really care either way. |
Confused by the discussion around I'm not really sure if this has any impact on the discussion around fingerprints and metadata hashes but I want to make sure I'm not misunderstanding how people want this implemented. My plan right now does not include messing with any form of wrapper. |
|
related to rust-lang/rust-clippy#3837