PragyaLint doesn't just report dead code — its --fix engine can
actually remove it. Fixes are confidence-gated and
explicit: nothing is modified unless you ask.
Three guarantees keep the fixer safe:
--fix.
__all__ (or otherwise re-exported) are never touched without
--force.
# Dry-run: preview changes (modifies nothing)
pragyalint --fix --dry-run
# Apply high-confidence fixes only (default)
pragyalint --fix
# Include medium-confidence fixes
pragyalint --fix exports --confidence medium+
# Include everything, overriding protected exports
pragyalint --fix all --confidence low+ --force
| Target | Default | First fix confidence | What it removes |
|---|---|---|---|
files |
high | on | Unreachable module files (never reaches entry points / __init__.py). |
imports |
high | on | Unused imports; trims unused names from multi-name imports (from m import a, b → from m import a). |
exports |
medium | off | Unused public exports; respects __all__, protected without --force. |
locals |
medium | off | Unused local functions/classes/variables. |
The --confidence flag sets the minimum confidence to fix:
high — only high (default)medium+ — medium and highlow+ — low, medium, and highall — everything# 1. Review what would be removed
pragyalint --fix all --confidence medium+ --dry-run
# 2. Apply just the high-confidence removals
pragyalint --fix
# 3. Run your test suite
pytest
# 4. Commit the changes
git add -A && git commit -m "chore: prune dead code"