Setting a branch baseline

@ganncamp With the new sonarqube its difficult to understand new code issues as developer may forgot the run the baseline scan, as soon as they create new branch and they push new code. After this if I run sonar scan it wont show new code issue as its first scan and since there was no baseline it will always give message: This branch could not be compared to its reference branch. See the SCM or analysis report for more details.

Developer will mostly forgot this first step to run baseline scan or there could be other issue like they may need to provide build urgently to complete testing. Earlier option was very good which was now deprecated. Can we have reference branch sonar property? Currently we can set branch level reference branch option via login into sonar portal but these manual steps are cumbersome and wont be followed diligently. Its better to have some flexible input configuration parameter to pass reference branch name during de builds.


Welcome to the community!

I’ve split your post to a new thread since the thread you posted in was about a slightly different topic and had been dormant for 2 months.

Are you using the Reference Branch setting for New Code Period? If so, what branch are you using as the reference?

It sounds like you need to:

  • make the project-level setting Reference Branch, pointed to your main branch - all new branches will use this
  • define the setting for the main branch at branch level


@ganncamp I want to pass reference branch value(for new code issues) as scan parameter using sonar properties. Its flexible and can be configured in Jenkins job input parameter. Please add new sonar properties something like sonar.reference.branch=xyz. This will make life easier. I am aware that we can set reference branch using sonar portal but if not practical to login and set different reference branch for difference feature branch as these dev branches can be created from difference release branches.


That functionality just isn’t available. Feel free to create a new thread in the New features category.


A post was split to a new topic: This branch could not be compared to its reference branch