You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to request to add "Cognitive Complexity" to this library as an option to select in the CLI and through hooks. This is a common quality check in the SonarQube application, used by many for static code checking.
Please see this document written by Sonar: https://www.sonarsource.com/docs/CognitiveComplexity.pdf. Importantly: "Unlike Cyclomatic Complexity, Cognitive Complexity adds a fundamental increment for each method in a recursion cycle, whether direct or indirect".
I am curious as to the opinions of others :)
Example 1
I like the example in the PDF, where the Cyclomatic Complexity is the same, but the Cognitive Complexity is vastly different:
Introduction
I would like to request to add "Cognitive Complexity" to this library as an option to select in the CLI and through hooks. This is a common quality check in the SonarQube application, used by many for static code checking.
Please see this document written by Sonar: https://www.sonarsource.com/docs/CognitiveComplexity.pdf. Importantly: "Unlike Cyclomatic Complexity, Cognitive Complexity adds a fundamental increment for each method in a recursion cycle, whether direct or indirect".
I am curious as to the opinions of others :)
Example 1
I like the example in the PDF, where the Cyclomatic Complexity is the same, but the Cognitive Complexity is vastly different:
Example 2
Consider the following code:
The Cyclomatic Complexity, also the one currently reported by
mccabe
, is 7:The Cognitive Complexity, as reported by Sonar, is 22 due to all of the nesting.
The text was updated successfully, but these errors were encountered: