New code coverage issue for feature branch in Developer Edition Version 9.3

We observer below issue for new code coverage in SonarQube Developer edition.

Developer Edition Version 9.3 (build 51899)

  • For feature branch new code coverage, we have defined master as reference branch. Any changes made from your reference branch(master) are considered New Code.
  • Its working fine for feature branch when we are executing analysis first time, we are getting proper code coverage with reference to master branch.
  • However, if we modify/added commit in feature branch after first analysis and execute sonar analysis again in that case our feature branch gets compared with previous version of feature branch.

As we are executing sonar analysis for that feature branch second time.

  • Ideally it should get compared with reference branch- master even we are executing sonar analysis multiple times for feature branch.
  • We have configured new code setting from project setting.

image

image

•In above screenshot you can see master should get compared with previous master version and feature branch should compared with reference branch-master

Could you please update us, how we can modify the project setting so that feature branch always gets compared with reference branch-master even after multiple analysis execution.

Hey there

What is the actual impact of this on your code analysis results? Do you see code reported as new that shouldn’t in your feature branches? Something else?

Yes actauly.
If we execute analysis first time for feature branch with master as reference branch then its giving proper coverage report.

but for same feature branch if we execute analysis again then it compared with previous version of feature branch instead of master refernce branch.
so its giving coverage of new code with reference to previous feature branch version.

expected is even if we execute analysis for feature branch number of time it should compared with master reference branch only and should provide new code coverage with reference to master branch.

Any Idea how we can fixed this issue in Developer Edition Version 9.3

As a first step, I would upgrade to SonarQube v9.5 and see if the issue persists, as there were some changes done around the implementation of the reference branch and detecting new code.

If the issue persists, please come back with some additional details about what code is falling into the New Code that shouldn’t be (does it come from other branches? commits you don’t expect in that branch? is it old code?)