Difference between overall code and new code in

I am new to sonarqube and I don’t understand how it works. I have downloaded the latest sonarqube image, I run a simple container and the application starts, everything ok. Community Edition Version 9.9

I have a simple python program and I scan it with the following command: sonar-scanner.bat -D"sonar.projectKey=test" -D"sonar.host.url=http://localhost:9000" -D"sonar.login=MY_TOKEN" -D"sonar.python.version=3"

In the first scan the new code tab contains no information and in the overall tab everything is perfect, without any error.

I enter 1 smell code and launch the scan. The new code tab shows 1 smell code and the overall tab shows the same information. I think that everything is correct.

I enter another smell code and launch another scan. The new code tab shows 2 smell codes and the overall tab shows the same information.

If it shows the same information, what is the difference between them? Shouldn’t the second scan show only 1 smell code in new code tab and 2 smell code in overall code tab, why doesn’t it happen like that? Why is the scan not done against the latest version?

thank you in advance

Hey there.

Thanks for the question!

If the New Code Period changed every time you submitted an analysis… it wouldn’t be very useful.

Perhaps in a single-developer, local scenario, it would make sense. But imagine scaling that to even a few developers regularly raising pull requests and merging new code. You wouldn’t want it to reset every time somebody merges code. You’d want it to be cumulative.

The expectation is that at some point the New Code Period “resets” (when a number of days has passed, or a new version is released). In the aforementioned documentation, you can find details about how the New Code period can be set.

For a brand new project, the numbers will be the same (after the second scan) until the new code period changes.

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