Is cyclomatic complexity a good metric?
In short: complexity is difficult to measure. Like all of the methods listed above, Cyclomatic Complexity is not a perfect method of calculating how “complex” or “good” code is, however it is an interesting metric to understand and keep in mind.
What is a good value for cyclomatic complexity?
For most routines, a cyclomatic complexity below 4 is considered good; a cyclomatic complexity between 5 and 7 is considered medium complexity, between 8 and 10 is high complexity, and above that is extreme complexity.
How much cyclomatic complexity is too much?
1 Answer. Exact number is team/personal opinion based, but 100+ is definitely way too high. The rule reports a violation when the cyclomatic complexity is more than 25.
How is cyclomatic complexity used to measure software quality?
Cyclomatic complexity (CYC) is a metric for software quality. It was developed by Thomas J. McCabe Sr. in 1976. In its simplest form, CYC is a count of the number of decisions in the source code. The higher the count, the more complex the code. It can be used in two ways, to: Limit code complexity.
What are the pros and cons of cyclomatic complexity?
While Cyclomatic Complexity is a very useful metric, there are pros and cons to enforcing it as a metric. High Cyclomatic Complexity can be an indication that your function or module is doing too many things, and should be broken down
How is cyclomatic complexity related to line numbers?
Cyclomatic Complexity and Line Numbers Just looking at the number of lines of code by itself is, at best, a very broad predictor of code quality. There is some basic truth to the idea that the more lines of code in a function, the more likely it is to have errors.
When did Thomas McCabe invent cyclomatic complexity?
Cyclomatic complexity (CYC) is a metric for software quality. It was developed by Thomas J. McCabe Sr. in 1976. In its simplest form, CYC is a count of the number of decisions in the source code.