Ruff¶
https://github.com/astral-sh/ruff
Ruff (flake8, PyLint) is a Python linting tool that checks your Python codebase for errors, styling issues and complexity.
caveat: avoid ruff to automatically fix your code - auto fix without review can be questionable or wrong.
disable E741¶
[tool.ruff.lint]
ignore = ["E741"] # ambiguous-variable-name: l (lowercase L), O (uppercase O), or I (uppercase I)
config file¶
[tool.ruff]
line-length = 88
target-version = "py310"
# Allow unused variables when underscore-prefixed
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E", "F"]
ignore = [
"E402", # Module level import not at top of file
]
# Allow autofix for all enabled rules (when `--fix`) is provided
fixable = ["ALL"]
unfixable = []
double quotes¶
black forces double quotes, no option to choose
ruff is faster, together with linter, and >99.9% black-compatible style
use ruff is possible
Shift + Alt + F
In settings.json make the changes:
Settings in pyproject.toml