Fixes

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.

The safety model

Three guarantees keep the fixer safe:

Usage

# 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

Fix types

TargetDefaultFirst fix confidenceWhat 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, bfrom m import a).
exports medium off Unused public exports; respects __all__, protected without --force.
locals medium off Unused local functions/classes/variables.

Confidence thresholds

The --confidence flag sets the minimum confidence to fix:

Recommended workflow

# 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"
Warning: always review the dry-run output and run your tests after fixing. Medium/low-confidence fixes (exports, locals) can be wrong in code that uses reflection, dynamic dispatch, or plugin registration.