Difference between Cognitive, Cyclomatic Complexity Quality Gate and Rule

Hi,

Quality Gates use Measures, so what you’re really after is the difference between Rules and Measures. Generally (there are some grandfathered exceptions) Measure-related Rules (i.e. a rule with a threshold parameter) act at the method level and below. Measures that you can see outside of Issues (i.e. in the Measures page) are file-level and above.

When you set a Quality Gate parameter on Cognitive Complexity, you said that for the entire project, there should only be a total - across all methods and files - of 15 Cognitive Complexity points. And the same for Cyclomatic Complexity (although with a different numeric value).

BTW, there is a rule for Cyclomatic Complexity. It’s called something like (depending on the language) “Functions should not be too complex”. It was written and implemented before we invented Cognitive Complexity - before there was a need to differentiate.

IIWY, I’d simply drop those Quality Gate conditions. Your rules will flag all the methods that need work.

 
HTH,
Ann