Skip to content

Commit 0458e5a

Browse files
committed
Order config validators before ruff in pre-commit
Ruff loads its config from pyproject.toml, so a malformed pyproject.toml makes ruff abort with a parser error instead of the clean check-toml message. Running check-toml/check-yaml first (with fail_fast) ensures syntax errors are reported by the dedicated validator, consistently between local commits and CI's --all-files run. Signed-off-by: aviv ron <rona@il.ibm.com>
1 parent ea864f7 commit 0458e5a

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

.pre-commit-config.yaml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ fail_fast: true
44
# The two DCO hooks override this with their own explicit `stages:`.
55
default_stages: [pre-commit]
66
repos:
7+
# Config-file validators run first: ruff loads its config from pyproject.toml,
8+
# so a malformed pyproject.toml makes ruff itself abort with a parser error
9+
# instead of the clean check-toml message. With fail_fast, running check-toml /
10+
# check-yaml before ruff means syntax errors are reported by the validator that
11+
# exists for that purpose, consistently between local commits and CI --all-files.
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v5.0.0
14+
hooks:
15+
- id: check-toml
16+
- id: check-yaml
17+
- id: check-merge-conflict
18+
- id: check-added-large-files
19+
args: [--maxkb=500]
20+
- id: check-case-conflict
21+
- id: mixed-line-ending
22+
args: [--fix=lf]
23+
- id: end-of-file-fixer
24+
exclude: \.ipynb$
25+
- id: trailing-whitespace
26+
exclude: \.ipynb$
27+
728
- repo: https://github.com/astral-sh/ruff-pre-commit
829
rev: v0.9.0
930
hooks:
@@ -42,22 +63,6 @@ repos:
4263
always_run: true
4364
files: \.(ipynb|md|py)$
4465

45-
- repo: https://github.com/pre-commit/pre-commit-hooks
46-
rev: v5.0.0
47-
hooks:
48-
- id: check-toml
49-
- id: check-yaml
50-
- id: check-merge-conflict
51-
- id: check-added-large-files
52-
args: [--maxkb=500]
53-
- id: check-case-conflict
54-
- id: mixed-line-ending
55-
args: [--fix=lf]
56-
- id: end-of-file-fixer
57-
exclude: \.ipynb$
58-
- id: trailing-whitespace
59-
exclude: \.ipynb$
60-
6166
- repo: https://github.com/kynan/nbstripout
6267
rev: 0.8.1
6368
hooks:

0 commit comments

Comments
 (0)