ai-slop/unreachable-code manual fix
Unreachable code.
Code after a `return`, `throw`, `break`, or `continue` that can never execute.
Bad — what an agent ships
function getStatus(order: Order): string {
if (order.cancelled) {
return 'cancelled'
log.info('cancelled order seen') // never runs
}
return order.status
} Good — what aislop hands back
function getStatus(order: Order): string {
if (order.cancelled) {
log.info('cancelled order seen', { id: order.id })
return 'cancelled'
}
return order.status
} Why an AI agent produces this
When agents refactor control flow they sometimes leave statements stranded after a return. The code looks like it does something; it does nothing.
Provenance
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.