PR's passed the quality gate that had a 90% min coverage required, but now New Code for the main branch reports a failing 75%

This is apparently due to some PR’s not getting evaluated for Code Coverage due to a low line count.

If you want to apply the line count minimum exclusion for the new code in the PR, then its only fair to do the same for all new code and apply the same exclusion for the main branch new code. If that seems like a lot of work and potential calculation problems, then just get rid of the 20 line exclusion for PR’s. The current inconsistently applied calculation sets teams up for a late failure and to have to dig out of a hole rather than clean as you code.

The reason given was that a developer making a hotfix should be getting an exclusion. This line of thinking is incorrect and intrusive in most cases. A hotfix is needed due to a bug. If there were tests already for this code and they didnt catch the bug, they were wrong and need to be changed also. But if an org sets a quality gate, they are expecting it to be followed or are OK with some things not meeting the quality gate. Its up to them.

If the developer needs an exclusion and are permitted to do so by their team or organization, they can always add the corresponding exclusion, be it in the code using whatever language facility is available for this, or via the sonar properties. It is not SonarSource’s decision to make yet its being forced on customers…

Sometimes a new feature or non-hotfix bug fix only takes a single new line. These are also excluded from the quality gate now, only to be reported as a problem later. This later is often when someone from management looks over the sonar stats and sees new code coverage percentage looking awful and wonders what kind of games developers are playing to make the PR’s pass.

Those are all problems we dont need that this 20 line exclusion creates.

Hi,

SonarQube 8.9 added a way to turn off this Quality Gate “fudge factor”.

SONAR-10485 - Provide a way to always enforce coverage and duplication Quality Gate conditions

 
HTH,
Ann

Is that available in sonarcloud? If so can you point me to the documentation page for it? The JIRA ticket is not clear on how to set it for a project.

Hi,

Oops! Without context, I assumed SonarQube. I don’t believe that change has been made on SonarCloud.

FYI, on SonarQube it can be set at project- or global-level.

Would you like to move this thread to the New Features category? Or create a new post there? (Be sure to add the sonarcloud tag :slight_smile: )

 
Ann

Not really since it seems like a defect to me, but I’m OK with putting it where ever its going to result in getting fixed sooner

@ganncamp - is there a JIRA ticket for sonarcloud to address this?

Hi,

SCCOMM-41 - Provide a way to configure the Quality Gate fudge factor

 
HTH,
Ann