Detect duplicate code before merge.
See how duplicate code fits local review, which evidence Code Radar produces, where coverage ends, and how trusted findings move into CI.
radar scan . --quickWhat duplicate code means here.
The duplicate code rule identifies review patterns that can create exploitable behavior or hide material maintenance risk, then returns the affected location, severity, confidence, and remediation context.
Evidence to inspect
Use “Detect duplicate code before merge.” as the scope for this decision: verify the input, finding detail, workflow handoff, and product boundary before you install or buy.
Check this risk locally
Coverage and concrete signals
Detect copied validation or business logic that increases review and repair cost.
- Audience: Developers and reviewers deciding how to handle duplicate code findings before merge.
- Evidence to inspect before you trust the result.: Compare the repeated locations, the shared behavior, and the smallest extraction that preserves validation or business rules.
- Boundary: Generated code, fixtures, and deliberately separate adapters can be intentional duplicates; document that context before suppressing and refactor only when behavior is shared.
- Rule ID: RADAR-HEALTH-DUPLICATE
Risky pattern / Safer pattern
duplicate code: A useful result must be explainable to a developer and portable to the next review surface. Inspect the concrete evidence below before changing team policy.
From local signal to shared gate.
duplicate code: Use the smallest workflow that proves value. Each later step should reuse evidence the team already understands. Compare the repeated locations, the shared behavior, and the smallest extraction that preserves validation or business rules.
radar scan . --quick
radar scan . --format sarif --fail-on highPrimary sources
Validate the workflow on your own code.
Apply this page’s evidence to one real repository. For “Detect duplicate code before merge.”, confirm which finding is produced, whether the proposed next step is reproducible, and where local scanning, reports, agents, or CI should stop or expand.