Coverage not analyzing less than 20 lines on new lines

Hello community,

I see a comment on SonarCloud that basically says that less 20 lines are not going to be analyzed for New Lines.

I see this ticket open, but not sure if this is only for SonarQube

I also saw an older very similar ticket - Problem when PR has less than 20 new LOCs

Can someone let me know if there’s a feature enabled for SonarCloud?

Hi,

It’s not that fewer than 20 lines aren’t analyzed. It’s that Quality Gate conditions on Coverage on New Code and Duplications on New Code aren’t enforced when there are fewer than 20 new lines.

A toggle to turn off this behavior has been added to SonarQube, but not in SonarCloud.

 
HTH,
Ann

Thank you Ann for the reply!

Is there any plan for a feature to block this in SonarCloud?

Thanks again

Hi,

Sorry, but I’m not currently aware of any plan for that.

 
:slightly_frowning_face:
Ann

Hi Ann, if there are no plans to add a user setting for minimum number of lines changed to affect a quality gate, it would be very much appreciated if you could at least display a notification in the summary page explaining why the quality gate passed regarding this issue. Currently sonarcloud does not explain this in the summary nor in the detailed measures reports. Thanks!

2 Likes

Thank You for pointing this out, Sean.
We will look into this opportunity for improvement.

1 Like

Hi,

Could you please tell me where is that toggle button and in which minimum version it is? I can’t find it on SonarQube.

Ludo

Hi Ludo,

It’s in Administration, under General. I know you’ll find it in 10.5.1.

 
HTH,
Ann

Thanks for you answer, I’m in version 9.9.1 and I can see a tooltip saying
"
At the start of a new code period, if very few lines have been added or modified, it might be difficult to reach the desired level of code coverage or duplications. To prevent Quality Gate failure when there’s little that can be done about it, Quality Gate conditions about duplications in new code and coverage on new code are ignored until the number of new lines is at least 20. An administrator can disable this in the general settings.
".
So I guess it’s also available in version 9, but can’t find it in general settings.

Hi,

Do you have access to Administration? If so, search in the browser for the word ‘small’

Selection_1850

 
Ann

Spot on! Thank you very much indeed.