duplication-radar
v0.1.5
Published
Detect structural code duplication that individual Git diffs miss.
Maintainers
Readme
duplication-radar
Detect structural code duplication that individual Git diffs miss — the same logic under different names, files, or languages.
Usage
From inside the repo:
npx duplication-radar compare . <base> <head>Examples:
npx duplication-radar compare . main feature-branch
npx duplication-radar compare . main origin/feat/multi-gpu-select.— current repo (or a git URL forcompare)<base>— branch to compare against (e.g.main)<head>— branch under review (e.g.feature-branchororigin/feat/...)
Compare uncommitted work against a ref:
npx duplication-radar check . --base mainRequires Node.js >= 20 and git on your PATH.
Output
compare and check print a matches table by default: one row per PR unit (path::name), with each match on its own line in the second column. Long paths wrap at / or ::.
Meaningful duplication: YES
| PR code | Matched with |
|--------------------------------------|--------------------------------------|
| frontend/src/renderer/components/ | frontend/src/renderer/components/ |
| settings/ReportProblemDialog.tsx:: | settings/SettingsRow.tsx::InputRow |
| DiscordIcon | frontend/src/landing/.../Blog.tsx:: |
| | Block |Exit 0 if clean, 1 if meaningful duplication grew.
Flags
| Flag | Description |
|------|-------------|
| --json | Machine-readable CheckResult JSON |
| --full | Legacy cluster report (sections, deltas, cluster labels) |
| --verbose | With --full: include unchanged clusters |
What it scans
Source files for supported languages. Test code is skipped: test directories (tests/, __tests__/, src/test/, etc.) and conventional test filenames (*_test.go, *.test.ts, *.spec.ts, *Test.java, …).
Other commands
npx duplication-radar similar <repo> # list duplication clusters in a single snapshot
npx duplication-radar parse <repo> # debug: parsed units per fileLicense
MIT
