Default Sonar Way Quality gate is not failing even if new code coverage is 11%

I am evaluating SonarQube Cloud as a Code Quality tool in my current organisation. One of the core requirements we have is to fail PR checks if it has coverage less than 80%.

I have created a public project to check this. I have observed that the Sonar Quality Gate is passing even when the coverage is less than 80%. Sonar is correctly detecting the coverage is less than 80 under “New Issues” but quality gate is not failing.

Here is the comment Sonar has posted in the PR. It clearly says coverage is 11% but “Sonar Code Analysis” is passing.

Default “Sonar Way” is being used as shown in the below screenshot.

“New Code” settings is like below

Could someone please let me know what’s going wrong?

Hey @Tuk

Just to isolate the issue from the PR decoration, does your project dashboard (what you see when you click on “see analysis details on SonarQube Cloud” show 11.8% coverage and a passing quality gate?

My PR in which I was trying this was a bit small, less than 20.

I added some more code without tests for verifying and now it is working.

Do sonar has some lower limit on number of lines modified in a PR before Quality Gate starts failing?