New code period - previous version

Hi,

I’m currently facing an issue with the version configuration in my Java project using Maven, and I was wondering if anyone could help me out.

I have set the “New code” option to “Previous version,” but unfortunately, it’s not functioning as expected. I’m unsure if I have misunderstood some concepts or made any mistakes.

In the pom.xml file, I have configured the version, and ideally, I should see the “New code” label starting from version 2.21.1-SNAPSHOT instead of 2.21.3-SNAPSHOT.

SonarQube: Community Edition, Version 9.9 (build 65466)

I would greatly appreciate it if someone could guide me on how to resolve this issue or provide any insights into what might be going wrong. Thank you in advance for your help!

Hi,

I see why you’re confused:
Selection_1227

If you’ve set previous_version as your New Code Definition, then the code changed since or after the 2.21.2-SNAPSHOT is what’s considered ‘new’.

And, the sequence of visual indicators in the UI is not making that clear. If that yellow “New Code Period” marker were just under the first snapshot in the New Code Period, I guess you wouldn’t have any questions. Instead it’s positioned just after the last snapshot that’s excluded from the New Code Period.

So… You’ve configured it right. It’s working right. We just need to re-think this UI. And I’m going to bring that up internally.

Thanks for raising the point.

 
Ann

I’ve got the “previous_version” set as 2.20.2-SNAPSHOT. Since I’m following semantic versioning, I’ve always considered changes in the last digit to be mere hotfixes rather than actual version upgrades. But it seems that any alteration in that last digit is being treated as a new version altogether. Is my understanding off here?

Hi,

When you use the previous_version setting for your New Code Definition, then any change in the sonar.projectVersion string signals a new version.

So even just: 2.20.2-SNAPSHOT2.20.2-SNAPSHOTs is a new version.

 
Ann

Hi Ann,

Thanks for your explanation, I now have a better understanding of the situation with semantic versioning and how it relates to the “previous_version” setting.

An awesome way to make SonarQube even better could be by introducing a semantic version detection feature instead of doing a string comparison to figure out version changes, this new capability would be super helpful in telling apart bug fixes from actual version upgrades more accurately.

1 Like

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