{"id":13453709,"url":"https://github.com/kucherenko/jscpd","last_synced_at":"2025-05-12T05:32:44.135Z","repository":{"id":8690848,"uuid":"10353211","full_name":"kucherenko/jscpd","owner":"kucherenko","description":"Copy/paste detector for programming source code.","archived":false,"fork":false,"pushed_at":"2025-05-11T11:07:50.000Z","size":9575,"stargazers_count":4866,"open_issues_count":74,"forks_count":211,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-05-12T02:46:41.934Z","etag":null,"topics":["clones-detection","code-quality","copy-paste","cpd","detect-duplications","detector","duplicates","duplications","quality"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kucherenko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"supported_formats.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"jscpd"}},"created_at":"2013-05-29T06:19:20.000Z","updated_at":"2025-05-11T20:51:23.000Z","dependencies_parsed_at":"2023-02-13T14:01:10.306Z","dependency_job_id":"e7bc1834-1822-4e64-ad97-05d776254273","html_url":"https://github.com/kucherenko/jscpd","commit_stats":{"total_commits":900,"total_committers":66,"mean_commits":"13.636363636363637","dds":0.5777777777777777,"last_synced_commit":"c1f369912bb77b67f029bf396fb36c94f5f772d0"},"previous_names":[],"tags_count":112,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kucherenko%2Fjscpd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kucherenko%2Fjscpd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kucherenko%2Fjscpd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kucherenko%2Fjscpd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kucherenko","download_url":"https://codeload.github.com/kucherenko/jscpd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253672735,"owners_count":21945482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clones-detection","code-quality","copy-paste","cpd","detect-duplications","detector","duplicates","duplications","quality"],"created_at":"2024-07-31T08:00:45.823Z","updated_at":"2025-05-12T05:32:44.097Z","avatar_url":"https://github.com/kucherenko.png","language":"TypeScript","funding_links":["https://opencollective.com/jscpd"],"categories":["Packages","TypeScript","包","Supported Linters","code-quality","目录","Command-line apps",":wrench: JS/TS Tooling","ai","Dev Tools (29)","🤖 AI \u0026 Machine Learning","\u003e 5K ⭐️"],"sub_categories":["Command-line apps","命令行程序","命令行应用","React"],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/kucherenko/jscpd/master/assets/logo.svg?sanitize=true\"\u003e\n\u003c/p\u003e\n\n## jscpd\n\n![stand with Ukraine](https://badgen.net/badge/support/UKRAINE/?color=0057B8\u0026labelColor=FFD700)\n\n[![npm](https://img.shields.io/npm/v/jscpd.svg?style=flat-square)](https://www.npmjs.com/package/jscpd)\n![jscpd](https://raw.githubusercontent.com/kucherenko/jscpd/master/assets/jscpd-badge.svg?sanitize=true)\n[![license](https://img.shields.io/github/license/kucherenko/jscpd.svg?style=flat-square)](https://github.com/kucherenko/jscpd/blob/master/LICENSE)\n[![npm](https://img.shields.io/npm/dw/jscpd.svg?style=flat-square)](https://www.npmjs.com/package/jscpd)\n\n\n[![jscpd CI](https://github.com/kucherenko/jscpd/actions/workflows/nodejs.yml/badge.svg)](https://github.com/kucherenko/jscpd/actions/workflows/nodejs.yml)\n[![codecov](https://codecov.io/gh/kucherenko/jscpd/branch/master/graph/badge.svg)](https://codecov.io/gh/kucherenko/jscpd)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fkucherenko%2Fjscpd.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkucherenko%2Fjscpd?ref=badge_shield)\n[![Backers on Open Collective](https://opencollective.com/jscpd/backers/badge.svg)](#backers)\n[![Sponsors on Open Collective](https://opencollective.com/jscpd/sponsors/badge.svg)](#sponsors)\n\n[![NPM](https://nodei.co/npm/jscpd.svg)](https://nodei.co/npm/jscpd/)\n\n\u003e Copy/paste detector for programming source code, supports 150+ formats.\n\nCopy/paste is a common technical debt on a lot of projects. The jscpd gives the ability to find duplicated blocks implemented on more than 150 programming languages and digital formats of documents.\nThe jscpd tool implements [Rabin-Karp](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm) algorithm for searching duplications.\n\n## Packages of jscpd\n\n| name                 | version  |  description  |\n|----------------------|----------|---------------|\n| [jscpd](apps/jscpd) | [![npm](https://img.shields.io/npm/v/jscpd.svg?style=flat-square)](https://www.npmjs.com/package/jscpd) | main package for jscpd (cli and API for detections included) |\n| [@jscpd/core](packages/core) | [![npm](https://img.shields.io/npm/v/@jscpd/core.svg?style=flat-square)](https://www.npmjs.com/package/@jscpd/core) |core detection algorithm, can be used for detect duplication in different environments, one dependency to eventemitter3 |\n| [@jscpd/finder](packages/finder) | [![npm](https://img.shields.io/npm/v/@jscpd/finder.svg?style=flat-square)](https://www.npmjs.com/package/@jscpd/finder) | detector of duplication in files  |\n| [@jscpd/tokenizer](packages/tokenizer) | [![npm](https://img.shields.io/npm/v/@jscpd/tokenizer.svg?style=flat-square)](https://www.npmjs.com/package/@jscpd/tokenizer) | tool for tokenize programming source code |\n| [@jscpd/leveldb-store](packages/leveldb-store) | [![npm](https://img.shields.io/npm/v/@jscpd/leveldb-store.svg?style=flat-square)](https://www.npmjs.com/package/@jscpd/leveldb-store) | LevelDB store, used for big repositories, slower than default store |\n| [@jscpd/html-reporter](packages/html-reporter) | [![npm](https://img.shields.io/npm/v/@jscpd/html-reporter.svg?style=flat-square)](https://www.npmjs.com/package/@jscpd/html-reporter) | Html reporter for jscpd |\n| [@jscpd/badge-reporter](packages/badge-reporter) | [![npm](https://img.shields.io/npm/v/@jscpd/badge-reporter.svg?style=flat-square)](https://www.npmjs.com/package/@jscpd/badge-reporter) | Badge reporter for jscpd |\n\n## Installation\n```bash\n$ npm install -g jscpd\n```\n## Usage\n```bash\n$ npx jscpd /path/to/source\n```\nor\n\n```bash\n$ jscpd /path/to/code\n```\nor\n\n```bash\n$ jscpd --pattern \"src/**/*.js\"\n```\nMore information about cli [here](apps/jscpd).\n\n## Programming API\n\nFor integration copy/paste detection to your application you can use programming API:\n\n`jscpd` Promise API\n```typescript\nimport {IClone} from '@jscpd/core';\nimport {jscpd} from 'jscpd';\n\nconst clones: Promise\u003cIClone[]\u003e = jscpd(process.argv);\n```\n\n`jscpd` async/await API\n```typescript\nimport {IClone} from '@jscpd/core';\nimport {jscpd} from 'jscpd';\n(async () =\u003e {\n  const clones: IClone[] = await jscpd(['', '', __dirname + '/../fixtures', '-m', 'weak', '--silent']);\n  console.log(clones);\n})();\n\n```\n\n`detectClones` API\n```typescript\nimport {detectClones} from \"jscpd\";\n\n(async () =\u003e {\n  const clones = await detectClones({\n    path: [\n      __dirname + '/../fixtures'\n    ],\n    silent: true\n  });\n  console.log(clones);\n})()\n```\n\n`detectClones` with persist store\n```typescript\nimport {detectClones} from \"jscpd\";\nimport {IMapFrame, MemoryStore} from \"@jscpd/core\";\n\n(async () =\u003e {\n  const store = new MemoryStore\u003cIMapFrame\u003e();\n\n  await detectClones({\n    path: [\n      __dirname + '/../fixtures'\n    ],\n  }, store);\n\n  await detectClones({\n    path: [\n      __dirname + '/../fixtures'\n    ],\n    silent: true\n  }, store);\n})()\n```\n\nIn case of deep customisation of detection process you can build your own tool with `@jscpd/core`, `@jscpd/finder` and `@jscpd/tokenizer`.\n\n## Start contribution\n\n - Fork the repo [kucherenko/jscpd](https://github.com/kucherenko/jscpd/)\n - Clone forked version (`git clone https://github.com/{your-id}/jscpd`)\n - Install dependencies (`pnpm install`)\n - Run the project in dev mode: `pnpm dev` (watch changes and rebuild the packages)\n - Add your changes\n - Add tests and check it with `pnpm test`\n - Build your project `pnpm build`\n - Create PR\n\n## Who uses jscpd\n - [GitHub Super Linter](https://github.com/github/super-linter) is combination of multiple linters to install as a GitHub Action\n - [Code-Inspector](https://www.code-inspector.com/) is a code analysis and technical debt management service.\n - [Mega-Linter](https://nvuillam.github.io/mega-linter/) is a 100% open-source linters aggregator for CI (GitHub Action \u0026 other CI tools) or to run locally\n - [Codacy](http://docs.codacy.com/getting-started/supported-languages-and-tools/) automatically analyzes your source code and identifies issues as you go, helping you develop software more efficiently with fewer issues down the line.\n - [Natural](https://github.com/NaturalNode/natural) is a general natural language facility for nodejs. It offers a broad range of functionalities for natural language processing.\n\n\n## Backers\n\nThank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/jscpd#backer)]\n\n\u003ca href=\"https://opencollective.com/jscpd#backers\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/backers.svg?width=890\"\u003e\u003c/a\u003e\n## Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/jscpd#sponsor)]\n\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/0/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/0/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/1/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/1/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/2/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/2/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/3/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/3/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/4/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/4/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/5/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/5/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/6/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/6/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/7/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/7/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/8/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/8/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/jscpd/sponsor/9/website\" target=\"_blank\"\u003e\u003cimg src=\"https://opencollective.com/jscpd/sponsor/9/avatar.svg\"\u003e\u003c/a\u003e\n\n![ga tracker](https://www.google-analytics.com/collect?v=1\u0026a=257770996\u0026t=pageview\u0026dl=https%3A%2F%2Fgithub.com%2Fkucherenko%2Fjscpd\u0026ul=en-us\u0026de=UTF-8\u0026cid=978224512.1377738459\u0026tid=UA-730549-17\u0026z=887657232 \"ga tracker\")\n\n## License\n\n[MIT](LICENSE) © Andrey Kucherenko\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkucherenko%2Fjscpd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkucherenko%2Fjscpd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkucherenko%2Fjscpd/lists"}