Include ruff format in `pre-commit`
I noticed that ruff formatting is not being done on commits. The pre-commit.yaml file is
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.1.11'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
According to ruff official docs they do not support (yet: A unified command for both linting and formatting is planned) formatting and linting in a single command. Running ruff format in the source code shows several files that must be formatted.
It makes it a bit difficult to create a PR if the code formatting is out of sync with the master
I am not too familiar with Ruff format, does it make changes on all the files or only those that have changes in the pre-commit? Also, feel free to open a PR for this, we would probably be happy to add this feature.
I am not too familiar with Ruff format, does it make changes on all the files or only those that have changes in the pre-commit? Also, feel free to open a PR for this, we would probably be happy to add this feature.
Happy to help with. The steps are:
- Add the format rule in the
pre-commit - The very first commit with this rule will format all the files that ruff finds that need formatting according to the rules defined in the
pyproject.toml. I ran it locally and there are several python files. - New commits will make formatting mandatory, done automatically by pre-commit