rust-lang / rust-lang/rust-clippy
[Feature] Hierarchical allow/deny configuration like `.cargo/config.toml`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Description
I have a feature request.
For "monorepos" i.e. a git with multiple workspace / non-workspace crates, it would be very convenient to configure all lints at a top level, much like .cargo/config.toml configures cargo.
Since https://github.com/rust-lang/rust-clippy/issues/6625 / https://github.com/rust-lang/cargo/issues/12115 it became possible to configure workspace-level lints and then opt-in to the linting in each workspace member, but even that is a bit verbose and tedious for large monorepos. Consider how https://github.com/emilk/egui/pull/4413/files has 34 instances of [lints] workspace = true.
In my particular case I have a monorepo with 4 workspaces and 5 applications, meaning I have to repeat the contents of [workspace.lints.clippy] and [lints.clippy] 9 times, in addition to the 40+ times I have to repeat [lints] workspace = true.
The repetition isn't the issue, the issue is rather the need for all contributors to remember to update all 9 [...lints.clippy] declarations when those settings need to change.
Furthermore it would be amazing if such a configuration file could be able to affect the configuration flags of clippy, i.e. --all-features --all-targets -- -D warnings once so that it wouldn't have to be repeated endlessly in .gitlab-ci.toml, bacon.toml, and various other shell scripts.
It should probably be possible to set a config file of this type to "root", meaning that searching for config files up the tree stops at that point.
If all of this is already possible and handy, I apologize.
TL;DR:
- Mergeable configuration for Clippy much like
.cargo/config.toml - Possibility to configure allow/deny/lint groups
- Possibility to configure "command line options" such as
--all-features --all-targets -- -D warnings
Thank you for an amazing tool!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing .cargo/config.toml model and the workspace lint configuration described in the issue. Compare the requested hierarchical allow/deny settings, Clippy command-line options, and root boundary behavior before defining the configuration shape and affected entry points. Done should include an agreed design for all three requested capabilities, with tests covering configuration discovery and inheritance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100