Question
What is cyclomatic complexity or McCabe's complexity?
Answer
It refers to the number of times a line of source code is entered in its execution.
Number of executions | Level of complexity |
1 to 10 | Not complex |
11 to 20 | Moderately complex |
21 to 50 | Really complex |
More than 50 | Too complex |
It is advisable to endeavor to keep the cyclomatic complexity as low as possible (according to this external site); you may want to refactor code beyond a certain threshold. The chart was adapted/taken from pages 474 and 475 of Expert Python Programming.