Copy/paste detector for programming source code
Actively maintained. Last release 3 weeks ago, commits in 26 of the last 26 weeks. A safe choice.
pip install jscpdREADME as published on PyPI with version 5.4.3.
jscpd
Copy/paste detector for programming source code. jscpd finds duplicated blocks across 224 language formats, including cross-format detection for Vue, Svelte, Astro and Markdown, and writes the result with 15 reporters: console, JSON, XML, CSV, HTML, Markdown, SARIF, Code Climate, OpenMetrics, badge, Xcode, a token-efficient AI format and more.
This package ships the same self-contained Rust binary as the npm and
crates.io releases, as platform wheels for macOS (arm64, x64), Linux (glibc
and musl, x64 and arm64) and Windows (x64, arm64). It installs the jscpd
and cpd commands. No Python code, no Node.js runtime.
Install
pip install jscpd # or: pipx install jscpd / uv tool install jscpd
jscpd /path/to/code
uvx jscpd /path/to/code # run without installing
What it finds
- Exact clones by default;
--min-tokensand--min-linesset the size. - Type-2 clones:
--ignore-identifiers,--ignore-literalsand--ignore-annotationscatch blocks that differ only in names, literal values or annotations. - Type-3 near-miss clones:
--max-gap-lines Nmerges copies with a few inserted or changed lines;--similaritycompares functions of fifteen languages by the subtrees of their normalized syntax trees. - Only new duplication:
--baselineor--baseline-from-ref origin/mainwith--fail-on-new-clonestolerate legacy clones and fail CI on regressions. - Threshold:
--threshold 5fails the run when more than 5% of the code is duplicated.
Also --blame (git authorship per clone), --summary (refactoring hotspots
by tokens, lines, size and complexity), --mcp (a built-in MCP server so an
AI assistant can query the scan), --skip-local and --skip-isolated for
monorepos, and .jscpd.json configuration. Full CLI reference:
https://jscpd.dev
pre-commit
No Node.js needed; the hook installs this wheel: