CodeQL library for C#
codeql/csharp-all 0.4.4 (changelog, source)
Search

Predicate cyclomaticComplexity

the number of branching statements (if, while, do, for, foreach switch, case, catch) plus the number of branching expressions (?, &&, ||, ??) plus one. Callables with a high cyclomatic complexity (> 10) are hard to test and maintain, given their large number of possible execution paths. They should be refactored.

Import path

import semmle.code.csharp.metrics.Complexity
predicate cyclomaticComplexity(Callable c, int n)