Skip to content

Commit def6289

Browse files
committed
feat(ci): add the ruff tool to the pre-commit checks
1 parent 77bac8b commit def6289

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ repos:
5353
files: ^src/package/|^tests/
5454
args: [--py310-plus]
5555

56+
57+
# Ruff is a fast superset of pylint and selection of various flake8 plugins.
58+
- repo: https://github.com/astral-sh/ruff-pre-commit
59+
rev: v0.0.282
60+
hooks:
61+
- id: ruff
62+
name: Ruff code
63+
args: [--fix, --exit-non-zero-on-fix]
64+
5665
# Similar to pylint, with a few more/different checks. For more available
5766
# extensions: https://github.com/DmytroLitvinov/awesome-flake8-extensions
5867
- repo: https://github.com/pycqa/flake8

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ dist-clean:
228228
rm -fr dist/*
229229
rm -f requirements.txt
230230
clean: dist-clean
231-
rm -fr .coverage .hypothesis/ .mypy_cache/ .pytest_cache/
231+
rm -fr .coverage .hypothesis/ .mypy_cache/ .pytest_cache/ .ruff_cache/
232232
rm -fr docs/_build/
233233

234234
# Remove code caches, or the entire virtual environment.

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,14 @@ filterwarnings = [
216216
"error::pytest.PytestUnraisableExceptionWarning",
217217
"error::pytest.PytestUnhandledThreadExceptionWarning",
218218
]
219+
220+
221+
# https://beta.ruff.rs/docs/configuration/
222+
# https://beta.ruff.rs/docs/rules/
223+
# https://beta.ruff.rs/docs/settings/
224+
[tool.ruff]
225+
src = ["src/package/", "test/"]
226+
select = ["E", "F", "B", "Q"]
227+
ignore = ["E501"]
228+
line-length = 120
229+
target-version = "py310"

0 commit comments

Comments
 (0)