Ruff
Ruff is a fast linter and code formatter for Python that unifies linting and formatting in one CLI.
Installation and Setup
Ruff is available on PyPI and as a standalone installer. In macOS, it can also be installed from Homebrew:
Key Features
- Lints and formats with a single tool and offers a Black compatible formatter available as
ruff format. - Large built in ruleset that covers many flake8 plugins and common style checks.
- Very fast execution with caching and parallel analysis.
- Flexible configuration through
pyproject.toml,ruff.toml, or.ruff.toml. - Smooth integration with pre commit and GitHub Actions.
Usage
Lint the current directory:
Shell
$ ruff check .
Apply automatic fixes during linting:
Shell
$ ruff check . --fix
Format code:
Shell
$ ruff format .