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

Add a file allowing cross-crate configuration of lints #45832

Closed
oli-obk opened this issue Nov 7, 2017 · 4 comments
Closed

Add a file allowing cross-crate configuration of lints #45832

oli-obk opened this issue Nov 7, 2017 · 4 comments
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Nov 7, 2017

Right now, if your project has a certain set of lints it wants to use, it needs to repeat the #![deny(foo)] entries in every single crate of the project.

In the clippy project it has frequently been requested (rust-lang/rust-clippy#1313) that we add a clippy.toml file which would have entries for allowing, warning and denying lints, instead of requiring -A, -W or -D flags to the compiler.

I think this is something that should be solved on the rustc side. As a minimal version I propose to add a --lint-file=foo.toml or --lint-settings=foo.toml setting, which is default-filled by cargo by crawling up the directory tree and looking for a lints.toml or rustc.toml (or a green bikshed).

To reduce repeating the lint modifiers, I propose to use the keys allow, deny, warn and forbid of Vec<String> type:

deny = [
    "foo",
    "bar",
]

Does this require an RFC?

@TimNN TimNN added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Nov 7, 2017
@nrc nrc added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Nov 27, 2017
@kennytm
Copy link
Member

kennytm commented Nov 27, 2017

Cargo can parse the lints.toml and pass the -D/-W/-A flags to rustc directly, without introducing the --lint-file flag. I think this is purely a cargo feature.

@kennytm kennytm added the A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. label Nov 27, 2017
@sanmai-NL
Copy link

sanmai-NL commented May 3, 2018

Right now the README says:

Some lints can be configured in a TOML file named with clippy.toml or .clippy.toml. It contains basic variable = value mapping eg.

Which lints can be configured?

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 6, 2018

closing in favour of rust-lang/cargo#5034

@oli-obk oli-obk closed this as completed Jul 6, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 6, 2018

Which lints can be configured?

That's a clippy topic, have a look at https://github.com/rust-lang-nursery/rust-clippy/#configuration for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants