Coverage on New Code 0.0%

I am using SonarQube Server and deployed through docker

I am getting this error: “Coverage on New Code 0.0%.” I was


not doing any unit tests earlier, and it is working fine. Now yesterday, a few lines of code and I’m getting this error. i am running sonarqube scanner in aws codebuild pipeline

Hi,

Welcome to the community!

Per the docs, Quality Gate Conditions on Coverage and Duplicated lines on new code are not calculated when there are fewer than 20 lines.

So when you were passing the Quality Gate with no tests, you hadn’t yet accumulated 20 lines. Then you crossed the threshold.

 
Ann

can i reduce this lines min 1 or 2 lines

Hi,

Sorry, this isn’t tunable. But you can turn it off, either at the project level or globally.

 
HTH,
Ann

how do i turn off

Hi,

It’s in your project settings. Or globally under Administration.

 
HTH,
Ann