Skip to main content
New aislop v0.13.1 patch — calibrates hidden-fallback detection and fixes regex comment-masker false positives. Read the changelog →
ai-slop/unreachable-code manual fix

Unreachable code.

Code after a `return`, `throw`, `break`, or `continue` that can never execute.

Flagged shape and clean shape.

Each example shows the exact code shape the rule is looking for, then the smallest version that keeps the intent without hiding risk or adding noise.

Flagged example
function getStatus(order: Order): string {
  if (order.cancelled) {
    return 'cancelled'
    log.info('cancelled order seen') // never runs
  }
  return order.status
}
Why this trips

Deterministic control-flow analysis: flags statements following an unconditional terminator in the same block.

Clean example
function getStatus(order: Order): string {
  if (order.cancelled) {
    log.info('cancelled order seen', { id: order.id })
    return 'cancelled'
  }
  return order.status
}
What changed

Move work before the terminating statement or delete it. If the statement should run only on a branch, restructure the branch so control flow matches what the code visually promises.

When agents refactor control flow they sometimes leave statements stranded after a return. The code looks like it does something; it does nothing.

How this rule is justified.

Rule id

ai-slop/unreachable-code

Enforcing engine

ai-slop

Detector strategy

Deterministic control-flow analysis: flags statements following an unconditional terminator in the same block.

Legitimate code that is NOT flagged

Code after a conditional return, and statements reachable through any branch, are not flagged.

Evidence

Provenance: repeated across public scans as a control-flow refactor artifact.