New Code, Specific Analysis setting does not always work

Hello all,

Sonarqube: Community Edition - Version 8.9.6 (build 50800)
Java: openjdk 11
Database: PostgreSQL 10.10

I am running Sonar analysis on my projects and I use the New Code → Specific Analysis setting instead of the default Number of days (30 days) setting, since I want the New Code findings to be compared with the findings of a specific previous analysis.

While the Specific Analysis setting works as expected on every project I’ve applied it so far, there is this one project for which it never gives me the correct results. I.e.: while the findings on Overall Code are going up, I get 0 findings on the New Code tab. Sometimes, it might give me e.g. 5 new Code Smells on New Code, while on Overall Code the total number of Code Smells has been increased by +100.

I am not sure why this happens, and most importantly to this project only. There are also no related logs that can point me to any direction. The only difference I’ve noticed on this analysis is that it prints the Quality Profiles that were used, which does not appear on other projects (see screenshot below).

Any advice is welcome.



That looks like a screenshot from the Activity tab…? (I have to ask because it’s oddly wide.)

Anyway, I’m glad you included it, because those profile listings are key. They’re only going to show up like that when they changed since the previous analysis.

So what’s happening is that a Quality Profile change is kicking in across languages and the new profiles include rules the old ones didn’t & so raise issues the old ones didn’t.

When new issues are raised on old code, after a Quality Profile change, those issues are backdated, so as not to mess up your New Code Period. And that’s why you’re seeing this big rise in overall issues without seeing a lot of New Code issues.

Does that make sense?


Hello Ann, thank you for replying.

The screenshot was actually from the New Code settings page, but it’s the same in the Activity tab.

Yes your explanation makes sense.
Indeed, on the first analysis (the one I want to compare others with), the only quality profiles in use are: Java and XML. The second analysis includes many more LOC and thus more quality profiles are now in use: Java, XML, CSS, Javascript, Typescript, HTML.

So if I understand correctly, the Specific Analysis setting is not going to work properly in such cases?
Should I use the default settings to compare my findings?


Uhm, well. It’s not the setting. It’s that by changing what’s being analyzed, you’re creating an apples-to-oranges situation. If your “specific analysis” had analyzed the same set of code with the same Quality Profiles, then it would be working beautifully.


Thank you Ann, it’s 100% clear.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.