We work extensively with features branches to have the quality gate blocking gitlab merge requests.
Many time we faces issue with rebased features branches. Turns out rebasing a branch makes the intermediate commits from the target branch being included in the analysis, which causes all sorts of problems. In a branch, I’ve 2 changed lines and the new code show me around 400 lines. This cause the quality gate to fail as the code coverage is less than the threshold.
As someone already seen this kind of error ? Or perhaps, we do a bad usage ?
I am experiencing similar issues. We have a big repository that generates multiple PRs daily. If a developer created a PR several days ago, then pushes his commits to it - if in the meantime master branch was pushed forward by other PRs - then the said developer sees code from other PRs (ones that were already merged to the master branch) as new code on his PR (so let’s say he changed a few lines in flie A - and that’s all, Sonar reports issues in files B, C, etc… - all untouched in the said PR)
It’s as if Sonar was comparing contents of the PR against the latest version of the master branch, without limiting itself only to changes introduced by the PR.