From 12c2e2789e6407ae128e54297ed1bbf8cc7ee6f2 Mon Sep 17 00:00:00 2001 From: Julian Sommer <115516918+juliansommer@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:35:22 +1000 Subject: [PATCH] fix: skip diff coverage when instrumentable lines below minimum The MIN_LOC=100 threshold checked total diff lines, not instrumentable lines. A commit with many non-instrumentable lines (structs, comments) but only 1-2 instrumentable lines would unfairly fail at 0% coverage. Add a minimum instrumentable lines threshold (5) so the check skips when the sample size is too small to be meaningful. --- scripts/diff-coverage.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/diff-coverage.sh b/scripts/diff-coverage.sh index 60110fafa..dca5c1b85 100755 --- a/scripts/diff-coverage.sh +++ b/scripts/diff-coverage.sh @@ -148,6 +148,12 @@ awk -v threshold="$THRESHOLD" ' exit 0 } + min_instrumentable = 5 + if (total < min_instrumentable) { + printf "Only %d instrumentable lines (< %d minimum) — skipping diff coverage.\n", total, min_instrumentable + exit 0 + } + uncovered = total - covered pct = (covered / total) * 100