which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube Enterprise 8.9.6
what are you trying to achieve
I would like to override my New Code Period global setting of “Previous Version” to be “Reference Branch” on certain branches within my projects, meanwhile maintaining “Previous Version” as the global setting.
what have you tried so far to achieve this
I tried setting the option sonar.newCode.branchReference=master when using the sonar-scanner tool but it does not seem to be respected and the branch continues to use “Previous Version” as its New Code Period setting.
Am I misunderstanding the documentation on this? I expected this override to work based on the following.
Did you add this parameter after the branch was already under analysis? I believe this only kicks in on the first analysis of a branch. (And yes, the docs could probably be clearer about that.)
I confirmed that I am setting the sonar.newCode.referenceBranch option on the first push/analysis of the branch. I am still seeing the New Code period as previous version instead of comparing against the reference branch.
There’s currently an “out of date” label on these docs They’re not out of date (& we’ll get that fixed). They’re your reference for the version you’re using. So any time there’s a question, the 8.9 docs should be your guide.