Compare code to baseline in a different branch

I’m using SonarQube version

Most of the projects we scan follow the model of releasing from the repo’s master branch. Scanning the current master as a baseline, and then doing comparison scans on commits made to master after the baseline, easily fits into SonarQube’s model.

Some of our projects, however, create a new branch for every release. These branches aren’t master, rather they are named like: release-1, release-2, release-2.1, etc. (this example is simplified for the sake of clarity). There are many reasons why we can’t change this branching strategy in the near term.

My question is: is it possible to have SonarQube scan one branch, use that as the baseline scan results, and then compare scan results from other branches against that baseline?

To continue my earlier simple example, that means we’d scan the code in branch release-1 as our baseline, and then compare the scan results from release-2 to determine if new issues were introduced relative to the release-1 baseline.

Does anyone have a workaround for this kind of issue? Or is this workflow simply not supported/possible?


Broadly what you’re looking for should come with MMF-1994, hopefully not too far away. :slight_smile:

Existing workaround: Analyze your branch immediately upon creation before any changes are made. Everything after that should then fall into the new code period.

Thanks for your reply; it’s great to know you’re working on MMF-1994!