which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
Sonarqube * Enterprise Edition * Version 9.9.2 (build 77730)
how is SonarQube deployed: Zip file / sonarqube running as a service
what are you trying to achieve
PR analyses are reporting a much higher count of New Code than is actually included in the PR
This occurs in select SQ projects only and has only started in the past 10 days.
what have you tried so far to achieve this
Reviewing the PRs to confirm changes do not reflect the “New Code” in the SQ analysis.
Comparing the previous configuration of project with current configuration doesn’t seem to show any differences (now with the undesirable behaviour)
Comparing project1 (too much new code included) with project2 (the expected amount of new code included) does include a difference of usage of -Dsonar.pullrequest.base parameter; varyingly used to target master or a team branch, but it’s not consistent.Some analyses have -Dsonar.pullrequest.base=master with the too high new code count and some analyses have -Dsonar.pullrequest.base=master with the accurate count of new code.
Of note as well, that the change in behaviour occurred around the same time as the SQ DB was upgraded. Previously we were running postgresql v11 and now we are running v15. There were no errors reported during the upgrade, but no testing has occurred to confirm if the data was changed. We are unsure if this is a possibility for the source of the new code reporting issue.
There are no flags in any log files on the app server or the build servers that indicate what is ‘wrong’ so I’m hoping the Community may be able to shed some light on what we’re seeing in our various projects.
The expectation is that Sonarqube will include only the new lines of code in the PR, but instead the reports are including code that is NOT in the PR (by the 1000’s of lines). And also why it is not a consistent “target branch decides the new code” result.