Share a jscpd report
Duplication metrics have a credibility problem. The number goes up, someone says "we should fix that," and nothing happens — because the number is not actionable and the report that is actionable lives in a CI artifact nobody opens.
The actionable part is the clone pair: these forty lines and those forty lines. Looking at a specific pair, a reviewer can say in ten seconds whether it should be extracted or left alone. That is a decision worth recording somewhere it will be found again.
Publish it
npx jscpd src --reporters html --output ./jscpd-report || true
curl -fsS -X PATCH \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html ./jscpd-report/html/index.html \
--arg title "Duplication — $REPO — $(date +%F)" \
'{title: $title, html: $html}')"
Or drag the report directory into the app so the per-file pages upload alongside the index.
|| true because jscpd exits non-zero over a configured threshold, and
the run that breaches the threshold is the one to publish.
What the URL changes
- Verdicts on clone pairs. "Deliberate — the generated clients diverge next quarter" pinned to the pair, still there next run. See commenting on HTML.
- A trend, not a number. Revision per run at one URL. See revisions and diffs.
- A tech-debt conversation with a location. Refactor planning usually founders on not having a shared artifact; this is one.
- On a schedule. A routine refreshes it weekly, so the drift is visible without anyone remembering to look.
Limits
- Entry HTML: 5 MB. Assets: 25 MB per file, 250 MB and 500 files total. A large monorepo report can pass 500 files — scope jscpd to a package per report when it does.
- Scripts run, sandboxed:
allow-scripts, noallow-same-origin. - 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.
Related
- Dependency-cruiser graphs — the other structural view
- ESLint reports · SonarQube
- Weekly digests · Publish from CI