redline
MediumDesignduplicate-block

Duplicated block

Duplicated block. These lines repeat lines 12-19 in src/orders/validate.ts. Two copies drift apart; keep one.

This is how the comment reads inline, under the flagged line.

Why it matters

Copy-pasted code drifts: a fix lands in one copy and not the other. Models duplicate rather than find the existing helper.

What to do

Keep one copy and call it from both places, or delete the old one if this replaces it.

Examples

Flagged
// a.ts and b.ts both carry the same 12-line validation
Better
// both call validateOrder() from orders/validate.ts

What it catches

It reads the whole change: every file and the lines it removed. Languages: TypeScript and JavaScript, Python, Go, Rust, Java, C and similar. Scope: Shipped code only. These cases are the rule's own tests: the first set must be flagged and the second must not.

Research

Copy-pasted blocks. A fix lands in one copy and not the other.

Turn it off or change it

In a config file for the CLI, or in the API's rules field:

{
  "rules": {
    "disable": [
      "duplicate-block"
    ],
    "severity": {
      "duplicate-block": "low"
    }
  }
}

Read the source or report a false positive.