Badge reporter
-r badge writes shields-style SVGs that show the numbers of the last run with no badge service in between: commit them or publish them from CI and link them from the README. The color of the duplication badge follows the percentage, so a README shows at a glance whether the project sits below 10%, below 20% or above.
Run it
jscpd . -r badge --output report
Badge saved to report/jscpd-badge.svg
ls report
jscpd-badge.svg
jscpd-lines-badge.svg
{
"reporters": ["console", "badge"],
"output": "report"
}
The output
| File | Label | Value | Color |
|---|---|---|---|
jscpd-badge.svg | duplication | the duplication of the run, 17.7% here | green up to 10%, orange above 10%, red above 20% |
jscpd-lines-badge.svg | dup lines | the duplicated lines, 34 here | blue |
Each badge is a 20 px high SVG with the label on grey and the value on the color, in 11 px DejaVu Sans. The file below is the duplication badge of the sample run without its gradient and shadow text:
<svg xmlns="http://www.w3.org/2000/svg" width="132" height="20">
<rect rx="3" width="132" height="20" fill="#555"/>
<rect rx="3" x="87" width="45" height="20" fill="#f39c12"/>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,sans-serif" font-size="11">
<text x="43" y="14">duplication</text>
<text x="109" y="14">17.7%</text>
</g>
</svg>
Where it shows up

The image has to be reachable from the README: commit the file after a local run, or let the CI job that runs jscpd commit or publish it.
With gates
The badges show numbers only. --threshold and a baseline do not change them; --kind does, because the statistics follow the clones that are reported. --health -r badge writes a third file, jscpd-health-badge.svg, with the grade and score of the health score (health | B 73): green for A and B, yellow for C, orange for D and red for E.
Options
The badge reporter reads -o/--output only. CLI options lists it with the rest.
Related
JSON reporter
Every clone with its locations, kind and source, plus the statistics per format, in one file for scripts and pipelines.
SARIF reporter
A SARIF 2.1.0 log with one result per clone, its counterpart as a related location and a stable fingerprint, for GitHub code scanning and other SARIF consumers.