Application: jacoco + gitlab cicd, for unit test coverage info
Problem:
I tried to set [New Code] to ‘Previous version’ or 'Number of Days". I want sonarqube to detect only the new code only contains the difference between the current code push and the last code push. However, it contains over 2000 lines even I only modified 4 lines in my last push request. It also shows ‘New Code: Since May 23, 2025 Started 11 days ago’.
I am very confused about this and still don’t know how to achieve my goal. Could you please help me with this? Thank you.
It sounds like you’re looking for PR analysis, which is available in SonarQube Server($ - $$$).
The only other way to do what you describe would be to set the New Code definition to Previous Version and then update the sonar.projectVersion string with each analysis, which is not a good practice (it foils housekeeping).
That said, in a full (non-PR) anlaysis, SonarQube will always analyze all of the code. The question is what’s considered “new”. If you’re having a problem with the accurate detection of what’s new, then it’s most likely that there’s a problem with the SCM metadata available to analysis. This would show up at the bottom of your analysis log. Search for “SCM”.