rust-lang / rust-lang/rust-clippy

Allow some way of marking lints as TODO

Open
#2,158 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request S-needs-discussion
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

I'd like there to be some way to gradually introduce clippy to a code base without having to fix all the existing problems but also minimizing or preventing new violations.


My preferred workflow when introducing new lints to an existing code base is:

  1. Install the tool.
  2. Have the tool generate a "TODO" file that marks all existing lint violations as ignored.
  • Ideally this file is split into two dimensions: file and lint type.

At this point, I commit and push this progress. This prevents any files from getting worse. Then, the team cycles on the following steps:

  1. Pick a single lint that is being ignored.
  2. Fix all of or a subset of the files for that one lint, and push it.

What's interesting to note is that this entire process usually repeats when a new version of the linting tool is released, as this often introduces new lints that we have been unknowingly violating.

This is strongly influenced by RuboCop.

/cc #1295, killercup/rustfix#36

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the workflow described in this issue, along with the related discussions in #1295 and killercup/rustfix#36 and RuboCop's approach. Define how a generated TODO file would record existing violations by file and lint type, while preventing new violations, and verify the design against new lint versions.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.