rust-lang / rust-lang/rust-clippy
New Lint: Avoid too many static code paths
Open
Nobody has claimed this yet.
A-lint
E-medium
L-correctness
L-style
T-middle
T-MIR
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Based on this HIC++ guideline, in addition to the existing cyclomatic complexity lint. It basically comes down to the possible number of branches in a function's code path, not counting loops. E.g. this is okay:
if this { that }
else { or_that } // Just 2 code paths
Wherease this is not so cool:
if this1 { that1(); } // ... 2 paths (do or don't)
if this2 { that2(); } // ... 4 paths
if this3 { that3(); } // ... 8 paths
...
if this10 { that10(); } // ... 1024 paths - Have fun with unit testing!
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 locating Clippy's existing cyclomatic complexity lint and reading how similar lints are structured. Use the examples in this issue to define the expected static-path behavior; the work is done when the new lint handles these cases and has suitable coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100