CodeImprover Technical Reference

Metric Name:

Cyclomatic Complexity


In short, this number indicates the number of paths through the code. The more branches in your code the higher complexity. The implementation in CodeImprover is done according to the definition in Wikipedia.

Default setting:

Any complexity above 7 triggers negative Observation Score points.


If the amount of while, for, each, if, case, and, or, not, ?: continue and exit-points in a method becomes too numerous or nested, it is very difficult to keep track of what happens. Cyclomatic complexity is a commonly accepted way to measure software complexity.

What to do:

Avoid deeply nested if/switch branches and for/foreach/while loops by splitting subparts into smaller methods. In this way, the number of paths through a single method is reduced.

Context – How it works
Back to – Metrics reference overview