Setting up sonarcloud on gradle project on github

I’m experimenting with sonarcloud as I’d like to get some experience using it. I therefore set up an extremely simple gradle/java project on github. I then set this up on sonarcloud and it currently analyses code commited to my main branch, and also analyses pull requests to the main branch using a github action. That was pretty easy to set up. I am however a little confused how to get PR decorating and code coverage to work. Code coverage is claimed to be 0% and despite there being new code smells in the pr, there are no pr decorations.

I hope I’ve provided enough information :slight_smile:

Hello Aleksander,

Welcome to our community!

It’s a good start you’ve got there. The only missing part I see is computing the code coverage with Jacoco, before running the SonarCloud analysis. SonarCloud doesn’t compute the coverage or run the tests by itself, it relies on the output of Jacoco (for Java).

You can have a look at this example of project that use gradle and a Github action.

Otherwise regarding the PR that you shared I can see the decoration here:

Or when going into the SonarCloud Github check details.

Thanks for the reply Gregoire :slight_smile:

Thanks for the tip about Jacoco :smiley:

Perhaps I used the wrong term when I mentioned PR decorating. What I’m trying to get working there is automatic code review comments such as the one seen here: