Sonar scan passes with 0 coverage on new code with QG asking for >90

Hi ,

I have following situation

  • Project has QG that checks for code coverage to be >90% on new code.
  • In my feature (not main) branch I added some code without tests and run sonar.
  • Sonar detects new changes and that there are new lines that are not covered.
  • However overall status reported as “passed”, despite GQ is there to check that new additions should be covered. See images attached.

Why? Why this is happening ?
I actually gave up debugging and decided to post here as last resort, hoping someone had similar issue and can help.



Hi there.

When there are less than 20 lines of code changed, the quality gate does not apply the conditions about coverage or duplications.

There should be a note there to prevent confusion, and we have an open ticket in the backlog to add that note. It’s also in our backlog to align the behavior with SonarQube and give an option to turn this threshold off.

`Hi, thanks ! validated by adding more code.
Thread can be closed/resolved.

1 Like