In Sonar, for a particular Java class, I see :
Complexity: 830
Complexity /method: 8,1
How could you explain the difference between those two metrics ?
Is "Complexity" the class complexity ?
What is the maximum complexity a class should be under ? I know methods should be less than 10 for method complexity, but what is the maximum class complexity number a class should conform to be considered not complex ?
Thanks.
EDIT
I also look at Cyclomatic-Complexity rule violations in the file.
For a number of methods, sonar says with different complexity numbers (in french) :
"La complexité cyclomatique de la classe est de 28 alors que le maximum autorisé est de 10."
in english :
"The class cyclomatic complexity is 28 but the maximum allowed is 10".
I don't understand why it says "class cyclomatic complexity" as it seems as a "method cyclomatic complexity".
Also, the class in question does not appears on top of the most complex class sorted by average complexity/method, as sonar says it has only 8,1 average method complexity.
You can have a look at our "Metric Definitions" Wiki page (and more specifically on the "Complexity" section) to know more about the meaning of metrics found in Sonar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With