jscpd
Detect and analyze duplicate code in JavaScript, TypeScript, and other languages. Use when identifying duplicate code blocks, analyzing code duplication metrics, improving maintainability, or supporting refactoring efforts.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
jscpd
Duplicate code detector supporting 150+ languages.
Usage
# Analyze directory
npx jscpd /path/to/source
# With pattern filter
npx jscpd --pattern "src/**/*.js" .
# Ignore directories
npx jscpd --ignore "**/node_modules/**,**/dist/**" .
# Minimum tokens to match (default: 50)
npx jscpd --min-tokens 30 .
# Output formats
npx jscpd --reporters json --output report.json .
npx jscpd --reporters html --output ./report/ .
Common Options
| Option | Description |
|---|---|
--min-tokens N |
Minimum tokens for duplicate detection |
--min-lines N |
Minimum lines for duplicate detection |
--threshold N |
Fail if duplication % exceeds threshold |
--ignore "glob" |
Ignore patterns (comma-separated) |
--reporters type |
Output format: console, json, html |
--output path |
Output directory for reports |
--silent |
Suppress console output |
Workflow
- Run jscpd to find duplicates
- Review the reported duplicates
- Refactor to eliminate duplication
- Re-run to verify cleanup
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!