llvm / llvm/llvm-project

`readability-function-cognitive-complexity` should have an *upper* bound above which it's just a warning

Open
#178,959 9 comments 0 reactions 0 assignees View on GitHub
clang-tidy enhancement
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

`readability-function-cognitive-complexity` is great, but for a large team on a large codebase, with many overgrown functions, it's hard to start using it. Do you tell everyone they are free to add `// NONLINTNEXTLINE(readability-function-cognitive-complexity)`? Do you pro-actively litter the code with `// NONLINTNEXTLINE(readability-function-cognitive-complexity)`?

What I'd like is `readability-function-cognitive-complexity.JustWarnAboveThreshold` so I can say that a threshold of 25 (the default `Threshold`) is fatal, but above, say, 50, it's not just "a little bad", but too far gone to bother. We could then nudge that upper bound up over time, but just starting in to using `readability-function-cognitive-complexity` my primary interest is preventing functions that are now at 24 from getting to 26, and as it is right now, I can't do that without also either disrupting my team or making a lot of lines of code change.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.