Skip to content
Discussion options

You must be logged in to vote

Hi @nk-ty

Thanks so much for this bug report. After some contemplation and investigation (which I will share below), I think that the answer is:

  • neither codeclimate nor qlty are returning a cognitive complexity score here that makes sense (qlty: 0; codeclimate: 6)
  • while there can be differences in smells between qlty and codeclimate, in this case, there is a "right" answer, which is based on the Cognitive Complexity spec published by Sonar
  • we intend to fix qlty where it disagrees with the spec
  • we believe the right answer after looking at the spec is that your code sample should have a cognitive complexity of 3

For some more detail about the cognitive complexity here ...

The if (by which…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@noahd1
Comment options

Answer selected by brynary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants