Metadata-Version: 2.1
Name: jscpd
Version: 5.3.0
Summary: Copy/paste detector for programming source code
Author: Andrey Kucherenko
License: MIT
Keywords: duplicate-code,clone-detection,copy-paste,cpd,static-analysis
Project-URL: Homepage, https://jscpd.dev
Project-URL: Documentation, https://jscpd.dev
Project-URL: Repository, https://github.com/kucherenko/jscpd
Project-URL: Changelog, https://jscpd.dev/getting-started/changelog
Project-URL: Issues, https://github.com/kucherenko/jscpd/issues
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Quality Assurance

# 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

```bash
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-tokens` and `--min-lines` set the size.
- **Type-2 clones**: `--ignore-identifiers`, `--ignore-literals` and
  `--ignore-annotations` catch blocks that differ only in names, literal
  values or annotations.
- **Type-3 near-miss clones**: `--max-gap-lines N` merges copies with a few
  inserted or changed lines; `--similarity 0.85` compares JavaScript and
  TypeScript functions by syntax-tree structure.
- **Only new duplication**: `--baseline` or `--baseline-from-ref origin/main`
  with `--fail-on-new-clones` tolerate legacy clones and fail CI on
  regressions.
- **Threshold**: `--threshold 5` fails 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:

```yaml
repos:
  - repo: local
    hooks:
      - id: jscpd
        name: jscpd - copy/paste detector
        entry: jscpd
        language: python
        additional_dependencies: ['jscpd==5.3.0']
        args: [--threshold, "5", --reporters, console,silent]
        pass_filenames: false
        always_run: true
```

The repository also publishes a `.pre-commit-hooks.yaml`, so
`repo: https://github.com/kucherenko/jscpd` with a v5.2.1 or later `rev`
works without `additional_dependencies`.

## Links

- Documentation: https://jscpd.dev
- Source and issues: https://github.com/kucherenko/jscpd
- Changelog: https://jscpd.dev/getting-started/changelog
- GitHub Action, Docker image, npm, crates.io, Homebrew and Nix installs:
  https://jscpd.dev/getting-started/installation
