We follow Trunk-Based Development in our organisation. We’d like to run SonarCloud analysis for each new push with only the new push’s content. However, in SonarCloud, there is no option to set “New Code” definition as “new each push”. Other options does not help us, do you have any recommendation about this?
We typically discourage a New Code Period of “each new push” (which is possible, if you use “previous version” and pass a new
sonar.projectVersion with each build).
If two developers commit close to each-other, the New Code Period might reset before having the chance to see the results. Is that something you expect?
My understanding of trunk-based development is that usually short-lived branches and pull requests are still used, rather that committing directly to the main branch. If that’s the case with you, Pull Request Analysis should be ideal, so that developers can focus on the changes they are introducing to the main branch.
Thank you for your answer. We almost never create a new branch and every developer pushes to the main branch directly all the time. This is how we follow trunk-based development in our organisation.
We don’t increase package version as well since it does not make much sense for us. We identify each push/deployment with unique GIT_SHA.
And finally, we wouldn’t mind if the New Code Period is to be reset time to time.
So, do you think is there a way to do analysis in our scenario with each push without increasing the project version?
You can provide whatever value you want to
sonar.projectVersion, including the GIT_SHA. Any update will cause the New Code Period to reset.
It worked, many thanks!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.