Sonar Quality Gate Passes With 0% Code Coverage

SonarQube version: 9.9.0.65466
Coding language: ruby
CI/CD pipeline: Github actions

Hello,

I am running into an issue where I have setup a customized quality gate enabled for my company’s repositories, and have setup the Github action workflows to fail/pass if the repo does not meet the conditions of the quality gate that is assigned to the project in our SonarQube instance.

However, I am seeing that the quality gate that I have enabled for one of my projects is not failing when it is expected to. We have the following condition enabled Code Coverage should be greater than 80% for new code. The sonar scan performed the scan on the new code and it stated that 0% of the new code has code coverage which is what we are expected to see, but I don’t see that the quality gate failed it still shows as passed. Can someone confirm this is expected cause I would expect that the gate should fail due 0% code coverage on the new code that is to be added.



Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

I’m going to guess this is a very small pull request (less than 20 lines) which, by default, means that conditions on duplication and coverage won’t be taken into account. There should be mention of this on the Overview of your Pull Request.

This behavior an be adjusted under global Administration > General > Quality Gate

Thanks Colin this was indeed the solution!

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