New code period not starting when version changes

Hello,

I’m having difficulty getting a New Code Period to start when the project version changes. The following are the steps I used in this scenario:

  1. Perform a SonarQube analysis on master at 12:34 PM with version set to 1.1.514
  2. Introduce some code changes to master
  3. Perform a SonarQube analysis on the new code at 1:25 PM on master with version set to 1.1.517

Expected: A New Code period to start at 1:25 PM when the version was set to 1.1.517.

Actual: New Code period is unchanged from 12:34 PM at version 1.1.514.

As you can see, SonarQube recognizes that the new version is set:

version-history

But the New Code period simply isn’t starting:

new-code

The New Code Period for the project is set to the default of previous_version. I’m not sure if it matters, but there are no code changes for this period. The version is simply changing (these steps are being performed in a test project in an isolated fork of the original repo). EDIT: Under further testing, this behavior is the same even with new code as part of the analysis along with the new version.

I noticed this same behavior when we had our versions set to include the branch name, e.g. 1.1.517-master, but figured SonarQube didn’t understand it as an incrementing version due to the branch name being present. However, despite a fresh SonarQube project and using versions without the branch name, the behavior persists.

This is our first time using previous_version for the New Code period. Our other project uses a floating seven-day period because it is not versioned code.

We are using the following:

SonarQube: 7.9.2 LTS Enterprise
SonarScanner CLI: 4.3.0.2102

Let me know if you need any more info.

Thanks in advance!

Hello Dennis,

It appears you ran into an issue we tracked as SONAR-12788. It’s since been fixed starting in SonarQube 8.1.

You’ll find the New Code period reports correctly starting on the second analysis following the version change.

1 Like

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