We have integrated Sonar Cloud with our GitHub repo.
I have a GitHub repository that has some java script code (server side) , .sonarcloud.properties file and code coverage report in lcov.info file.
I have SonarQube Scanner 4.1.0.1829 installed on my laptop and when i run the following command I see the coverage report in Sonar Cloud
sonar-scanner -Dsonar.projectKey=xxxxx -Dsonar.organization=xxxxx -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=72xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx64c -Dproject.settings=.sonarcloud.properties
However when the SonarCloud picks up content from GitHub and analyzes there is no coverage report. Can someone please help me understand what I am missing?
The coverage info file in my laptop and Git repo are the same. I have also made sure that there is no absolute paths in lcov.info file.
The contents of .sonarcloud.properties files is provided below
sonar.language=js
Since you have a .sonarcloud.properties file in your repo, that means you are using our Autoscan feature to analyze your project when you push things to Github.
You issue is that Autoscan currently doesn’t support coverage, you can find a list of limitations of the service here.
So you have the coverage when you local execute the scanner, but then it’s overwritten when you push to Github and Autoscan sends it’s analysis.
If you want to have coverage information when you push to Github you will need to use a different service than Autoscan, like Travis CI or Circle CI for exemple.
Yeah it would really be nice and we didn’t start any work yet on this subject but that’s something we want to support too.
I’m sorry but I don’t think that’s possible in the current way things work, running the scan with AutoScan will always erase the coverage you got from the sonar-scanner.