Skip to content

Commit 6c9e16e

Browse files
🔧 Reconfigure prek priorities (backport #1657) (#1697)
## Description This PR reconfigures the `prek` priorities to ensure that no two hooks write at the same time. ## Checklist - [x] The pull request only contains commits that are focused and relevant to this change. - [x] ~~I have added appropriate tests that cover the new/changed functionality.~~ - [x] ~~I have updated the documentation to reflect these changes.~~ - [x] ~~I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.~~ - [x] ~~I have added migration instructions to the upgrade guide (if needed).~~ - [x] The changes follow the project's style guidelines and introduce no new warnings. - [x] The changes are fully tested and pass the CI checks. - [x] I have reviewed my own code changes. (cherry picked from commit 6959a5e) Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
1 parent 2711b56 commit 6c9e16e

2 files changed

Lines changed: 55 additions & 61 deletions

File tree

.license-tools-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@
3535
"uv\\.lock",
3636
"py\\.typed",
3737
".*build.*",
38-
"LICENSE"
38+
"(^|/)LICENSE$"
3939
]
4040
}

.pre-commit-config.yaml

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ ci:
1515
skip: [ty-check]
1616

1717
repos:
18-
# Priority 0: Fast validation and independent fixers
19-
2018
## Standard hooks
2119
- repo: https://github.com/pre-commit/pre-commit-hooks
2220
rev: v6.0.0
@@ -26,14 +24,7 @@ repos:
2624
- id: end-of-file-fixer
2725
priority: 1
2826
- id: trailing-whitespace
29-
priority: 1
30-
31-
## Check the pyproject.toml file
32-
- repo: https://github.com/henryiii/validate-pyproject-schema-store
33-
rev: 2026.04.11
34-
hooks:
35-
- id: validate-pyproject
36-
priority: 0
27+
priority: 2
3728

3829
## Check JSON schemata
3930
- repo: https://github.com/python-jsonschema/check-jsonschema
@@ -44,7 +35,29 @@ repos:
4435
- id: check-readthedocs
4536
priority: 0
4637

47-
## Catch common capitalization mistakes
38+
## Check best practices for scientific Python code
39+
- repo: https://github.com/scientific-python/cookie
40+
rev: 2026.04.04
41+
hooks:
42+
- id: sp-repo-review
43+
additional_dependencies: ["repo-review[cli]"]
44+
priority: 0
45+
46+
## Check pyproject.toml file
47+
- repo: https://github.com/henryiii/validate-pyproject-schema-store
48+
rev: 2026.04.11
49+
hooks:
50+
- id: validate-pyproject
51+
priority: 0
52+
53+
## Ensure uv.lock is up to date
54+
- repo: https://github.com/astral-sh/uv-pre-commit
55+
rev: 0.11.6
56+
hooks:
57+
- id: uv-lock
58+
priority: 0
59+
60+
## Check for common capitalization mistakes
4861
- repo: local
4962
hooks:
5063
- id: disallow-caps
@@ -54,36 +67,21 @@ repos:
5467
exclude: ^(\.pre-commit-config\.yaml)$
5568
priority: 0
5669

57-
## Check for spelling
70+
## Check for typos
5871
- repo: https://github.com/adhtruong/mirrors-typos
5972
rev: v1.45.0
6073
hooks:
6174
- id: typos
62-
priority: 0
63-
64-
## Check best practices for scientific Python code
65-
- repo: https://github.com/scientific-python/cookie
66-
rev: 2026.04.04
67-
hooks:
68-
- id: sp-repo-review
69-
additional_dependencies: ["repo-review[cli]"]
70-
priority: 0
75+
priority: 3
7176

72-
## Check for license headers
77+
## Check license headers
7378
- repo: https://github.com/emzeat/mz-lictools
7479
rev: v2.9.0
7580
hooks:
7681
- id: license-tools
77-
priority: 0
78-
79-
## Ensure uv lock file is up-to-date
80-
- repo: https://github.com/astral-sh/uv-pre-commit
81-
rev: 0.11.6
82-
hooks:
83-
- id: uv-lock
84-
priority: 0
82+
priority: 4
8583

86-
## Tidy up BibTeX files
84+
## Format BibTeX files with bibtex-tidy
8785
- repo: https://github.com/FlamingTempura/bibtex-tidy
8886
rev: v1.14.0
8987
hooks:
@@ -100,55 +98,51 @@ repos:
10098
"--trailing-commas",
10199
"--remove-empty-fields",
102100
]
103-
priority: 0
104-
105-
# Priority 1: Second-pass fixers
101+
priority: 5
106102

107-
## Format C++ files with clang-format
108-
- repo: https://github.com/pre-commit/mirrors-clang-format
109-
rev: v22.1.3
103+
## Format configuration files with prettier
104+
- repo: https://github.com/rbubley/mirrors-prettier
105+
rev: v3.8.2
110106
hooks:
111-
- id: clang-format
112-
types_or: [c++, c, cuda]
113-
priority: 1
114-
- id: clang-format
115-
name: clang-format (TableGen)
116-
types_or: [file]
117-
files: \.td$
118-
priority: 1
107+
- id: prettier
108+
types_or: [yaml, markdown, html, css, scss, javascript, json, json5]
109+
priority: 5
119110

120-
## Format the CMakeLists.txt files
111+
## Format CMake files with cmake-format
121112
- repo: https://github.com/cheshirekow/cmake-format-precommit
122113
rev: v0.6.13
123114
hooks:
124115
- id: cmake-format
125116
additional_dependencies: [pyyaml]
126117
types: [file]
127118
files: (\.cmake|CMakeLists.txt)(.in)?$
128-
priority: 1
119+
priority: 5
129120

130-
## Format configuration files with prettier
131-
- repo: https://github.com/rbubley/mirrors-prettier
132-
rev: v3.8.2
121+
## Format C++ files with clang-format
122+
- repo: https://github.com/pre-commit/mirrors-clang-format
123+
rev: v22.1.3
133124
hooks:
134-
- id: prettier
135-
types_or: [yaml, markdown, html, css, scss, javascript, json, json5]
136-
priority: 1
125+
- id: clang-format
126+
types_or: [c++, c, cuda]
127+
priority: 5
128+
- id: clang-format
129+
name: clang-format (TableGen)
130+
types_or: [file]
131+
files: \.td$
132+
priority: 5
137133

138-
## Python linting using ruff
134+
## Format and lint Python files with ruff
139135
- repo: https://github.com/astral-sh/ruff-pre-commit
140136
rev: v0.15.10
141137
hooks:
142138
- id: ruff-format
143139
types_or: [python, pyi, jupyter, markdown]
144-
priority: 1
140+
priority: 6
145141
- id: ruff-check
146142
require_serial: true
147-
priority: 2
143+
priority: 7
148144

149-
# Priority 2+: Final checks and fixers
150-
151-
## Static type checking using ty (needs to run after lockfile update/ruff format, and ruff lint)
145+
## Check Python types with ty
152146
- repo: local
153147
hooks:
154148
- id: ty-check
@@ -159,4 +153,4 @@ repos:
159153
types_or: [python, pyi, jupyter]
160154
exclude: ^(docs/|mlir/|eval/)
161155
pass_filenames: false
162-
priority: 3
156+
priority: 8

0 commit comments

Comments
 (0)