What are the categories of cyclomatic complexity? For example:
1-5: easy to maintain
6-10: difficult
11-15: very difficult
20+: approaching impossible
For years now, I've gone with the assumption that 10 was the limit. And anything beyond that is bad. I'm analyzing a solution, and I'm trying to make a determination of the quality of the code. Certainly cyclomatic complexity isn't the only measurement, but it can help. There are methods with a cyclomatic complexity of 200+. I know that's terrible, but I'm curious to know about the lower ranges, like in my example above.
I found this:
The aforementioned reference values from Carnegie Mellon define four rough ranges for cyclomatic complexity values:
- methods between 1 and 10 are considered simple and easy to understand
- values between 10 and 20 indicate more complex code, which may still be comprehensible; however testing becomes more difficult due to the greater number of possible branches the code can take
- values of 20 and above are typical of code with a very large number of potential execution paths and can only be fully grasped and tested with great difficulty and effort
- methods going even higher, e.g. > 50, are certainly unmaintainable
When running code metrics for a solution, the results show green for anything below 25. I disagree with this, but I was hoping to get other input.
Is there a generally accepted range list for cyclomatic complexity?