New Code Period - Previous Version Issue


Our environment:
Sonarqube: Community Edition - Version 8.9.6 (build 50800)

In our use-case we wish the New Code findings to be compared with the findings of previous versions. So we utilize the New Code → Previous Version definition.

If we understand correctly, based on the documentation: “This works well for projects with regular versions or releases.”, the New Code tab should be updated each time the project’s version number changes, for example from Version 1.2.0 → Version 1.2.1.

However, new findings are being added under the New Code tab even if we don’t change the version number (through pom.xml) for e.g. 2 subsequent analyses.

On first glance, it appears that the Previous Version definition behaves more or less like the default 30 days setting.

Have we misunderstood something about the way this definition works?

Thanks in advance,

Hi Chris,

Could you provide a screenshot of the left side of your project’s Activity tab so we can better understand your version-change frequency?


Hello Ann,

Here’s the activity tab:

In all of those analyses, we didn’t change the project version number (0.0.3-SNAPSHOT), so from our perspective, these changes shouldn’t be treated as New Code findings. This raised even more questions for us. The first one is what does “Previous Version” mean for SonarQube?


For example, if we release 0.0.4 will SonarQube treat that as new version (Ideally, this is what we want to happen)? Or does it treat the the last analysis that ran as the “Previous Version”?

In addition, at 08/02 we performed multiple analyses, as you can see in the activity tab, only the last one (from 4:52 PM) is kept in the records. Why is that?

Much appreciation for your time,

Hi Christos,

Fair question in your circumstance. It means that the sonar.projectVersion value changed. So I would not expect to see the new code period baseline within the 0.0.3-SNAPSHOT range.


That’s normal housekeeping. From the docs:

For each project:

  • only one snapshot per day is kept after 1 day. Snapshots marked by an event are not deleted.

But let’s back up to what’s going on right now. Your Activity tab looks (unexpectedly) normal, so could you also provide a screenshot of your Project Settings → New Code interface?


Hello Ann,

Here’s the Project Settings → New Code interface:

And here’s the New Code findings:

Once again, thanks for your time.

P.S. Who’s that guy that appears as my avatar in your replies? :stuck_out_tongue:

Best regards,

Hello Chris,
I’m the lucky one who appeared in Ann’s replies. :slight_smile: I fixed that.

1 Like

Hey Christophe,

That was my morning dose of surrealism until we figure it out, haha.


1 Like

Hi Chris-es,

Sorry about the mixup. :joy:

Siraxis, I’m out of my depth now & going to have to call in more expert help. In the meantime, could you provide

  • When the New Code Period should have started (screenshot form would be nice IMO)
  • A recent analysis log (this is likely irrelevant, but just in case…)


Hey Ann,

I guess we managed to comprehend how the “New Code Period - Previous Version” works.

So what we did here was to introduce a new version 0.0.4 plus new Code Smells. A new analysis was fired up. The new code findings:

Next, we added another Code Smell into 0.0.4 version.
New code findings:

Then we changed the version to 0.0.5-SNAPSHOT and added another Code Smell. So these are the new code findings from the latest analysis:

So from our understanding, SonarQube performs an analysis in every “New Version” and displays only the differences compared to the previous version(s). These differences will be treated as New Code findings.

Is that correct? Please let me know if we misconceived it.

Thanks for your time once again,
Best regards,

Hi Chris,

Yes. What you’ve described is the expected behavior for the New Code Period and Issues on New Code reporting.


1 Like

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