rust-lang / rust-lang/rust-clippy
Cyclomatic Complexity should not count code in `debug_assert`
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Found an allow(cyclomatic_complexity) in chrono:
https://github.com/chronotope/chrono/commit/4c18d701cacc4b7e4b8ed7dd8101ff82e7e36ba0
I assume that all the complexity comes from the expansion of these assert macros. We should treat them as function calls.
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 cyclomatic_complexity lint and reproduce the behavior described in the chrono commit 4c18d701cacc4b7e4b8ed7dd8101ff82e7e36ba0. Check how debug_assert macros are expanded and counted; done means their internal code is treated as a function call rather than contributing complexity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100