Purpose
Code Complexity Per Function/Method, level 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 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 it works
Chart Overview
The chart represents the level of code 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 display/hide the series on the chart.
Via the menu a certain parameter can be selected to display complexity calculated based on the number of paths through the code weighted by file, class or function/method.
Calculation Formula
Complexity = E - N + 2*P,
where
E = number of edges in the flow graph.
N = number of nodes in the flow graph.
P = number of nodes that have exit points
RAG thresholds: Red - metric value > 200, Amber - metric value > 60, otherwise Green.
Data Source
Data for the metric can be collected from Sonar.