No coverage data seen when Sonar Cloud pulls coverage data from GitHub

Hi,

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

# Path to sources

sonar.sources=src,./server.js

sonar.exclusions=src/test/**

#sonar.inclusions=

# Path to tests

sonar.tests=src/test

sonar.test.exclusions=*.json

sonar.test.inclusions=*.js

# Source encoding

#sonar.sourceEncoding=UTF-8

# Exclusions for copy-paste detection

#sonar.cpd.exclusions=

sonar.javascript.lcov.reportPaths= coverage/lcov.info

Thanks,
Abhilash

Hello!

And welcome to the community forum!

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.

Hi Gregoire Aubert,

Thank you for your response and for pointing out that it is a limitation of Auto Scan feature. It would be great to have this feature.

Is it possible to use Auto Scan feature and use sonar-scanner command line to only push coverage info to Sonar Cloud? I want to leverage both .

Thanks,
Abhilash

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.