What is Diff / New-Code Coverage?

Measuring coverage only on the lines changed in a pull request, rather than across the whole codebase.

Total coverage on a large legacy codebase is a number nobody can move. Diff coverage asks a tractable question instead: were the lines you just wrote tested?

This is what makes coverage enforceable in practice. A team can require 80% coverage on new code from day one without ever having to backfill tests for a decade of existing code. The overall number then rises on its own as the codebase turns over.

Top 4 Diff / New-Code Coverage tools

Every tool in the directory documented as supporting Diff / New-Code Coverage, 3 fully, 1 partially, with what its own documentation says.

Support is not the same as parity, since some implementations are narrower in scope, gated to a higher plan tier, or maintained only for existing customers. The note under each tool is what its own documentation describes.

  1. 1
    CodacyQuality PlatformTeam

    Diff coverage of newly added or modified lines on PRs, commits and dashboard.

  2. 2
    DeepSourceQuality Platform

    New-code metrics NLCV, NBCV, NCCV, NCPCV measure changeset coverage and gate merges on thresholds.

  3. 3
    QltyQuality PlatformCloud (pricing undocumented)

    Diff Coverage is the primary quality gate, with configurable minimum and minimum diff size

  4. 4
    SonarQubeQuality PlatformPartial

    Configurable new-code definition drives gates on new code; coverage-on-new-code not explicitly documented.

What to look for

  • Whether the threshold for new code is separately configurable
  • How added versus modified lines are counted
  • Whether the gate blocks the merge or only reports
  • Behaviour on pull requests that contain no testable changes

Related terms

FAQ

What is Diff / New-Code Coverage?

Measuring coverage only on the lines changed in a pull request, rather than across the whole codebase.

How many tools support Diff / New-Code Coverage?

4 of the 20 tools tracked in this directory support Diff / New-Code Coverage, 3 fully and 1 partially, including Codacy, DeepSource, Qlty, SonarQube. Support is not the same as parity, since some implementations are narrower in scope, gated to a higher plan tier, or maintained only for existing customers. The note under each tool is what its own documentation describes.

What should you look for in Diff / New-Code Coverage?

Whether the threshold for new code is separately configurable. How added versus modified lines are counted. Whether the gate blocks the merge or only reports. Behaviour on pull requests that contain no testable changes.