Jscpd
Copy/paste detector for programming source code, supports 223 formats. AI-ready with token-efficient reporter, skill and MCP server.
Last verified:
What is Jscpd?
Jscpd is an open-source copy/paste detector for programming source code that supports 150+ programming languages and digital formats. It uses the Rabin-Karp algorithm to find duplicated code blocks, helping developers identify technical debt from copy-pasted code. The tool provides both a command-line interface and a programming API for integration into applications and CI/CD pipelines.
Key features include support for 150+ formats (JavaScript, TypeScript, Python, Java, Go, C++, PHP, Ruby, CSS, SCSS, and many more), multiple report formats (console, JSON, XML, CSV, Markdown, HTML), configurable detection thresholds (min-lines, min-tokens), glob pattern support for file selection, ignore patterns for excluding files/folders, .gitignore support, and code block ignore annotations using /* jscpd:ignore-start / and / jscpd:ignore-end */. It also offers badge generation for tracking copy-paste metrics and git blame integration.
Jscpd is designed for software developers, code reviewers, technical leads, and DevOps engineers who want to maintain code quality and reduce technical debt. It is widely used by projects like GitHub Super Linter, Mega-Linter, Codacy, and Code-Inspector for automated code duplication detection in CI/CD workflows.
Jscpd pricing
Pricing model: Freemium
Jscpd is completely free and open-source under the MIT license. There is no paid tier or subscription. The tool can be installed globally via npm with 'npm install -g jscpd' or used on-demand with 'npx jscpd'. Users can become backers or sponsors on Open Collective to support the project, but sponsorship is optional and does not unlock additional features.
Jscpd pros
- Supports 150+ programming languages and document formats
- Fast detection using Rabin-Karp algorithm
- Both CLI and programming API available
- Multiple report formats: console, JSON, XML, CSV, Markdown, HTML
- Configurable min-lines and min-tokens thresholds
- Glob pattern support for file selection
- Ignore patterns via .jscpd.json config file
- Respects .gitignore files with --gitignore flag
- Inline code ignore annotations with jscpd:ignore-start/end
- Badge reporter for copy-paste metrics tracking
- Git blame integration with --blame flag
- Open-source MIT license, completely free
- Programmatic API for custom integrations
- Multiple store options including LevelDB for large repos
- Threshold-based exit codes for CI/CD integration
- Verbose and debug modes for troubleshooting
- Absolute path output option for consistent reporting
Jscpd cons
- No built-in GUI, CLI-only interface
- Requires Node.js/npm installation
- LevelDB store slower than default store
- No automatic refactoring suggestions
- Case-insensitive detection is experimental only
- No cloud/SaaS hosted version available
- No visual diff view for duplicate code
- Large repositories may need manual tuning of thresholds
Frequently asked questions about Jscpd
What is jscpd?
Jscpd is a copy/paste detector for programming source code that supports 150+ formats. It finds duplicated code blocks using the Rabin-Karp algorithm and helps identify technical debt from copy-pasted code across JavaScript, TypeScript, Python, Java, Go, C++, PHP, Ruby, and many other languages.
How do I install jscpd?
Install jscpd globally using npm with the command 'npm install -g jscpd'. You can also use it without installing by running 'npx jscpd /path/to/source' which will temporarily download and run the tool.
What languages does jscpd support?
Jscpd supports 150+ programming languages and digital formats including JavaScript, TypeScript, Python, Java, C++, PHP, C#, Go, Ruby, C, CoffeeScript, Less, CSS, SCSS, HTML, Vue, and many more.
How do I ignore specific code blocks?
Use inline annotations to ignore code blocks: add /* jscpd:ignore-start / before the code you want to skip and / jscpd:ignore-end */ after it. This is useful for ignoring imports or specific functions.
What report formats does jscpd support?
Jscpd supports console, consoleFull, json, xml, csv, markdown, html, verbose, and badge reporters. Specify them with --reporters console,html,json or in your .jscpd.json config file.
How do I configure detection thresholds?
Use --min-lines and --min-tokens to set minimum duplication size, like 'jscpd --min-lines 5 --min-tokens 50'. Set --threshold to control the exit code percentage for CI/CD failure. These can also be configured in .jscpd.json.
Can I integrate jscpd into CI/CD pipelines?
Yes, jscpd is widely used in CI/CD workflows. It provides threshold-based exit codes, multiple machine-readable report formats (JSON, XML, CSV), and is integrated into GitHub Super Linter, Mega-Linter, Codacy, and Code-Inspector for automated code quality checks.
Is jscpd free to use?
Yes, jscpd is completely free and open-source under the MIT license. There are no paid plans or premium features. The project accepts optional voluntary contributions via Open Collective for backers and sponsors.