Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Purpose

Code Complexity Per Function/Method, level shows Cyclomatic complexity shows complexity calculated based on the number of paths through the code weighted by file, class or function/method amount. 

How metric helps

Code Complexity Cyclomatic Complexity is one of the most valuable code quality metrics helping one to make a judgement on how complex the code is. The more complex the code, the higher the level of code defects, making the code costlier to maintain. So, by reducing complexity, the number of bugs and defects can be reduced, along with its lifetime cost.

How metric works

Chart Overview

The chart represents the level of code cyclomatic complexity (Axis Y) distributed over time (Axis Y). The level of complexity per each project child unit is clickable in the legend, what allow to which allows display/hide the series on the chart.

Chart The chart can be viewed for the number of paths through the code weighted in different ways:

  • complexity per file
  • complexity per class 
  • complexity per function/method

Image RemovedImage Added


Calculation

Complexity = E - N + 2*P,

...

RAG thresholds: Red - metric value > 200, Amber - metric value > 60, otherwise Green.

Data Source

Data for the metric can be collected from Sonar.

...