[clang-tools-extra] [clang-tidy] Add IgnoreAboveThreshold option to readability-function-cognitive-complexity (PR #178965)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 31 07:47:46 PST 2026


https://github.com/vbvictor commented:

Giving default value of 0 which means "ignore" is misleading.
Can we go the same way as https://clang.llvm.org/extra/clang-tidy/checks/readability/function-size.html#cmdoption-arg-LineThreshold. which has `None` as default value.
In `--dump-config` it looks like this:
```
readability-function-cognitive-complexity.DescribeBasicIncrements: 'true'
  readability-function-cognitive-complexity.IgnoreMacros: 'false'
  readability-function-cognitive-complexity.Threshold: '25'
  readability-function-size.BranchThreshold: none
  readability-function-size.CountMemberInitAsStmt: 'true'
  readability-function-size.LineThreshold: none
  readability-function-size.NestingThreshold: none
  readability-function-size.ParameterThreshold: none
  readability-function-size.StatementThreshold: '800'
  readability-function-size.VariableThreshold: none
```
So I'd expect the new option to also have `none` by default, not 0.
Also, can lets add a configuration warning (see `misc-const-correctness` implementation for reference) if `IgnoreAboveThreshold` is less than `Threshold` which imho doesn't make sence and is likely a config mistake.

https://github.com/llvm/llvm-project/pull/178965


More information about the cfe-commits mailing list