Skip to content

Add ruff linter as pre-commit hook #1501

@Skylion007

Description

@Skylion007

Ruff is a linter that replaces autoflake, isort, black, and many other common pre-commit tools. It implements most of the rules in FLAKE8 currently and main of the flake8 plugins that you may want to enable for this project. It's also 10-100X faster than running flake8. The most useful feature however is that it can autofix many simple rule violations and suggest fixes for rules where it is not sure.

I'd recommend add it as an additional pre-commit hook and gradually adding rules to it: https://docs.astral.sh/ruff/rules/ . This is how I caught #1499 for instance. You may be interested in the https://docs.astral.sh/ruff/rules/#flake8-logging-format-g rules for instance to ensure the logger doesn't add any accidental overhead. The PERF, C4, ASYNC, and other rules may also be useful to use for the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions