-
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
Missing lint categories? #6366
Comments
I want to write a MCP about this for a long time now. My plan is basically to introduce more The problem right now is, that when we put lints in an allow-by-default category, discovering those lints is kind of hard. Enabling the complete If we had more allow by default lints, we would solve 3 problems/annoyances at once:
The lint in #6086 would then go in The downside of this is, that lints like #6086 may warrant to be at least warn-by-default, but would then be |
I do want this to be warn by default. It's about suspicious code. Really suspicious. If that code was in Among Us, it'd be ejected immediately, it's so suspect. Still, there's nothing explicitly wrong, so deny by default / correctness is not what we want here. Also people will likely agree that even if there are false positives, those look fishy enough to warrant an explanation. Furthermore, I think we have enough allow-by-default categories. I'd rather have a process to get lints out of nursery, but again, many lints lack a suitable category even if we can somehow get the false positive rate under control. |
So a A "warn-by-default correctness group" came up now or then in the past. We could add such a group. The question is about naming.
I disagree. We have 3 groups, where one is basically for broken/unusable lints (
The process would be, that someone needs to fix the issues with those lints. And if a lint is in nursery, there are usually many issues. |
And I fully agree with you on nursery. I still think that allow-by-default lints are probably underused, so there's less value in adding more categories there (though I may reconsider if someone shows me a suitable category) than in filling holes in our warnings categories. |
Hmm... @rust-lang/clippy Do you have ideas how to name a warn-by-default
I mean, those are not mutably exclusive. I don't want to introduce completely new allow-by-default categories, but use the categories we already have to bring structure to the |
I've always liked I think we really want that warn-by-default category, regardless of the name, as the need for it has popped up multiple times. IMO splitting About the FP rate, I think it's fine if a currently
My point is that it would be great if warn/deny-by-default lints were almost FP free, and lints in the allow-by-default categories we are defining here had a couple FPs at most. |
To be more clear about my last point: we should be more strict about FP rate, |
@ebroto agreed, but let's be clear here that we will allow some FPs if and only if those are only triggered in a niche inhabited by experts who know when to Otherwise we'd run the risk of making those lints allow by default and only the few who bother to activate them will benefit. |
"suspicious" seems okay to me actually. Alternatively we can have the |
I think keeping the lint groups distinct makes things easier for the user. Especially when configuring lint levels per group. |
I also think that a |
I'm also good with |
Perhaps name the group I think there are 3 orthogonal attributes at play:
|
I wonder if we should have some kind of "simplification" group. We could have a |
+1 for I'm reviewing code of Cargo creates and looking for potential security issues, like backdoors and malicious code. I've realized that there are several ways to obfuscate Rust code to mislead code reviewers, so I'd like to flag such suspicious code for extra scrutiny. I like @llogiq description that "If that code was in Among Us, it'd be ejected immediately". I've started writing my own parser to detect these, but soon realized I'm just reinventing Clippy's internals. macro_rules! totally_innocent_debug {
($e:expr) => unsafe { $e }
} use std::mem::transmute as into; #[no_mangle]
fn fopen() {} include_str!("/etc/passwd") fn never_mind_me() {
#[path="../../../cargo/registry/other-crate/hidden.rs"]
mod sneaky;
} |
With my recent return to reviewing clippy PRs, I found that it is often hard to categorize lints.
For example, #6086 would warn about something that is likely incorrect, but doesn't warrant a
correctness
lint, because it is just a heuristic and could have false positives. For now, we chosestyle
, but that seems wrong. Perhapsconsistency
?The text was updated successfully, but these errors were encountered: