The cyclomatic complexity measures the complexity of a program and is based on the control flow graph. It is a count for the number of linearly independent paths through the source code. It was developed by Thomas J. McCabe, Sr. in 1976.
The CC goes through a coding block and counts every time, the control flow has a new path at a specific decision point. A new path will be created due to a “IF”, “ELSE”, “CASE” and so on.
Ideally, the CC should be between 7 and 15 at each coding block.
1. How to configure CCN
1.1 Open any program using Tcode “SE38”. Go to program->check->Code Inspector
1.2. Click on Utility->Default Check Variant->Maintain
1.3 Select procedural metrics in selection screen. Click on green arrow button in front “procedural metrics”
1.4 Select Show Metrics option. Change in “Scope and rule for metrics section as per your need”. Click on Ok button.
2. How to check CCN
2.1 Open program using Tcode “SE38”. Go to program->check->Code Inspector
2.2 Go to “Procedural Metrics “ section. Double click on the detail line as per below screen shot
2 .3 Cyclomatic complexity number should be displayed as output.