SonarCloud not including Checkstyle code smells in debt ratio and maintainability rating

  • ALM used:
  • CI system used:
    Gitlab pipelines
  • Languages of the repository

We are trying to integrate custom Checkstyle rules with one of our projects. The Checkstyle report is generated using maven in a Gitlab pipeline and it is successfully imported into SonarCloud. The problem is that in a small MR with one or two classes changed and a huge amount of code smells, the maintainability rating on new code remains A, and the debt ratio is 0.0%.

The issue is pretty clear when you use the “Measures” page, to filter out one concrete class showing:
Screenshot 2023-02-17 at 12.33.33

Then if “show measures” → “show all measures” is used, the actual value that rating and debt rate should have are shown:
Screenshot 2023-02-17 at 13.29.50

For some reason, those values are not included in the aggregation and then the quality gate ignores them.

The problem does not happen with code smells detected by internal sonar rules.

Thanks in advance

Hello @luisttk ,

First of all, welcome to our Community! We are taking a look into your issue.

I have one initial question: Did your changes in your MR include code smells? One reason the QG could be passing is that on MR we only look into “New Code” as part of our CAYC methodology. You can read more about it here.