Reintroduced in 0.20.2
The cyclomatic complexity of a function or method exceeds the configured maximum complexity threshold.
Cyclomatic complexity provides the number of linearly independent paths through a function or method. Metricating cyclomatic complexity is a requirement for many software product assurance activities prescribed in industry.
The cyclomatic complexity of a function or method is incremented by the following contributors:
if
/else
/elif
)match
cases (also applies to function
pattern matching and match!
)for
(for...in) and foreach
(for i in...to) expressionswhile
expressionswhen
expressions in the case of match
Reducing the cyclomatic complexity of a function typically involves decomposing the function into more sub-functions. The cyclomatic complexity calculated by this rule is limited to a single scope of a function or method, i.e. the cyclomatic complexity of a function g
nested within function f
is calculated independent of the complexity of f
and will not contribute to the cyclomatic copmlexity of f
.
There is a single setting applicable to the cyclomatic complexity, which is the maximum cyclomatic complexity.
{
"enabled": true,
"config": {
"maxComplexity": 40
}
}