Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
- what are you trying to achieve
- what have you tried so far to achieve this
We are using SonarQube 7.5.
We have set our Quality Gates to fail the projects with below conditions:
- Cognitive Complexity cannot be > 15
- Cyclomatic complexity cannot be > 20
Also, we have enabled a Java Rule-
Cognitive Complexity of Methods should not be too high (>15)
Projects fails showing number of Cognitive and Cyclomatic complexities are high (cog - 673, cyc - 572) and cannot be > than 15 and 20, however when we drill down to code level, it only shows the number of complexities in the file in Measures tab, but not which lines/ blocks has to be fixed to resolve these.
The Java Rule configured: - Cognitive Complexity on methods should not be too high (>15).
The Cognitive Complexity as per Java rule we configured shows the count as 193 (under Critical Issues), and this shows the code level drill down and in which method to fix the logic.
we don’t see any Java rule specific for Cyclomatic Complexity.This is okay, as we can identify and fix the cog complexity on method level.
I would like to understand the difference between the rules and gates.
Are these rules applied on method level?
And Quality Gate applies on the entire project level?
The gates we applied on Cyc and Cognitive Complexity is it right? Please suggest.
- Cognitive Complexity cannot be > 15
- Cyclomatic complexity cannot be > 20