This branch could not be compared to its reference branch

Ann:

If I set New Code > Project Settings to “Previous version” the first push of a branch always comes up green (but no analysis done), subsequent pushes “do the right thing” as long as the developer doesn’t rebase their branch. If they rebase all sorts of non-branch code starts showing up in the “new code” analysis.

If I change that and for New Code > Project Settings I set “Reference Branch: Main”:


… and for New Code > main branch I set “Previous version”.

I would expect that every branch would be compared against the main branch, what happens is that the New Code analysis comes up blank, with the message:

This branch could not be compared to its reference branch. See the SCM or analysis report for more details.

No matter how many times a branch is revised and pushed the same message appears.

Neither setting seems to work quite right.

Hi @Earl,

I’ve split your post into a new topic because I think it diverges (or will diverge) from the one you posted in.

We’re aware of some problems with rebasing (SONAR-14929, SONAR-15697) and we’re working on it now for 9.3 (E.T.A. at the end of the month).

Regarding this:

Could you share the full analysis logs, and probably even the full build logs? I’m particularly interested in

  • the checkout at the beginning of the build
  • any SCM-related messages at the end of analysis

 
Ann

Hi, team, I have the same issue as Earl’s, is there any solution for this?

Hi @Hao_Cao,

Welcome to the community!

SonarQube 9.6 was announced last week. You should upgrade.

 
Ann

Thanks for you reply, Ann! we just use sonar-scanner-cli:4.6 in docker image, and add some parameters in sonar-project.properties, then just check results on SonarQube dashboard, where can I upgrade version?

Hi,

This isn’t about your SonarScanner version, but about your SonarQube instance version. You need to upgrade the server.

 
HTH,
Ann