Share a SpotBugs report
SpotBugs finds the things code review misses — the null that is only null on
the error path, the equals without a hashCode, the stream that never gets
closed. It reports them in an HTML file that lands somewhere like:
build/reports/spotbugs/main.html # Gradle
target/site/spotbugs.html # Maven, via the site lifecycle
and is read by exactly one person: whoever was debugging the build.
Enable HTML, publish it
// build.gradle.kts
spotbugs {
ignoreFailures.set(false)
}
tasks.spotbugsMain {
reports.create("html") {
required.set(true)
setStylesheet("fancy-hist.xsl")
}
}
./gradlew spotbugsMain
curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html build/reports/spotbugs/main.html \
--arg title "SpotBugs — $GITHUB_SHA" '{title: $title, html: $html}')"
For a one-off, drag the file into the app.
Note the Gradle plugin's one-report-per-task rule: pick HTML for the artifact humans read, and produce SARIF from a separate task if something downstream needs to parse it.