Configure quality gate for any number of lines

Hi,

We have recently started working with Sonarcloud, and so far the tool looks great. We have encountered a limitation that we would like to configure, but we found no way of doing so.

We are scanning a Pull Request that has a very few lines changed (13). The code coverage is around 61.5 and our Quality Gate defines that at least 80% is required.
When the PR is scanned, we get the following message:
“Some Quality Gate conditions on New Code were ignored because of the small number of New Lines”

If you hover over the question mark it says:
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.

We understand that this can be a pain under some circumstances, but we also believe that we should have the power to enable or disable this behavior. Is there anywhere in the administration options of Sonarcloud a place to configure this? (Either by fully enabling or disabling it, or by tweaking the number of lines required)

Thanks in advance!!

1 Like

Glad you’re enjoying the service so far!

I confirm that the number of lines threshold in the changeset (19), and the set of metrics to ignore when below the threshold are currently hardcoded, therefore not possible to customize, yet.

We have to choose our battles. Since this is not a feature in high demand, I’m afraid it’s not likely that we will find time to do this anytime soon.

Thanks for your reply and honesty. It is a pity :frowning:

It turns out there’s more demand for this than I realized.

I created a ticket, you can track it here:
https://jira.sonarsource.com/browse/SCCOMM-41

1 Like

That’s actually great! Thanks @janos