Why does the return statement increase the complexity?
问题 I use SonarQube for a Java project but the complexity calculation is not clear for me. The complexity value is 3 for the following example: public boolean even(int i) { if (i % 2 == 0) { return true; } return false; } According to the User Guide the complexity is calculated as follows: “It is the cyclomatic complexity, also known as McCabe metric. Whenever the control flow of a function splits, the complexity counter gets incremented by one. Each function has a minimum complexity of 1.” In