SonarCloud + GitHub PR Analysis and decoration


(David Schneider) #1

I’m trying to set-up an automatic scan of code when a GitHub PR is created. I’ve followed all the documentation I can find online and still nothing. I’m using the SonarCloud GitHub app bound it to our SonarCloud organization.

Is there anywhere in GitHub or SonarCloud I can look for diagnostics or status? How can I tell if anything is trying to perform an analysis but is failing due to a configuration issue?

Lastly, as a complete newbie at setting this up, is there a detailed set-by-step guide available I can follow to make sure I’ve configured everything correctly?

Thanks in advance for any help.

Edit: A bit more information if it helps:
We’re using our own Jenkins CI server which is currently NOT configured to run a build job for the PR. Does the Sonar analysis need to be performed from our Jenkins server and then uploaded to SonarCloud? Or does the GitHub SonarCloud app request an analysis directly from SonarCloud?


(Janos Gyerik) #2

This intro paragraph didn’t tell anything about the problem you are experiencing. I’m guessing that you don’t see decoration happening. It would be best to start with a clear statement of what is not working.

There are a couple of things you can do:

  • Was the PR analyzed? On your project’s page on SonarCloud, look for the dropdown in the top left next to the project name. By default it shows the main branch of the project, probably master. In this dropdown you should see the PR if it was analyzed. (If you don’t see the PR, then you can stop reading the bullet points, the rest of the tips require this step to work.)

  • Open the PR’s page on SonarCloud. Is there a warning in the top-center, with yellow background. It can give useful indication of things that went wrong, including that PR decoration did not happen.

If you had run the analysis yourself there would be more steps, but based on your edit, it seems that’s not the case: it seems you are trying to use our new automatic analysis feature which is in beta. Have you read that page, and have you created the .sonarcloud.properties file? If yes, you could try to push a new commit to the PR, and see if that triggers it.

For your case, the go-to-guide should be the documentation embedded directly into the product, specifically this page. For more details you can take a look around in the Documentation panel at the left.

I hope this helps!