Must-share information (formatted with Markdown):
- which versions are you using:
- SonarQube Enterprise Edition v9.9.5
- SonarScanner version: 4.8.1.3023
- how is SonarQube deployed: zip on a VM
I have a SonarQube Java project configured as follows:
- main branch: new code is based on previous version.
- other branches: Use “main” as the reference branch.
For this project, I executed an analysis of our “main” branch code to set the initial analysis of it. The analysis was reported properly on SonarQube, showing all the issues found:
Then, I run the same analysis from a different branch that was started from the “main” branch, but which did not include any changes on the source code.
I was expecting to see that a new branch with no new issues is reported in SonarQube. However, it reports as new issues exactly all the issues already found in the main branch:
I have reviewed the sonar-scanner logs and I did not find any errors. The Java sensor reports the following:
[TRACE]: INFO: Sensor JavaSensor [java]
[TRACE]: INFO: Configured Java source version (sonar.java.source): 8
[TRACE]: INFO: JavaClasspath initialization
[TRACE]: INFO: JavaClasspath initialization (done) | time=7ms
[TRACE]: INFO: JavaTestClasspath initialization
[TRACE]: INFO: JavaTestClasspath initialization (done) | time=1ms
[TRACE]: INFO: Server-side caching is enabled. The Java analyzer will not try to leverage data from a previous analysis.
[TRACE]: INFO: Using ECJ batch to parse 393 Main java source files with batch size 101 KB.
[TRACE]: INFO: Starting batch processing.
[TRACE]: INFO: The Java analyzer cannot skip unchanged files in this context. A full analysis is performed for all files.
[TRACE]: INFO: 100% analyzed
[TRACE]: INFO: Batch processing: Done.
[TRACE]: INFO: Did not optimize analysis for any files, performed a full analysis for all 393 files.
[TRACE]: INFO: Using ECJ batch to parse 1 Test java source files with batch size 101 KB.
[TRACE]: INFO: Starting batch processing.
[TRACE]: INFO: 100% analyzed
[TRACE]: INFO: Batch processing: Done.
[TRACE]: INFO: Did not optimize analysis for any files, performed a full analysis for all 1 files.
[TRACE]: WARN: Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.
[TRACE]: WARN: Use of preview features have been detected during analysis. Enable DEBUG mode to see them.
[TRACE]: INFO: No "Generated" source files to scan.
[TRACE]: INFO: Sensor JavaSensor [java] (done) | time=73829ms
Also, I did not find any error or message related to this on the scanner executed with the debug option (-x).
I have tried several times to recreate the project, run the scanning providing and not providing the version for the main branch… I have also tried to run the scanner twice (one for the main branch, and another for another branch name) on the same git branch and with no re-compilation/re-testing in the middle (to use the exact same input data for the scanner)… With no success.
If I check any issue on the change branch, I see the following:
The second date matches the scan of the change-50791 branch, but the first date… I have no idea from where is that date fetched.
Any hint or ideas? Anything that I can check to see why those issues are not