The sonar pass even when my coverage is low

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    8.9.8.54436
  • how is SonarQube deployed: zip, Docker, Helm
    helm
    Hello, i meet one question when use sonar:
    I config the one check for coverage:
    Coverage is less than 80.0%
    but when i commit codes, it show pass, what is wrong about my config? thanks for any help

Hi,

Welcome to the community!

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.9.8 → 9.9.2 → 10.2.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your question, your Quality Gate condition is on New Code, while the second screenshot shows low coverage on Overall code. So apparently your new code has <= 80% coverage.

 
HTH,
Ann

thanks for your reply,as you mentioned, the new code coverage is <=80%, so the quality gate
should be fail and in red,right? however it is always pass and in green, it is not match my expectation

Hi,

That’s not what your screenshot shows, and not what I meant :flushed: to type.

Your screenshot shows that your Overall code has low coverage. Presumably, your New code has >= 80% coverage.

Sorry fo the confusion.

 
Ann