Skip to content

ALL-CONT0003 · debug_artifact_left_behind

Count console prints and debugger breakpoints left behind in ordinary code.

This is a deterministic rule for all languages. Read its implementation.

Report a call or a statement naming a debug artifact inside a declaration that is neither a test nor a command line entry point. print in Python, println! and dbg! in Rust, console.log in TypeScript, and printf in C are the same artifact under five spellings, and so are breakpoint, debugger, and set_trace.

The cost is real in both directions. A print writes to a stream nobody configured, so it cannot be filtered, routed, or turned off the way a logger can, and it follows the code into production where it slows a hot path and can leak whatever the developer was inspecting. A breakpoint is worse, since it stops a program that has no terminal attached and hangs it.

Each finding names the declaration, the artifact, and the line. The value is the number of artifacts left behind.

A file whose path holds a segment such as tests, cli, bin, or main is where writing to the console is the job, so nothing there is reported. Path segments are read whole, which keeps a module named bindings out of the bin exemption. A logger call is never an artifact, since a project that configured one already decided where its output goes. A name a frontend resolved is trusted as it stands, and only a bare macro or keyword falls back to reading text, where a matching word inside a string or a comment on the same line can be read as a call. exempt_segments is that list of path segments and artifacts is the list of debug names, so a project with its own console wrapper or its own script directory states them rather than living with the defaults.

def charge(order):
print(order.card)
breakpoint()
return gateway.charge(order)
def charge(order):
logger.debug("charging %s", order.id)
return gateway.charge(order)
  • Generalizes Ruff T201 print
  • Generalizes Ruff T100 debugger
  • Generalizes Clippy dbg_macro
  • Generalizes Clippy print_stdout. Open reference
  • Generalizes ESLint no-console
  • Generalizes ESLint no-debugger. Open reference