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.
This commit is contained in:
Julian Sommer
2026-02-26 11:35:22 +10:00
parent 3720a5ba90
commit 12c2e2789e
+6
View File
@@ -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