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/console-leftover manual fix

Console leftover.

`console.log` (or `print`, in other languages) left in production code after debugging.

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 reconcile(orders: Order[]) {
  console.log('reconciling', orders.length)
  for (const o of orders) {
    console.log('processing', o.id, o)
    process(o)
  }
}
Why this trips

Deterministic AST match against debug-print calls (`console.log`, language equivalents) outside designated logging.

Clean example
function reconcile(orders: Order[]) {
  log.debug('reconciling', { count: orders.length })
  for (const o of orders) {
    process(o)
  }
}
What changed

Remove temporary debug output or replace it with the project's structured logger at the correct level. Include stable fields, not raw objects dumped from a debugging session.

Agents trace execution with console.log during a session and forget to remove them. The logs end up shipped — noisy, untyped, ungrep-able.

How this rule is justified.

Rule id

ai-slop/console-leftover

Enforcing engine

ai-slop

Detector strategy

Deterministic AST match against debug-print calls (`console.log`, language equivalents) outside designated logging.

Legitimate code that is NOT flagged

Calls through a structured logger, and console use inside CLI tools or test setup, are not flagged.

Evidence

Provenance: repeated across public scans as debug output left in production paths.