GitHub Line Coverage: Why Two 60% Reports Don’t Make 120%

How does GitHub Code Quality combine coverage reports when two suites test the same file? Start with the lines rather than the headline percentages. Two suites can each cover 60% of the same file while leaving some of the same lines untested. Adding their percentages would count shared evidence twice.

Our fictional ten-line fixture makes that overlap visible. Suite A covers six lines, suite B covers six, and four are shared. The union contains eight distinct covered lines, so the combined coverage is 80%. The arithmetic is reproducible locally; it is not a result uploaded to a GitHub repository.

What the new repository coverage view shows

The 4 December GitHub preview announcement introduces a repository coverage overview for the default branch. It combines uploaded reports and counts a covered line once even when several reports cover it. The preview is available on eligible GitHub Team and Enterprise Cloud repositories, including data residency, rather than Enterprise Server.

The announcement also distinguishes a displayed coverage target from a merge gate: the overview target does not itself block merges. Keep that boundary visible when a learner sees a target line beside a trend. A displayed goal, a passed test suite and an enforced branch rule are different pieces of evidence.

Define the same denominator before comparing suites

In this exercise, fixture.py has ten agreed executable line identities, numbered 1 through 10. Suite A covers lines 1–6. Suite B covers lines 3–8. These numbers are deliberately invented so a class can audit every row without a production repository or private source code.

A line identity needs both a file path and a line number. The GitHub coverage reference uses that pair when combining reports. Therefore, keep the path convention and source snapshot consistent. The same line number in two different files does not identify the same line, and a changed file can move the code to another number.

RegionLine identities in fixture.pyCount
Only suite A1, 22
Both suites3, 4, 5, 64
Only suite B7, 82
Neither suite9, 102
The four regions are mutually exclusive and together contain all ten fictional executable lines.

How does GitHub Code Quality combine coverage reports?

First count the two covered sets: six lines in each. Next count the intersection: four lines appear in both. Subtract that duplicate contribution once. The calculation is 6 + 6 − 4 = 8, followed by 8 ÷ 10 × 100 = 80%. The denominator remains ten distinct executable lines.

The separate percentages are useful descriptions of the suites. However, they are not independent pieces that can be added into a combined percentage. Even taking their simple average would miss the new lines covered by the second suite. Here the average remains 60%, while the distinct union is 80%.

Bar chart shows six covered lines in suite A, six in suite B and eight combined; doughnut splits ten fictional lines into A only two, both four, B only two and neither two
The doughnut uses four non-overlapping regions of the same ten-line denominator. The bar chart compares coverage counts on that identical basis.
suite_a = set(range(1, 7))
suite_b = set(range(3, 9))
executable = set(range(1, 11))
covered = suite_a | suite_b
assert len(suite_a & suite_b) == 4
assert len(covered) == 8
print(100 * len(covered) / len(executable))  # 80.0

We ran this set arithmetic locally when preparing the figure and answer key. It verifies the invented membership counts only. It does not execute an application test suite, produce a real Cobertura upload or establish what any repository currently displays.

Keep source identity and report scope together

Before combining real reports, record the commit or source snapshot, branch and file-path convention. Then compare the reported executable-line sets. A different denominator can explain a changed percentage even when a familiar suite name appears on both reports. Do not conceal that change by copying only the top-line value.

Two fictional reports both identify fixture.py line three; the map merges them into one covered line after checking snapshot and path convention
The same path and line number identify one line in this fixture. Matching the source snapshot remains a separate review check.

The repository coverage viewing guide describes the preview prerequisites and filters. For a single-report view, inspect both language and label rather than assuming one filter has selected exactly the suite you intend. Save that context with any screenshot used in a review.

For upload-format problems, use our earlier GitHub Cobertura upload guide. This article answers a different question: how shared covered lines affect the combined number after usable reports exist. A missing upload and an overlapping upload need different investigations.

Coverage is evidence of execution, not correctness

Suppose a line runs but the test never checks its returned value. It can still count as covered while an incorrect result goes unnoticed. Likewise, a test that exercises one input does not prove that empty input, a boundary value or an error path behaves correctly.

Use the two uncovered fixture lines as prompts for review, then ask what each proposed test should assert. Do not invent a universal coverage target for every project. The appropriate checks depend on the behaviour and risk of the code, not only the percentage at the top of the dashboard.

Download the classroom exercise and answer key

The line-membership file lists all ten fictional rows. The answer key shows the overlap and union. Use the blank report-review sheet to record actual scope before interpreting a real comparison, and retain the source register when citing the preview’s behaviour.

Tech Consulting Tailored to Your Coding Journey

Get expert guidance in coding with a personalized consultation. Receive unique, actionable insights delivered in 1-3 business days.

Get Started

Method and limitations

Checked on 5 December 2026. We read the announcement and official guides, then verified the invented set arithmetic locally. The fixture is an educational model of ten agreed executable lines. It is not a benchmark, a GitHub upload receipt or evidence that covered code is correct. Public preview behaviour can change.