How do I fix only specific rule violations in ruff
?
For example, I need to fix only rule F401
.
To fix only specific rule violations using ruff, use:
ruff check --select rule_name --fix
To fix only rule F401
, for all Python files in the current directory and all its subdirectories:
ruff check --select F401 --fix
Same, in a specific file:
ruff check --select F401 --fix path/to/file