Skip to content
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

Override global rules from in-source attributes? #6

Open
Fishrock123 opened this issue Jul 29, 2022 · 4 comments
Open

Override global rules from in-source attributes? #6

Fishrock123 opened this issue Jul 29, 2022 · 4 comments

Comments

@Fishrock123
Copy link

Similar to what was mentioned in #3 (comment), but a little different. Perhaps that issue exists because this is just impossible.

I'd like to be able to use this tool, but with a blanket set of fairly "aggressive" rules across an entire organization.

Sometimes, like in the case of clippy::print_stdout this is appropriate for most projects (encourage folks to use the log crate), but I may want to disable it fro a CLI tool. Ideally I'd like to not have to adjust the project or workspace level Cranky.toml (since it may be automated). So, i'm hoping there would be a way to set an override from an in-code attribute, since that seems the most reasonable place to have such a thing...

See also https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Have.20in-code.20lint.20attributes.20have.20higher.20precidence.20than.20.2E.2E.2E/near/291373867

@Fishrock123
Copy link
Author

Looks what I am experience is likely a clippy bug for specific rules: rust-lang/rust-clippy#6610

@ericseppanen
Copy link
Owner

If Cranky.toml had a way to say "load rules from this other toml file first", would that be useful?

@Fishrock123
Copy link
Author

Yes, but I'd rather do this finer grained stuff in the source code - sometimes we may not have an extra directory for a second file to live in.

@ericseppanen
Copy link
Owner

cargo-cranky is a very thin wrapper around cargo-clippy, so it's pretty limited in what it can do. If it's not possible on the clippy commandline, then I don't think it's possible to fix from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants