How to set New Code to be difference since last merge to dev branch?

Hi there, our current branching strategy boils down to creating a branch off of dev for feature work, completing that work, then creating a PR to merge back to dev. Then, when we are preparing for a release, we merge dev to master, create a tag, and then deploy the tagged version to our staging and ultimately production environments. Dev is our Main Branch.

Currently we would like to have our Quality Gates set to analyze New Code only. We would like this to be done on any merge to dev. This would allow our devs to work freely on their feature branches and not be required to code their unit tests until they are ready. Unfortunately, using the “Previous Version” setting is casting too large of a New Code Net, sometimes stated as being months behind, while we are merging to dev daily.

I have tried changing the New Code setting to “Reference Branch - dev” but I get a warning that branches cannot reference themselves. Is there a solution that would allow me to call New Code as anything new you’re merging into dev now and have the analysis/metrics based on that?

Hi,

Do I correctly understand that what you consider “new” on Dev is… what just got merged in the last commit? I.e., you’d like each analysis to reset the New Code period?

If so, this is something that’s usually only done by mistake by using the build number as the sonar.projectVersion.

 
HTH,
Ann