Why this matters
Reduces noise and cognitive load, prevents accidental side effects and speeds up tooling.
Delete imports and locals that are not referenced; prefer tooling (ruff/flake8/mypy) to enforce.
Reduces noise and cognitive load, prevents accidental side effects and speeds up tooling.
Side-by-side examples engineers can pattern-match during review.
import os, sys # sys unused
x = 42 # never readimport os
# removed unused imports/variablesfrom math import sqrt # unusedfrom math import sqrt; print(sqrt(4))From the same buckets as this rule.