Ruff
What is Ruff?
Per Ruff's official documentation:
Ruff aims to be orders of magnitude faster than alternative tools while integrating more functionality behind a single, common interface. Ruff can be used to replace Flake8 (plus dozens of plugins), isort, pydocstyle, yesqa, eradicate, pyupgrade, and autoflake, all while executing tens or hundreds of times faster than any individual tool.
This quote highlights the performance benefits of using Ruff over alternative Python linters. By integrating multiple linting rules behind a single interface, Ruff is able to provide a more efficient and streamlined development experience. Additionally, Ruff's speed allows it to execute multiple linting rules much faster than traditional tools, making it a powerful option for large-scale development projects.
Configuration
Ruff is configured via pyproject.toml
file inside the backend
package.
To learn how to configure Ruff on your own and customize the config file, please refer to Ruff's Configuration docs section.
The following rules are configured out-of-the-box:
Rules that are ignored:
S101
- Use of assert detectedA003
- Class attribute {name} is shadowing a python builtinS105
- Possible hardcoded password: "{}"SIM105
- Use contextlib.suppress({exception}) instead of try-except-passA002
- Argument {name} is shadowing a python builtinB904
- Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handlingPLR0913
- Too many arguments to function call ({c_args} > {max_args})