InsufficientCommentDensity with API SOnarQube

I send requete to sonarqube to get some information on rules.
Its works for all the rules in my project (S1451, FunctionComplexity, etc.) but for the rule InsufficientCommentDensity (or common-c: InsufficientCommentDensity) it doesn’t work.
Is there a particulary way to get information with this rule ?
Thans a lot.

Hi Frederic,

(Sorry about the missing accents. :flushed:)

What information are you looking for?


Hi Ann,
No problem for the accents and sorry for my English :slight_smile:
I would like to have the source (in java) that have not a sufficient density of comment lines.
With IHM SonarQube I have 3 sources that are not sufficient density of comment lines.
I have written a program in visual basic (VBA) that gets information from the SonarQube Server (cyclimactic number, number of blocker issue, differents rule), but for this rule (InsufficientCommentDensity) my requete doesn’t work, I have a response from the server but it’s wrong.
Best regard.

Hi Frederic,

To be sure, you have this rule activated in the relevant profile(s)? I ask because it’s not on by default. Also, could you show how you’re trying to pull data for this rule?


Hello, Sorry for the delay I was in Holidays !!!
Here after an sample of calling methods in my program
recuperationTransgressionsPourUneRegle("&componentKeys=" & “Kyanite” & “&resolved=false&rules=c%3A” & “S138”)
recuperationTransgressionsPourUneRegle("&componentKeys=" & “Kyanite” & “&resolved=false&rules=c%3A” & “InsufficientCommentDensity”)
The first call is OK but the second is KO
Kyanite is the name of my project on SonarQube
Best regard.

Hi Frederic,

The best thing to do when you’re trying to figure out which web service to use or how to use it is always to start from the UI. Get it to render the data you want and use your browser tools to see what calls were made.

I just did that for a Java “common” rule. I see this in the call:

So it looks like you need to adjust the repository name, probably from c to common-c.


Hello Ann,
I am going to try your solution and I will inform you.
But it is a good idea !
Thanks a lot.

Houra Houra !!!
It’s work !!!
Thank thank thank a lot !!!

1 Like