-
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
clippy Deny on diff only #4491
Comments
There's currently no such script that does that. Such a script should apply on Rust warnings/errors in general though, not just on Clippy. This could be done by getting the changed files from git and then filtering the JSON-output of the rust error messages by the file names. ( Fun-fact: this request is kind of the opposite of another long standing issue: #2604 |
Such a script should be implemented in Rust and not in Python, like the clang script, obviously. 😉 |
Some months ago I started a private project that does this in the form of a GitHub bot. I'll try and see if I can find some time to bring that to a MVP state and possibly open-source parts of it. |
I have just checked the --message-format json output and it gives the line numbers, which I can then compare with a git diff, so it seems like a pet peeve I can work on, thanks for the hints! |
@o0Ignition0o I just realized that my project was already open-source. You might want to have a look at Feel free to copy things as you need :) |
Wow thanks a lot, I hope I can come up with something useful this week ! |
Just published a very rough first draft of cargo-scout, that will run clippy in pedantic mode and only warn you on the lints that were raised in your patch. There's still quite a lot to be improved, running cargo clean is often required before a clippy run, and I've probably allocated too much, oh and there aren't any tests... But I'll hopefully get there soon ! @phansch I've used the structures you deserialize into, do you mind me adding a "Inspiration" section at the bottom of the README.md with a special thanks to you ? |
Sounds like an idea for great overall tool for Rust projects when it gains option to config which lints are enabled. |
Not at all, I'm glad the code found some actual use =) |
So as a little heads up, cargo-scout 0.3.0 is now out, and has all the features I wanted as I've opened this issue: It only warns on the lints that intersect with your diff. I'll dig further on that, but I'm pretty satisfied with the results so far ! |
Thanks for sharing! I suggested it as Crate of the Week in TWIR: https://users.rust-lang.org/t/crate-of-the-week/2704/694 |
Cargo-scout is crate of the week in this week in rust ! I’m really happy, and I’ve already received some feedback (some suggesting the ability to use cargo fix, which was already brought up here). I’m gonna dig this way :) |
Congratulations! |
As |
We're trying to enable clippy::pedantic on neqo (mozilla/neqo#187 for example) and, given there's lot of refactoring to be made all across the codebase, I was wondering if there was a way to filter clippy warnings only on the "current diff", erroring out or linting only the parts of the code that have been edited when working on an issue.
I was thinking of something like the clang format diff tool
I have no idea how hard it would be to implement, but I would love to implement it if someone would like to mentor me on that one.
Thank's a lot for your time.
The text was updated successfully, but these errors were encountered: