python-package-template icon indicating copy to clipboard operation
python-package-template copied to clipboard

feat(ci): add the ruff tool to the pre-commit checks

Open jenstroeger opened this issue 2 years ago • 3 comments

We have talked about ruff before, so this adds an initial setup to play around with. See also https://github.com/jenstroeger/python-package-template/issues/5#issuecomment-1521568770.

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.

jenstroeger avatar Aug 02 '23 20:08 jenstroeger

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

behnazh avatar Sep 02 '23 06:09 behnazh

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.

copdips avatar Nov 25 '23 21:11 copdips

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 avatar Nov 25 '23 22:11 jenstroeger