Gitlab decoration missing issue counts

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Sonarqube Developer Edition Version 10.4.1 (build 88267)

Building with Gradle 8.6 and using the Gradle Sonarqube plugin version 4.4.1.3373

  • how is SonarQube deployed: zip, Docker, Helm

Docker

  • what are you trying to achieve

Display the correct merge request decoration

  • what have you tried so far to achieve this

This used to work and honestly I’m not sure when it stopped. We have Sonarqube merge request decorations showing up, however they are missing a lot of information.

image

When I click on the link to take me to Sonarqube I see there are issues that are not listed in the decoration.

I have other projects that work fine (although I build them with Maven, not Gradle).

image

Not sure what to check.

Just to add on to this, we have a large project so when we do Sonarqube scanning we don’t run our unit tests and do not execute jacoco. We don’t expect to have code coverage on merge requests.

We also have a nightly task to run unit tests/jacoco on the master branch.

So I just checked and if I just update build.gradle and there are no issues I do see the full counts.

So I add this

    public void fakeFunction() {
        System.out.println("just adding a function that does nothing to see if it gets picked up in the Sonarqube decoration");
    }

and now I don’t get issue counts.

I remove it and the zero counts come back.

This is confusing because we will always have zero code coverage so when there are new issues we never see them in the decoration.

1 Like

Hey @ctmay4

This gitlab decoration will show you metrics (“Issues” and “Measures”) only when Quality Gate has PASSED. Otherwise it will not, only failed conditions.
Apparently, those 6 issues where not enough to fail your Quality gate condition, which is “Maintainability rating A” as one of the conditions. So it’s expected, that only failing coverage condition, and nothing else is in the decoration.

I would suggest you to rely on “0 issues on new code” condition instead of “Maintainability rating A” for your Quality Gate. That way whatever number of open issues, it will fail Quality Gate, and you will see those in the decoration. That is currently a recommended and a default condition for issues.

Note that if you rely on ‘0 issues’ condition, you can drop all other issue-related conditions (like ‘Security Rating’, ‘Reliability rating’).

Regards,
Elena

Thanks. I’m not sure how the quality gate changed but it was missing the 0 failed issues. Once I corrected it all looks good. Thanks.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.