we use the Developer Edition of SonarQube 8.9.6.
We have defined the default new code profile using “Number of days = 30” on our projects.
Recently we had a problem, that code, that was not part of the pull request (and the change was older than 30 days at that time) was shown as (uncovered) new code. After switching the new code profile to “reference branch = master” and back again, this problem disappeared after re-starting the analysis.
Is there a detailed explanation what “new code” means in the context of pull requests?
I would expect that new code is any change (within a maximum of 30 days) that happened since the feature branch was branched away from its parent branch. If this is the case: What happens, when the target/reference branch is merged into the feature branch before the feature branch is finally merged back?
Unfortunately I could not reproduce the strage behaviour that caused the recently wrong new code coverage in the pull request.
I can’t explain what happened, but in the context of a PR, New Code should be what’s new in the PR. The New Code Period setting applies to branches.
That said, in 9.3 (released today) we fixed some weirdness in New Code detection that happened when a branch was rebased on the target branch. But that shouldn’t be in play here since you’re using a floating, 30-day period.
thank you for the quick answer.
Do you have links regarding the mentioned fixed issues in your bug tracking you can share?
Will these fixes also be applied to the LTS version of SonarQube we are using?