if (true) {
doStuff()
} else {
// never runs
fallback()
} Deterministic AST match: flags conditionals whose test evaluates to a compile-time constant.
An `if` or `while` whose condition is a constant — `if (true)`, `while (false)`, `if (1)` — leaving a dead branch in the source.
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.
if (true) {
doStuff()
} else {
// never runs
fallback()
} Deterministic AST match: flags conditionals whose test evaluates to a compile-time constant.
if (config.featureEnabled) {
doStuff()
} else {
fallback()
}
Remove hard-coded debug branches or replace them with real configuration. The condition should describe runtime behavior, not a temporary toggle that got left behind.
Agents leave debug toggles or temporary feature flags hard-coded after testing. Half the branch is unreachable; the reader has to figure out which half is real.
ai-slop/constant-condition
ai-slop
Deterministic AST match: flags conditionals whose test evaluates to a compile-time constant.
Intentional infinite loops (`while (true)` with a break) and constants resolved from real configuration are not flagged.
Provenance: repeated across public scans as a hard-coded debug toggle left behind.