Sonarqube feature branch first analysis with already code modification doesn't show new code results

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): Data Center Edition Version 8.9.7
  • how is SonarQube deployed: zip, Docker, Helm: I don’t know
  • what are you trying to achieve: We would like to have a new code analysis on first feature branch analysis by comparing this new feature branch with the develop branch from where the feature branch was created.
  • what have you tried so far to achieve this: I tried to edit the configuration of the project by using a reference branch for new code but it didn’t worked out.

Hi,

Let’s say we have a C# solution which has a sonar project associated. The solution has a default “develop” branch which contains all the joined features of the project. When we want to create a new feature for the solution we create a new feature branch and we merge this branch to the develop branch when the code development it’s done.

When we create a new feature branch it is not mandatory for developers to push this new branch directly to sonar but to start to work on code development right away. The issue with that is when there is some work done the new code is pushed and the analysis in sonar won’t highlight any information under the “New code” tab as it is the first push of that branch to sonar.
From my understanding those first commits of this branch will be considered as the base for the “New code” in the future, so whether there will be later modification in the code the comparison by sonar on new code will be done with those first commits pushed as a base and not with all the changes done on that branch compared to the initial branch creation from develop.

My question here is how can I do a comparison of the “New code” in the feature branch with the develop branch on the first feature branch sonar analysis?

I already tried to edit the sonar configuration to use a “reference branch” during the analysis but it is not working.

Thank you!

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.9.7 → 9.9 → 10.1 (last step optional)

You may find these resources helpful:

If your error persists after upgrade, please come back to us (or better yet, as a Data Center Edition user, reach out to Sonar Commercial Support)

Hi,
Thanks for coming back to me.
Unfortunately the update of sonar is not up to me and I’m afraid it won’t be done any time soon.

While I was looking for advices on how to solve my issue you are mentioning this is an error.
Do you imply that my problem is a known issue that is solved in the latest versions of sonarqube?