-
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
Add option to set all lints to allow/warn/deny on command line #1340
Comments
|
|
Arf, my brain was still sleeping. |
Oh, very cool. Thanks! |
Well we should add that in the “Allowing/denying lints” section of the README probably. |
I'm not sure this is working. I'm trying to deny all by default like so:
However I'm not hitting some lints that I know I should be, for example when I run |
The |
Sweet, that worked. Thank you! |
I think it still isn't doing quite what I was hoping for. I'd like to be able to deny all by default, and then allow individual lints on a case by case basis. I was trying to do this with Of course, I could go through all of clippy's lints and However, my thinking here is that if clippy adds a new lint which defaults to allow, I won't know about it, even if it's something which would be good to turn on. |
This may really be more a rustc issue, since I suppose that's what's processing the allow/deny rules. |
@casey: It seems like this can be made work with attributes in the root modules of a crate, e.g.: #![deny(clippy::all)]
#![allow(clippy::module_inception)] |
It would be preferable not to have them in the crate though, especially if you don't want anyone but yourself to be exercising aggressive lints in |
I think this issue can be closed, since allowing/denying lints on the command line is possible and documented in the README. @kentfredric You can also do this by adding a feature to your crate and allow/deny lints behind #![cfg_attr(aggressive_lints, deny(clippy::pedantic))] and
https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section |
@flip1995 I don't really even want reference to those lints in the source if I can avoid it. It seems too much like the wrong place to solve it. |
You can do this on the command line by calling
|
@flip1995: How does that interact with source code based Clippy configuration? |
IIRC the precedence for lint levels is
So if you allow a lint on the command line and decline the lint in your code, the lint should trigger and produce an error. |
@flip1995 I've been doing that, however, the latter '-A' gets ignored for some reason, and you still get problems with the stated lint. That's the only reason I'm active on this bug, I already tried that approach, it does not work.
|
This came up in #4091 recently. Can you test #4091 (comment) and report back in #4091? |
I run clippy from the command line, and it would be very nice to be able to set all lints to
deny
and then whitelist lints by setting them towarn
orallow
as necessary:The text was updated successfully, but these errors were encountered: