slop/debug-output
No debug prints outside tests
| Severity | info |
| Tiers | all |
| Stacks | any |
| Scope | root |
| Kind | expr |
| Source | library v0.5.0 |
| Selected by | fleetlint-slop@v0.5.0 |
Requirement
Non-test code writes through the logger or the program’s output layer, not through raw print calls (print(, console.log(, fmt.Print, System.out.print, Console.WriteLine(, var_dump(), and carries no debugger statements (debugger, binding.pry, byebug).
Why
Raw prints cannot be levelled, redacted or switched off, and they leak into the output of anything that embeds the code.
Check
For each item in:
codegrep("nontest", r'(^|[^.\w])print\(|\bconsole\.(log|debug|info)\(|(^|[^.\w])println!?\(|\bfmt\.Print|\bdebugPrint\(|\bdbg!\(|\bSystem\.(out|err)\.print|\bConsole\.Write(Line)?\(|\b(var_dump|print_r)\(|\bbinding\.pry\b|^\s*byebug\b|^\s*debugger;?\s*$')falseFix
Use the logger; for a CLI, the output stream the command was given.
Agent instruction: Replace with the project’s logger or output writer; delete prints and debugger statements that are debugging leftovers.
Sources
- https://docs.astral.sh/ruff/rules/print/ (check, T201)
- https://eslint.org/docs/latest/rules/no-console (check, no-console)
- https://eslint.org/docs/latest/rules/no-debugger (check, no-debugger)
- https://docs.rubocop.org/rubocop/latest/cops_lint.html (check, Lint/Debugger)
- https://rust-lang.github.io/rust-clippy/master/index.html (check, dbg_macro)
- https://fleetlint.org/baseline/#slop
- https://fleetlint.org/slop/#errors-types-and-robustness
Generated by fleetlint docs from catalog v0.5.0.