Sonar analyses new PRs but show no changes

Good afternoon!

We are experiencing an issue in one of our GitHub repositories, almost all of the PRs that we create are shown on SonarCloud console, but they show 0 new code lines, and this has been happening for weeks now.
Our github repository is working as a java monorepo with bazel, with one sonar project for each java module. The issue is that when we create a new PR, the CI (Actions) seems to run sonar correctly: No error logs and we can see that sonar is indexing the files in the logs. After the analysis, sonar writes the comment on github’s PR, and we can see the PR analysis on each sonar project’s console

On this example, the code changes should be affecting 3 projects on sonar, and they show a new pull request, but none of them show changes.

Bazel log on sonar execution:
bazel_logs.log (151.3 KB)

Could you please help us with this issue? we are not sure why is it happening, and we don’t see anything strange on Sonar Background Tasks also, they are all finishing ok.


Hey there.

  • Can you post your GitHub Actions YAML configuration?
  • Can you execute the scanner with DEBUG logging (sonar-scanner -X) and provide the logs?

Hi @rp-barma ,

In the logs I can read:

  • SCM reported changed lines for 0 files in the branch (2 times)
  • SCM reported 28 files changed in the branch (2 times)

Is this data consistent with what you expect from the PR?

We’ve found the issue yesterday, there was a misconfiguration on our bazel root build file that was excluding the files generated from the analysis.

Thanks Colin and Alex!

Great news @rp-barma and thank you for letting us know!