New code in first analysis

Hi,

During the first analysis of a project, the source code being analyzed is not considered to be “new code”. Is this right? (maybe because there are no snapshots to be considered as a baseline for comparison)

In this way, if the quality gate only checks for new code, the issues pointed out in the first analysis will never be counted, even if you change the new code period (previous version, date,…).

So, to consider this code as new, it would be necessary that every first analysis of a project was with an empty source code.

Environment:

  • SonarQube 7.9.3 Enterprise Edition

Hi,

this is right, there’s no baseline to diff with, so no new code.
We’re on Sonarqube 7.9.1 Enterprise and use:
Quality gates with only new code conditions for legacy projects
Quality gates without new but overall conditions for new projects

For new projects it’s also possible to combine new code and overall conditions.
So they are forced to pass your initial quality gate requirements, afterwards the
new code conditions apply.

Gilbert

1 Like