Skip to content

feat: introduce the Ruff pre-commit hook to replace a bunch of other code formatters and linter hooks#593

Open
jenstroeger wants to merge 2 commits into
mainfrom
add-ruff
Open

feat: introduce the Ruff pre-commit hook to replace a bunch of other code formatters and linter hooks#593
jenstroeger wants to merge 2 commits into
mainfrom
add-ruff

Conversation

@jenstroeger

@jenstroeger jenstroeger commented Aug 2, 2023

Copy link
Copy Markdown
Owner

We have talked about ruff before, so this adds an initial setup to play around with. See also #5 (comment).

Even though ruff is supposed to be a drop-in replacement for Flake8 it doesn’t currently support all of the Flake8 plugins we use in this template. I guess for now we therefore keep flake8 around. The current ruff configuration is derived from the current .flake8 file, but we could consider expanding it.

@behnazh

behnazh commented Sep 2, 2023

Copy link
Copy Markdown
Collaborator

What are the additional checks that ruff offers, which would otherwise be missed by our checks?

@copdips

copdips commented Nov 25, 2023

Copy link
Copy Markdown

ruff could replace almost all the python linters for now, only thing that it can not do for the moment as per my experience, is the typing check, so we could combine ruff with mypy or pyright.

@jenstroeger

Copy link
Copy Markdown
Owner Author

I agree @copdips, and thank you for the comment!

The list of rules that ruff implements (based on a multitude of pylint and flake8 plugins) is huge, and if you want please feel free to contribute settings which at least meet the current settings of this repository, maybe even improve it. The important thing we’d like to avoid by adding ruff is to regress because we’ve dropped a few checks…

@jenstroeger

Copy link
Copy Markdown
Owner Author

Interestingly, git 2.54.0 improved its hooks (docs) so perhaps using ruff and with some massaging we can get rid of pre-commit entirely… 🤔

@jenstroeger jenstroeger changed the base branch from staging to main June 16, 2026 08:22
@jenstroeger jenstroeger marked this pull request as ready for review June 16, 2026 08:24
@jenstroeger jenstroeger requested a review from behnazh as a code owner June 16, 2026 08:24
@jenstroeger

Copy link
Copy Markdown
Owner Author

@behnazh I updated this PR with the latest version of ruff, but see also issue astral-sh/ruff#970. Still need to update the README and run a few more tests, but perhaps it‘s time to switch… 🤔

@jenstroeger jenstroeger changed the title feat(ci): add the ruff tool to the pre-commit checks feat: introduce the Ruff pre-commit hook to replace a bunch of other code formatters and linter hooks Jun 16, 2026
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 this pull request may close these issues.

3 participants