Why the code coverage is lower than quality gate, but it still passed the quality gate?

Must-share information (formatted with Markdown):

  • SonarQube version 9.5
  • Get the correct quality gate data.
  • Setup quality gate and apply the quality gate to the projects.

Our code coverage for quality gate was set as 85%, however some projects’ code coverage is much lower than 85%, they still passed the quality gate. How should fix the issue?

Thanks,
Cathy

Hey there.

Can you take a screenshot of your Quality Gate configuration, as well as of a project dashboard where you expect a QG failure but don’t see one?

Hi Colin,

Here are the screenshots for quality gate and project dashboard.


Thanks,
Cathy

Thanks.

Can you confirm that this Quality Gate is indeed assigned to that project? You can check this in the Project Information drawer in the upper right.

And, I noticed your project hasn’t been analyzed since June 17th. If you’ve changed your Quality Gate since then, you’ll need to reanalyze your project.

Hi Colin,

I noticed the quality gate failed for above project for some reason today. But I have other examples as below. I made sure it use the same quality gate.


Thanks,
Cathy

And… in the screenshot you just shared, it also hasn’t been analyzed since June 17th. Do you encounter this issue when you submit a new analysis for a branch?

I there is no new code to submit at this moment. I didn’t change the quality gate. It just passed after some time without changing the quality gate and submitting the new code. The only thing that we did is we upgraded the SonarQube to 9.5 on 6/17.

Thanks,
Cathy