Skip to content
Source About Test Coverage

diff-coverage-report

https://github.com/pavelkorolevxyz/diff-coverage-report

Just 4 days of ping pong with Gradle Plugin Portal for them to approve my publish, plus several free hours with Claude Code to polish this whole thing and make it less embarrassing to publish.

It's just a Gradle plugin that provides one task, run like this:

./gradlew reportDiffCoverage --branch=main --report=build/reports/kover/report.xml

or like this:

./gradlew reportDiffCoverage --diffSha=abc123 --report=build/reports/jacoco/test/jacocoTestReport.xml

The result is immediately visible in the console

> Task :reportDiffCoverage
17/20 - src/main/kotlin/Feature.kt
10/15 - src/main/kotlin/Service.kt

Total: 27/35 (77.14%)
Report saved to: /path/to/build/reports/coverage/report.txt

And in a file to parse for your checks

analyzedLines: 35
coveredLines: 27
uncoveredLines: 8
coveragePercentage: 77.14

There should be no preconditions. It eats an XML report file and a reference to a branch/commit to compare with, that's all.

PS. For now there's no point in it being a Gradle plugin, it could just be a script (maybe it will even be a script in an alternative version). But I think it's a good idea to pull configuration out there.