Version: SonarQube Server Enterprise 9.9.2 (build 77730)
Deployment: Docker? Unsure
What I’m trying to achieve: My analysis of a feature branch should contain all of the new issues since the branch point from our “develop” branch.
What I’ve tried:
Scanned develop branch
Created feature branch
Scanned feature branch, where develop was the reference branch.
Committed code to feature branch
Scanned feature branch and a new issue was created, develop is still the reference branch.
Committed more code to feature branch
Scanned feature branch, and the previously new issue became an “overall issue”. The new code does not have all of the updates in the branch. It is now only the code that was changed in the most recent commit.
To summarize, it seems like the new code calculation only includes the most recent commit in my feature branch instead of all commits made to the feature branch.
In Measures > Size > New Lines, it only shows the lines that were a part of the most recent commit.
The Overview tab for the feature branch analysis shows “compared to develop”, so I think I’m setting the reference branch correctly.
I’ve found some warnings:
WARN: Shallow clone detected, no blame information will be provided. You can convert to non-shallow with ‘git fetch --unshallow’.
INFO: SCM Publisher 0/1776 source files have been analyzed (done) | time=7ms
WARN: Missing blame information for the following files:
WARN: * .cs
This seems like the most likely the reason I’m running into this issue.
It mostly seems to be working now, but it seems like I was running into a weird edge case that probably was working as intended.
I’m using scanner for dot net, and I needed to include python code that was existing in both the develop branch and the feature branch. However, only the feature branch included the python files for scanning, using .
Therefore, I was in a weird situation where “old code” that was getting scanned for the first time was not considered as a new issue because it was old code.
After realizing all of this, this makes a lot more sense now. Hopefully, someone who has been struggling with the same issue finds this post helpful.