Quality Gate Passed even if coverage is 0%

Hi,
We are using sonarcloud and configured Quality Gate with 80% coverage required to pass PullRequest check.
However, randomly some of our pull requested have green “Passed” status even if they have 0% coverage.

Project has correct Quality Gate attached
Pipeline is configured and we can see correct coverage.


1 Like

Hey there.

How many new “Lines to Cover” are reported on your pull request dashboard in SonarCloud? I wonder if you’re running into the scenario where there are too few new lines to trigger the Quality Gate condition.

1 Like

Hi @Colin

Thanks, you are right, I’ve checked such strange PRs, they are not so big.
However, we try to deliver code with small PRs, and such condition is not suitable for our team, because 50+% of PR < 20 lines

Is it possible to disable such condition or reduce line amount for it on SonarCloud or pipeline side?
We use java + maven plugin to integrate

Thanks in advance

Hey there.

This is not configurable at the moment, although a feature was launched in SonarQube at some point in the last few years to turn it off altogether. I’ve passed your feedback along, however, and there’s a ticket in the backlog to provide some more visibility around Quality Gate conditions that aren’t triggered due to the size of the changeset.

1 Like

Hi,
Are there plans to address this issue?
Its a real pain point for us adopting SonarCloud as we follow the release small release often methodology and small PRs need to be checked.

1 Like

Likewise, this is stopping us from using SonarCloud as 42% of our Pull Requests are below 2 lines of code

2 Likes

It’s been half a year, can you please provide some feedback? Basically, is this something that you plan to enable us to configure on our side or not? For my org, this is going against best practices and we would like the chance to configure it. Otherwise, it almost makes SonarCloud useless.

At the very least, make this a rule that can be deactivated. SonarCloud should not be opinionated.

1 Like

Hello everyone,

Thank you for providing this feedback!

We are planning to roll out some larger changes to how coverage and duplications work in the coming months, where this problem will be fixed as well.

1 Like

Hi, any updates on this issue? This is also blocking us from adopting sonar. Thanks.

Hello @jazzdragon ,

There are no updates to share yet. I’ll update the thread once there are some news.

2 Likes

Hi,

We are getting close to a year of our code quality going down.

By now all the developers figured out to keep their commits small - the only good thing - and your horrible idea to punch a hole in code quality gates.

How hard is it to make a single parameter? Surely it can’t justify having a “feature” that invalidates most of your business proposition - code quality.

1 Like

Just hopping on the bandwagon to let the team know this is important to us as well.
It does seem inline with the principles that SonarCloud supports in its ethos.
Thank you for your consideration! :slight_smile:

1 Like

Hello Sonar team,

Do we have any updates on this issue?

It would be really nice if the quality gate could block PRs where the coverage doesn’t reach the threshold also for when there are just a few lines modified.

Thanks!

1 Like

Please act on this issue. We also need this in our team. Thanks!

Hello Hermann,

Thanks for sharing the feedback. I do not have an update at this point, but I will update you here when I do.

1 Like