feat(ci): add the ruff tool to the pre-commit checks
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.
What are the additional checks that ruff offers, which would otherwise be missed by our checks?
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.
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…