Coverage and Duplication for pull request are NOT displayed in SonarCloud

Hi, I am beginner of sonar cloud.
I want to calculate and coverage and duplication in CI-based analysis.
However, they are not displayed in PR-based analysis like
figure below (values estimated after merge is displayed).

Is it possible that something is missing?

(Coverage and duplication are displayed in Analysis of master branch)

environment

  • ALM: GitHub
  • SonarCloud
  • CI system: CloudBuild (GCP)
  • Languages: javascript

sonar-project.properties

sonar.projectKey=github_username_projectname
sonar.organization=github_username

sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.tests=test
sonar.sources=src
sonar.language=javascript

sonar.projectName=projectname
sonar.projectVersion=1.0
sonar.host.url=https://sonarcloud.io

sonar.pullrequest.github.repository=github_username/repository_name
sonar.pullrequest.provider=GitHub
sonar.pullrequest.base=master
sonar.scm.provider=git
sonar.scm.disabled=false

thank you

This is sometimes a common issue. it depends what kind of files you have changed and are in the changeset.

see https://stackoverflow.com/a/61754439/3708208 - if you only changed a readme or just the sonar configuration, it will not detect any coverage, because the changed files do not provide this information. Try to add an empty line to a source file, and see if this changes the values.

Hi Simon @simon.schrottner !
Thank you for reply

I tried to change programs but they are not displayed.

@onyanko-pon i can only recommend to run the analysis with extended log output. Normally the scanner can be quiet chatty and tell you a lot of information.

I also recommend to add this log output here to your question, and also which type of scanner you are using.

As you mentioned that the coverage is displayed in the main branches, this might be some odd issue. Also be aware that only because your analysis has finished, does not mean Sonarcloud has finished the background task. This can also take a little time, so you might not get instant update.

1 Like