Skip to content

Cyclomatic Complexity

BluInsights offers cyclomatic complexity analysis for multiple languages (see the complete list).


Cyclomatic complexity is a software metric used to indicate the complexity of a program. It represents the number of linearly independent paths through a program's source code [wiki]. It also represents the minimum ideal number of tests, each testing a path.

There are two ways to calculate the cyclomatic complexity :

  • Using the control flow graph of the program : Complexity = E - N + 2 (where E = number of edges and N = number of nodes).
  • Or by calculating the number of decision points ("if" statements or conditional loops) contained in that program plus one : Complexity = P + 1 (where P = number of decision points). This is the method adopted by BluInsights.

Launch complexity analysis


The proposed complexity analysis is performed using the Blu Age products leveraging advanced parsing features for multiple languages (mainly legacy). Launching the analysis is as simple as selecting the programming language.

The analysis of large projects (thousands of programs) may take few minutes. You will receive an email when the results are available. In the meantime, you can use the other features.


BluInsights also allows you to import your own values for the cyclomatic complexity using a JSON file (the required format is shown when the question mark is clicked).


If multiple files have the same filename, the field "path" of these files in the JSON must be filled.

Cyclomatic Complexity Computation

The cyclomatic complexity of any structured program with only one entry point and one exit point is equal to the number of decision points contained in that program plus one. The decision points are if, for, for-each, while, do, catch and case statements. For each method in a program, we calculate this cyclomatic complexity, and the sum of the cyclomatic complexity of each method of a file gives the total cyclomatic complexity of the file.

Each language has only certain types of files containing code: if a file doesn't contains code (such as Images), all the values are 0.

Language Files Extension with Code
PowerBuilder SRM, SRU, SRW
Delphi PAS
Mainframe (Cobol, RPG, JCL and CL) Cobol Extensions (CBL, COB, ...), RPG, RPGLE, JCL, CL
.Net C# CS


  • Besides Cobol files, the files of a given language must have their right extension so they can be parsed. You can use the classification feature if needed. Cobol files can have any extension or none at all.
  • Cobol (.CBL) files complexity is computed with the Copybooks (.CPY) already inlined.


The .Net (C#) cyclomatic complexity uses MSBuild and the NuGet package Microsoft.CodeAnalysis.Metrics, provided by Microsoft.


The Total Cyclomatic Complexity corresponds to the sum of the Cyclomatic Complexity of all the files in the project.


The Cyclomatic Complexity result is displayed as a table with all the files within the project. Each file is associated with its total cyclomatic complexity, method count and average cyclomatic complexity per method.


Some files might not have been parsed correctly, due to several possible causes (encoding problem, statement not recognized...). They are shown with a warning sign in place of their cyclomatic complexity values. These issues could be resolved with a support directly on the entries you are submitting.


The result can also be displayed as a graph, with the number of Lines of Code as the x-axis and the Total Cyclomatic Complexity as the y-axis, each dot corresponding to a file. The graph can be filtered according to multiple criteria.


The analysis can be launched as many as you want. The intermediate results will not be saved.