sonar.newCode.referenceBranch | no infos


Sonarqube 9.4 developer Edition
SonarScanner 4.7

I use the parameter “sonar.newCode.referenceBranch” and apparently it works. Why can’t I see any information about the successful setting anywhere?

When I set the “New code Period” in sonarqube 8.9.2 via the GUI, I see the corresponding setting in the Jenkins log and in Sonarqube.
2022-05-27 13_10_47-Window

2022-05-27 13_45_23-Window



I guess you’re expecting to see the reference branch listed under the “New Code” label on the tab? This is a great point. I’ve referred it to the team.


Excuse me, could someone explain for me how referenceBranch property works ?

What I’m expecting is to be able to run analysis on my branch once to be able to detect my new code report … but what I’m getting is I have to run the branch twice … one time for the overall code and other one for the new code .

is there any way to have a report for only new code with one time analysis ?


Hi Salma,

I really don´t understand what you mean.

Why you have to build your branch twice? One build for the new and overall code!


Hi Mark,

thanks for your response.

ok let me explain more … the default behaviour for sonar is:
when I analyze a branch for the first time … the result will be an analysis for the overall code, and if you want to analyze only your new code … you’ll need to run analysis again to detect the new code.
( as the default project setting is previous version )

My question is … Is there any way to run analysis on my new branch just one time and display an analysis for my new code only ?
( I expect to see a result on sonar as the one that we get when anlayze a pull request )

kindly note that I’ve updated the new code definition from sonar properties file to be referenceBranch … but it didn’t work with me and analyzed the branch as the default ( previous version )