The Reference Branch New Code Period setting is going to count as new code everything that changed since your branch diverged from the reference.
I guess you’re rebasing your branches against the main branch each week after you release the new version? For what you want, it doesn’t sound like there’s a perfect solution. Probably the ‘specific analysis’ option (docs) is going to be best here. After you rebase, I’m assuming that triggers a build/analysis. So then you need to set that analysis of the rebase as the baseline for each branch.
Or have I misunderstood the situation?
Also, would you mind explaining for our edification how you use these other, non-main branches?
Currently, I have the master main branch. from this branch, I create new features branches like the Git Flow strategy. when the feature is done we create a PR to merge this into master.
If everything’s working right except the main branch, and you want the main branch to reset the New Code period with each week’s release, then I would edit the New Code Period setting for just that branch, specifically and explicitly (from your first screenshot, use the cog menu on the ‘master’ branch row) to ‘Preview version’
i guess you meant ‘Previous version’ !?
The main branch has already this setting, which could be seen in the screenshot
of the first posting.
We use the same settings for our legacy projects with a quality gate that has only new conditions.
Maybe the problem is a difference of new code between PRs and main branch <-> previous version. @handresc1127 Are those issues on the main branch always from specific rules ?
Yes. Thank you. I meant “Previous version”. I guess my hands were on autopilot. And thanks for directing my attention back to the screenshots in the OP. I also didn’t scroll back up enough when composing my last reply.
@handresc1127 you’ve said you change version every week. How do you change version? You are changing the value that’s fed into the sonar.projectVersion analysis parameter, right?
That’s probably not what you wanted to do. By feeding build number into sonar.projectVersion you’re going to set a new version with ever build. Unless you only build once a week (really?) you’re going to get a version change that’s far too frequent.