How sonar.newCode.referenceBranch work?

SonarQube Server: 10.6, Developer Edition, Docker
SonarQube Scanner: 6.1.0.4477-windows-x64, CLI

Problem: I want the new code definition of

master to be Previous version
feature branch to be Reference branch

  • Global level
  • Project level
  • Branch level
    testForIssueManagement use sonar.newCode.referenceBranch=master
    master use nothing (default)

However what I see is “Project setting”, not “Reference branch: master”


I need to manually edit at the Actions column, but I want the sonar.newCode.referenceBranch setting to take effect automatically.

I checked the doc: Defining new code, and indeed it appears to use Reference branch initially (since the new code issue is empty). But afterwards, does it switch to using Project setting, or does it continue using Reference branch?

Hi @Chris_Wu,

The sonar.newCode.referenceBranch setting in your sonar-project.properties file should take precedence over any UI settings.

For a detailed explanation of parameter hierarchy, refer to the Analysis parameters documentation.

If you’re unsure which value was used by the scanner, you can also check the backgroundTasks section.