Complexity for one function

Hello !

I try to obtain the complexity for one function with SonarQube.

First, I found I had to downgrade my SonarQube version to 6.6 to have the feature “Complexity / function”.

My first question is : Is there a way to have this feature in a more recent version of SonarQube ? I saw it had been removed since the version 6.7.

As seen in this picture, I have a popup “2 functions have a complexity around 30”.

My second question is : Is there a way to know which particular functions have a complexity around 30 ? When I click on a file below the popup, I don’t see any complexity for each function.

Thank you for your answer and have a good day ! :slight_smile:

Marie.

Hi Marie,

It is not possible to navigate directly to the individual functions that have a specific complexity as shown per columns. SonarQube only tracks the overall distribution, it does not maintain a mapping of which functions have which complexity. Two notes on top of this:

  • if you wish to track functions that have a complexity too high, then you should use the dedicated rules for that purpose (search for complexity on rules page). It will trigger automatically in case of violation, and you’ll then benefit from the full feature-set of Issue Tracking and Issue navigation.
  • the specific distribution as you see it in v5.6.x is indeed no longer rendered in v6.7.x LTS. That is because previous point should be favoured to track abnormal complexity, and overall measure reporting has evolved into more interactive visualisations (refreshed Measures page).
1 Like

Hello,
Complexity / Function, etc. not showing in my version/setting of SQ. Any ideas? Cyc C and Comp C yes, but not per Function, File, Class, which I am seeking.
KR

HI NicoB,
Can I use this feature in version v6.7.x LTS
if not,can I develop a metric plugin to retrive it