Project versioning with long running branches


We currently have our project’s new code period set to as previous version but since this branch is long running, we aren’t incrementing the version. This leads to older issues being present in the most recent scans. Ideally we wouldn’t increment the version until we are finished with this long running branch, is there another way that we can version in sonar so only the commits since the last scan are treated as new code? So far the only ideas that we have come up with are to use the commit hash as the version or use a timestamp. We are currently using the Enterprise Edition v8.3.1


Welcome to the community!

What you’ve described is the previous_analysis option which used to exist. We dropped it because we realized it was a terrible idea:

  • analyze → new issues raised → QG fails
  • re-analyze without code changes → issues no longer new → QG passes

You do, however, have the option to pin a specific analysis as your New Code Period baseline. You may have to upgrade to get this. TBH I don’t remember which version introduced the feature, but we’ve introduced a lot of goodness since 8.3 anyway. :slight_smile:

You also have the option to use a number of days as your New Code Period. This might suit you better: you get a floating New Code Period window. The only caveat here is that if you’ve broken the Quality Gate it’s possible to simply “wait it out” - eventually the QG will pass without intervention as problems that were new float out of the New Code Period window.