I installed sonar-scanner on my develop machine via Homebrew, the versions are as following:
INFO: Scanner configuration file: /usr/local/Cellar/sonar-scanner/220.127.116.112_1/libexec/conf/sonar-scanner.properties
INFO: Project root configuration file: /Users/dengfeng.yan/Desktop/work/chinamobile.global.android.main2/chinamobile.global.android.main/sonar-project.properties
INFO: SonarScanner 18.104.22.1682
INFO: Java 11.0.12 Homebrew (64-bit)
INFO: Mac OS X 10.15.7 x86_64
and everything works fine
Then I copied the sonar-project.properties content to Bitrise’s SonarQube Scanner flow, and hoped that it would work the same. But coverage information is not showing when build by Bitrise.
The log from bitrise showed very clearly that sonar-scanner has successfully processed the coverage report file generated by the build. And the version used by Bitrise is the same version as I used.
A complete log from Bitrise:bitrise-build-log.txt (2.3 MB)
The issue is not the importing of the coverage report. We only report the coverage on the changed lines of a PR. In the first screenshot you shared the scanner is able to detect that there are 62 new lines, however in the second screenshot there are 0 new lines detected.
We rely on complete git history to be able to detect the lines that were added in a PR, this user had the same problem in the past and was able to solve it by using a different command to git clone the repository.
The problem is similar, but without a solution, it hard to fix the problem.
I used the same commands as Bitrise git-clone workflow did, and I can reproduce the problem, but I can’t fix it.
First, I checkout both the source and destination branches, the coverage data remains the same.
Then I used ‘git pull’ without any parameters to fetch the whole git history, does not help either.
Then I used ‘git clone’ to clone the entire repo as suggested in the above link, still no coverage data.
We also tried sonarqube gradle plugin, and it worked on Bitrise once, but we are not sure it subsequent build also will work. We will try to build a bit more times to confirm the workaround really works.
Could you please specify what git history data are needed by sonar-scanner?