Using SonarQube 7.4 Developer and doing analysis with sonar-maven-plugin 18.104.22.1684
New code is missing from the first analysis done after an initial BASELINE analysis. Doing another analysis appears to fix this. This always happens. This makes it easy to miss quality problems introduced by code changes.
Steps to reproduce
- Start with an existing project with New Code Period set to BASELINE.
- Do initial analysis for a new long-lived branch with
mvn clean install sonar:sonar -Dsonar.branch.name=MYBRANCH -Dsonar.projectVersion=BASELINE
- Make a code change.
- Do analysis again for the same branch, this time allowing
sonar.projectVersionto be set by the plugin from the POM version with
mvn clean install sonar:sonar -Dsonar.branch.name=MYBRANCH
At this point the branch’s Activity shows correctly the 2 analyses that have been done, but the Overview indicates that the new code is based on the previous version instead of the BASELINE version.
The new code doesn’t appear anywhere in the Measures; however, if I drill down into the Code, I do see the line that I added. So the new code was analyzed, but the analysis does not surface it in the SQ dashboard.
If I make another code change and repeat
mvn clean install sonar:sonar -Dsonar.branch.name=MYBRANCH, the new code period will be “since BASELINE” and the new code will appear in the various measures, etc.