Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube cognitive complexity metrics


we noticed there is a new rule in SonarQube java plugin about cognitive complexity, "Cognitive Complexity of methods should not be too high", but we didn't understood which metric is used by this rule.
Is there a new metric or an older one, with another name, is re-used ?

thanks

Massimo

like image 781
Massimo Borgogno Avatar asked May 30 '17 10:05

Massimo Borgogno


1 Answers

This rule relies on the new "Cognitive Complexity" metric - for which you can read the definition in the following PDF: "Cognitive Complexity - A new way of measuring understandability".

Note that it differs from the "Cyclomatic Complexity" (the original one that has always been available in SonarQube), which is a way of measuring testability of your code.

like image 111
Fabrice - SonarSource Team Avatar answered Nov 09 '22 06:11

Fabrice - SonarSource Team