Debug leftovers: debugger, breakpoint(), print("here"), print(f"{x=}"), dbg!
Code nobody needs: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as debug-leftover.
What makes debug leftovers a bad practice?
The standards that call it a bad practice: CWE-489 Active Debug Code; ESLint no-debugger; Sonar S4507; clippy dbg_macro.
What does lessloc do about debug leftovers?
lessloc catches it as debug-leftover. It is judged at turn end, because mid-work the print may still be in use.
debug-leftover(tier 1):debugger,breakpoint(),pdb.set_trace(), or a debug print such asprint("here"). Judged when the turn ends.
Examples
Caught as debug-leftover:
js
export function total(xs) {
debugger;
console.log("here");
return xs.length;
}Written well:
js
export function total(xs) {
console.log(`total of ${xs.length} items`);
return xs.length;
}Caught as debug-leftover:
python
def total(xs):
breakpoint()
print(f"{xs=}")
return len(xs)Written well:
python
def total(xs):
print(f"{len(xs)} items")
return len(xs)Related patterns
The other patterns in Code nobody needs:
- Options, flags, parameters or config for needs nobody named: lessloc gives every session a rule against it and catches it as
mode-flag. - An interface or abstract class with one implementation: lessloc catches it as
single-impl. - Wrappers that only forward; barrel files that only re-export: lessloc catches it as
wrapper. - A new function or import that nothing calls or tests: lessloc catches it as
unused(ruff adds unused variables). - Obsolete code kept behind a guard or flag instead of deleted: lessloc gives every session the rule: delete what the change makes dead.
- Tombstones: lessloc catches it as
history. - Stubs and fake success: lessloc catches it as
stub; it asks to finish the code or to tell the user what is not real yet. - Placeholders: # ... existing code ..., "your code here": lessloc catches it as
placeholderand refuses it before it lands. - Commented-out code: lessloc catches it as
commented-outand refuses it before it lands. - A demo __main__ block or demo folder nobody asked for: lessloc catches it as
demo-codeandnew-folder. - Hand-written boilerplate a language feature writes: lessloc catches it as
simpler. - A one-line helper used once: lessloc catches it as
single-use. - TODO and FIXME left behind: lessloc catches it as
todo; it asks to finish the work, or to record known debt asshortcut:and tell the user.

