Pull requests and automatic analysis in sonarcloud

I’m using Buildkite to build a python project from Github and am using sonar-scanner to analyze and upload coverage for this project. I want to be able to check pull-requests but the only way to do this on sonarcloud (as far as I know) is to use the automatic analysis. The problem is, if I turn on automatic analysis I do get the annotated checks for pull requests but this also enables automatic analysis for pushes to master which seems to blow away my coverage data uploaded from my build pipeline.

  1. Is there a way to limit automatic analysis to pull requests only?
  2. If not 1 is there a way I can use sonar-scanner from my pr pipeline, get annotated gates for pull-requests, and avoid polluting the data for my mainline pushes?

Thanks.

Hi,

No you cannot limit automatic analysis to PR only. But you don’t need automatic analysis to be able to analyse pull request (and see the result in GitHub). You can do it in any CI with the sonar-scanner.
You can find more information on PR analysis here.

Hope that helps,

Benoit