Hard time to figure out what "New Code" means

My code is hosted on Github and I am using Automatic Analysis.

According to documentation since I am not using Gradle or Maven when I choose “previous version” as the new code option, I need to use sonar.projectVersion.

But I have not set sonar.projectVersion in the configuration file. Still, with every push to the main branch, I can see the issues arise in the new code tab.
What am I missing here? What is the difference between “new code” and a single push to the main branch?
I am expecting that with every push to the main branch, the issues(if they exist) are shown on the “new code” tab. Is that a good practice?

I have read this but am still confused.

It would be very useful if there are some intuitive examples for each of the new code options so the new code mechanism is more clear.

Hey there.

In this case – when you have Previous Version set as the New Code Period (but you provide no sonar.projectVersion in your scans), essentially your first scan has become the “baseline” scan and everything that comes after is considered New Code. To be honest, this works perfectly fine for users who want to draw a line in the sand of before/after implementing SonarCloud.

If at some point it makes sense to add a version marker (you’ve made a release), you can add a version event to an analysis in the Activity tab of your project.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.