Not able to find the Lines which led to cyclomatic complexity

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) : * Enterprise Edition - Version 9.9.1
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve - Need to identify the line of code which caused the cyclomatic complexity & cognitive complexity
  • what have you tried so far to achieve this - Navigated as below and opened a file in read view but the line which lead to the complexity is not highlighted
    Measures-> complexity → Cyclomatic Complexity

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi,

In an issues context, where an issues is raised because complexity is over the threshold, the issue will identify all the lines that contribute complexity in the method.

In a measures context, you’ll just need to understand how Cyclomatic Complexity works and do the calculation manually.

If you really want SonarQube to show you every line that contributes complexity, then you could tune the rule’s threshold value down to 0 and re-run analysis, but this really isn’t something I can recommend.

 
HTH,
Ann