Cyclomatic Complexity
To enhance understandability in our code, cyclomatic complexity must be limited. Cyclomatic complexity is related to the structural complexity of the code which being analysed. High complexity leads to a high number of defects and maintenance costs. In order to calculate cyclomatic complexity, we have to create a graph. Also this metric give us results related to testability. The general formula to compute cyclomatic complexity is: M = V(G) = E - N + 2P Graf Terimleri V(G) = Cyclomatic number of G E = Number of edges N = Number of nodes P = Number of unconnected parts of the graph If there are no branches, the cyclomatic complexity level is 1. As branches raise cyclomatic complexity levels rise. Code Highlighting Example #include 1. void exampleFunction(int a, int b) { 2. if (a > b) { 3. std::cout << "a is greater than b" << std