Support for duplication/coverage grace limits

Using the new code on the quality gate to push teams to improve code, however finding it can be difficult to make this a strict requirement.

Every so often a PR comes along where it is difficult or would be worse to try and achieve the desired coverage or reduce duplication, but it’s only an issue for the specific PR. In most of these cases the overall project coverage and duplication are well inside the desired limits.

Are there any grace limits such as:

  • New code coverage
    • PR is 70%, <80% required
    • project overall is 85% and this would reduce it by less than .25 percentage points
    • => outcome should be pass
  • New code duplication
    • PR is 15%, >3% required
    • project overall is 2% and this would increase it by < .25 percentage points
    • => outcome should be pass

Essentially if the specific measure in overall project health is good allow new code gates individual PRs to tolerate some small reductions.

Would like to avoid teams feeling like they need tp apply exclusions to work around individual temporary exceptions as these by merging changes to the config which would apply to all PRs subsequently and defeat the purpose of trying to ratchet up quality.

Is there anyway to achieve the above in Github without adding a custom check that is run post analysis and using that as the required status check to pass?

Hey @electrofelix! If I understand correctly, what you are proposing is a “double factor condition”, where both the PR’s and the target branch’s metrics are taken into account. We currently don’t support that, the closest thing to a “grace limit” we have is the fudge factor, which exempts very small PRs from duplication and coverage conditions, but it’s not really what you’re asking here.

I also don’t think there’s any simple way you could achieve this without writing your own custom check that queries the API for metrics and runs the calculations.

I’m going to flag this for our PMs, it might be an interesting piece of feedback for them.