How to get details of cognitive complexity scores?

  • Community Edition
  • Version 7.5

Hi everyone, I would like to find out whether it is possible to get the derivation of the scores of cognitive complexity, which means how Sonarqube calculated the scores. The whitebook of cognitive complexity shows some examples of code and how the related scores are calculated. Is there any ways to get that for real projects? Thanks.

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.5 → 7.9.6 → 8.9.10 → 9.8 (last step optional)

(Note that the release of a new LTS, 9.9, is expected on 7 Feb 2023.)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

And – in any version of SonarQube, it’s only possible to see how the Cognitive Complexity was calculated for a given function/method when an issue has been raised – like Cognitive Complexity of methods should not be too high. See this issue as an example

Thank you for your kindly reply. I also want to inquire that is it possible to see complexity scores on the overview page. Thanks again!

It’s not possible – but you can view complexity scores in the Measures tab of your project.