Default Quality Gate Not Scoring New Versions For Code Coverage

We are using the built in Quality Gate in SonarCloud but noticed that when a new version of the code is checked in that SonarCloud does not appear to check for “code coverage” on the new version. It basically passes the quality gate with a zero for some reason. We break our code pushes based off the quality gate scoring and these seem to go right through.

Am I missing something? Even if it is a new version I would think it would still check for code coverage right? I’m not a developer, I’m the cyber dude so if you happen to know a solution please understand I’m a complete newb :slight_smile:

Hi,

Welcome to the community!

Would you mind sharing some screenshots to help us understand?

Ideally you’ll show your project’s (version’s?) Quality Gate status, as well as a screenshot of the conditions in the Quality Gate.

 
Ann

Sure! Here is a copy of the Quality Gate, it’s just the standard built in gate

Image of the code that is passing the gate check with a little green “passed” icon
image

Another screenpic

Hi,

Your Quality Gate is about conditions On New Code. The third screenshot shows overall values & so isn’t directly relevant to the Quality Gate conditions.

The 4th screenshot shows an overall coverage of 0.0% on the main branch, and the fifth shows a precipitous drop in coverage.

At a guess, your analysis stopped passing in the coverage report around the beginning of the year. And, IIRC, when no coverage is passed in, conditions on coverage aren’t applied because the assumption is that you don’t care about coverage.

So the thing to do here is

  • review your pipeline: is the coverage report still being generated?
  • review your analysis logs: what do they say about the import of coverage?

 
HTH,
Ann