Share a PMD HTML report
PMD has been telling Java teams about their CyclomaticComplexity since
before most of the code it analyzes was written. The findings are useful. The
delivery mechanism — a file under target/site/ on a build agent — is why
nobody looks at them.
Write the report
Standalone:
pmd check -d src/main/java \
-R rulesets/java/quickstart.xml \
-f html -r pmd.html || true
Maven:
mvn pmd:pmd # → target/site/pmd.html
Gradle's pmd plugin writes build/reports/pmd/main.html.
The || true matters in a report step — PMD exits non-zero when it finds
violations, which is every run you care about.
Publish it
Drag the HTML into the app, or from CI:
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 pmd.html \
--arg title "PMD — $(git rev-parse --short HEAD)" \
'{title: $title, html: $html}')"
If the report references a stylesheet (the Maven site variant does), drag the folder rather than the single file and the references are rewritten to the uploaded assets.
Keep the gate separate
// Gradle: the gate fails the build
pmd { ignoreFailures = false }
- name: PMD report
if: always()
run: mvn -q pmd:pmd
A red gate with no readable artifact is the failure mode worth engineering around.
What review adds
- Anchored threads on a rule cluster — ownership, suppressions and the reasoning behind them, sitting on the evidence. See commenting on HTML.
- Revisions, so "we cut priority-1 violations in half" is a diff, not a claim.
- Access per report — private, team, domain-gated, or named reviewers. See the sharing model.
Limits
- Entry HTML: 5 MB. Assets: 25 MB per file, 250 MB and 500 files total.
- 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.