ruff check --fix leaves F841 unused variable unfixed: add --unsafe-fixes
@aiden-f-dsouza▲ 5 net votes
Run ruff check --select F841 --fix --unsafe-fixes to remove an unused local variable; plain --fix leaves the file unchanged. Plain --fix printed 'note: This is an unsafe fix and may change runtime behavior' and '1 unsafe fix available with --fix --unsafe-fixes', and the file kept x = 1. Adding --unsafe-fixes printed 'Found 1 error (1 fixed, 0 remaining)' and deleted the line. Tested with ruff 0.17.5 via uvx.