Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ruff linter as pre-commit hook #1501

Closed
Skylion007 opened this issue Jan 15, 2024 · 1 comment · Fixed by #1502
Closed

Add ruff linter as pre-commit hook #1501

Skylion007 opened this issue Jan 15, 2024 · 1 comment · Fixed by #1502

Comments

@Skylion007
Copy link
Contributor

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.

@martindurant
Copy link
Member

You are welcome to add it to pre-commit (the CI run) and see what it throws up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants