A method has more independent paths through it than the limit
What it finds
The cyclomatic complexity of a method counts the paths through it: one, plus one for every if, loop, catch, conditional expression, case label other than default, pattern guard, && and ||. A method with many paths needs many tests to cover them and is easy to break. Code in classes declared inside the method is measured with those classes; lambdas count with the method.
The limit is the parameter max, 20 by default.
From the rule's source, cyclomatic_complexity.rs.
Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/java:cyclomatic-complexity" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/java:cyclomatic-complexity] reason="..."tx0 explain tx0/java:cyclomatic-complexity shows the same in the terminal. Found a false positive? Report it.