common-cs:InsufficientCommentDensity reported as new on unchanged code

After upgrading from SonarQube 8.9.5 to 9.3.0 we faced some issues of common-cs:InsufficientCommentDensity as issue on new code even the code was not changed for years.
The recent change was made in 2018.

Relevant plugin installed: sonar-scm-tfvc 2.3.1.

Hi,

Can you check your Quality Profile changelog & see if this rule’s threshold was updated?

 
Ann

The Quality Profile was recently changed on 10th march.
So, there is no correlation between change of QP and the issue date.
It is related to the date of SQ 9.3 installation.

Hi,

What language is this file? I want to see if we’ve made any changes to the relevant language metrics.

 
Ann

csharp

Hi,

Thanks. I’m not seeing any obviously relevant changes in this version. I’m going to flip this over to the language experts.

 
Ann

Hi,

I know this looks dormant, but we haven’t forgotten about it. Discussions have ensued behind the scenes.

In the meantime, I’ve just had another thought. The issue you’re highlighting is raised at file level, not on a particular line. Can you check the history on this file and see if comments were deleted recently?

 
Thx,
Ann

I do not find a “history of the file”. Please help me to find this information.

Hi,

That’s going to be in your SCM, not in SonarQube.

 
Ann

As already witten in the initial post: The last change was made in 2018!

Hi,

I re-read that before I asked. I was hoping you meant the last change on a particular line.

 
Ann

Hello @lg2de

Thank you for raising this point.

It currently isn’t clear why this issue happened.

  • Did you see it happen seldom or rather often, on many files?
  • Did it happen only on specific projects / files or there isn’t an obvious pattern from this point of view?
  • Did you change anything else on the CI machines between the 8.9.5 and 9.3.0 scans (e.g. version of msbuild being used)? If the C# compiler versions changes, there might be different behaviors.

This issue might happen either if:

  • the computed measures for the files has changed between SonarQube versions (for example, a different measure of “lines of code” and “comments”), and SonarQube failed to “backdate” the issue (detect that there was no change on the file and ignore the newly raised issue)
  • if no measure has changed, then something else inside SonarQube has changed which triggered this issue

We did make some changes around counting lines of code between these SQ versions around C# 9 support, however I doubt this would have affected files from 2018. So, in short, what you experienced is unexpected.

I’ll do some tests and analyze a project with 8.9.5 and 9.3.0 and see if the LOC measures of the files in the project had any change and come back here.

  • The issue happend to multiple files
  • I do not see a pattern of projects to be affected or not.
  • The C# compiler was not changed. The analyzer/scanner was updated from 5.0.4 to 5.5.3.