Integrate SonarQube with your AI agent, scan for secrets and dependency risks, and explore and manage issues—all from the command line.
Start using SonarQube CLI
I’m trying to block merging PRs if code coverage drops under a specific threshold, let’s say 80% for now
I created a quality gate for this and added the repositories to which it should apply
I created a new PR where I deleted all unit tests. In SonarSource, I can see that it detects that the coverage is ZERO now. But still, merging in Github is still possible
Please note that I already created a branch protection rule and made " SonarCloud Code Analysis " status check required
Can you please tell me what I’m missing here?
Template for a good new topic, formatted with Markdown:
Hi @benzid-wael, welcome and thanks for posting to the community!
I reviewed your project and found the following:
PR #5 captured a 0% coverage, however it bears the warning “Some Quality Gate conditions on New Code were ignored because of the small number of New Lines”. Indeed 4 lines got changed only so it is a likely cause for not impacting the code coverage
PR #6 comes with no code coverage data being provided “No data yet”. I guess this relates to your test whereby all unit tests were removed.
I believe that your configuration is correct, however requires a more substantial pull request to see the benefits.