Open bkdotcom opened 2 years ago
The cognitive complexity whitepaper is a bit vague/ambiguous
https://www.sonarsource.com/docs/CognitiveComplexity.pdf
Jumps to labels
goto adds a fundamental increment to Cognitive Complexity, as do break or continue to a label and other multi-level jumps such as the break or continue to a number found in some languages. But because an early return can often make code much clearer, no other jumps or early exits cause an increment.
B1. Increments
- goto LABEL, break LABEL, continue LABEL, break NUMBER, continue NUMBER
Appendix C has a code examples containing a break;
(break without a label)
No increment in assigned/given
I apologize if this isn't the correct repo to report this
CodeClimate reports the Cognitive Complexity of the following function as 14 I believe the value should be 12
It seems that CodeClimate is incorrectly incrementing the
continue
statementscontinue;
should not incrementcontinue LABEL;
should increment