Skip to content

Commit 4bc1d9f

Browse files
committed
new pre-commit
1 parent 2d91a99 commit 4bc1d9f

File tree

161 files changed

+9947
-6372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+9947
-6372
lines changed

.pre-commit-config.yaml

Lines changed: 45 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,99 +3,76 @@ default_stages:
33
- manual # Run in CI
44
exclude: 'third_party/.*'
55
repos:
6-
- repo: https://github.com/google/yapf
7-
rev: v0.43.0
8-
hooks:
9-
- id: yapf
10-
args: [--in-place, --verbose]
11-
additional_dependencies: [toml] # TODO: Remove when yapf is upgraded
126
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.9.3
7+
rev: v0.14.0
148
hooks:
15-
- id: ruff
9+
- id: ruff-check
1610
args: [--output-format, github, --fix]
17-
- repo: https://github.com/codespell-project/codespell
18-
rev: v2.4.0
11+
- id: ruff-format
12+
- repo: https://github.com/crate-ci/typos
13+
rev: v1.38.1
1914
hooks:
20-
- id: codespell
21-
additional_dependencies: ['tomli']
22-
args: ['--toml', 'pyproject.toml']
23-
- repo: https://github.com/PyCQA/isort
24-
rev: 0a0b7a830386ba6a31c2ec8316849ae4d1b8240d # 6.0.0
15+
- id: typos
16+
args: [--force-exclude]
17+
- repo: https://github.com/rhysd/actionlint
18+
rev: v1.7.7
2519
hooks:
26-
- id: isort
20+
- id: actionlint
2721
- repo: https://github.com/pre-commit/mirrors-clang-format
28-
rev: v19.1.7
22+
rev: v21.1.2
2923
hooks:
3024
- id: clang-format
3125
exclude: 'csrc/(moe/topk_softmax_kernels.cu|quantization/gguf/(ggml-common.h|dequantize.cuh|vecdotq.cuh|mmq.cuh|mmvq.cuh))|vllm/third_party/.*'
3226
types_or: [c++, cuda]
3327
args: [--style=file, --verbose]
34-
- repo: https://github.com/jackdewinter/pymarkdown
35-
rev: v0.9.27
28+
- repo: https://github.com/igorshubovych/markdownlint-cli
29+
rev: v0.45.0
3630
hooks:
37-
- id: pymarkdown
38-
args: [fix]
31+
- id: markdownlint
32+
exclude: '.*\.inc\.md'
33+
stages: [manual] # Only run in CI
3934
- repo: https://github.com/astral-sh/uv-pre-commit
40-
rev: 0.6.2
35+
rev: 0.9.1
4136
hooks:
4237
- id: pip-compile
4338
args: [requirements/test.in, -o, requirements/test.txt]
4439
files: ^requirements/test\.(in|txt)$
4540
- repo: local
4641
hooks:
4742
- id: mypy-local
48-
name: Run mypy for local Python installation
49-
entry: tools/mypy.sh 0 "local"
50-
language: python
51-
types: [python]
52-
additional_dependencies: &mypy_deps [mypy==1.11.1, types-cachetools, types-setuptools, types-PyYAML, types-requests]
43+
name: Run mypy locally for lowest supported Python version
44+
entry: python tools/pre_commit/mypy.py 0 "3.10"
5345
stages: [pre-commit] # Don't run in CI
54-
- id: mypy-3.9 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
55-
name: Run mypy for Python 3.9
56-
entry: tools/mypy.sh 1 "3.9"
57-
language: python
58-
types: [python]
59-
additional_dependencies: *mypy_deps
60-
stages: [manual] # Only run in CI
46+
<<: &mypy_common
47+
language: python
48+
types_or: [python, pyi]
49+
require_serial: true
50+
additional_dependencies: [mypy==1.11.1, regex, types-cachetools, types-setuptools, types-PyYAML, types-requests, types-torch, pydantic]
6151
- id: mypy-3.10 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
6252
name: Run mypy for Python 3.10
6353
entry: tools/mypy.sh 1 "3.10"
64-
language: python
65-
types: [python]
66-
additional_dependencies: *mypy_deps
54+
<<: *mypy_common
6755
stages: [manual] # Only run in CI
6856
- id: mypy-3.11 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
6957
name: Run mypy for Python 3.11
7058
entry: tools/mypy.sh 1 "3.11"
71-
language: python
72-
types: [python]
73-
additional_dependencies: *mypy_deps
59+
<<: *mypy_common
7460
stages: [manual] # Only run in CI
7561
- id: mypy-3.12 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
7662
name: Run mypy for Python 3.12
7763
entry: tools/mypy.sh 1 "3.12"
78-
language: python
79-
types: [python]
80-
additional_dependencies: *mypy_deps
64+
<<: *mypy_common
8165
stages: [manual] # Only run in CI
8266
- id: mypy-3.13 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
8367
name: Run mypy for Python 3.13
8468
entry: tools/mypy.sh 1 "3.13"
85-
language: python
86-
types: [python]
87-
additional_dependencies: *mypy_deps
69+
<<: *mypy_common
8870
stages: [manual] # Only run in CI
8971
- id: shellcheck
9072
name: Lint shell scripts
91-
entry: tools/shellcheck.sh
73+
entry: tools/pre_commit/shellcheck.sh
9274
language: script
9375
types: [shell]
94-
- id: png-lint
95-
name: Lint PNG exports from excalidraw
96-
entry: tools/png-lint.sh
97-
language: script
98-
types: [png]
9976
- id: signoff-commit
10077
name: Sign-off Commit
10178
entry: bash
@@ -110,7 +87,12 @@ repos:
11087
stages: [commit-msg]
11188
- id: check-license-header
11289
name: Check Licence headers
113-
entry: python tools/check_license_header.py
90+
entry: python tools/pre_commit/check_license_header.py
91+
language: python
92+
types: [python]
93+
- id: check-root-lazy-imports
94+
name: Check root lazy imports
95+
entry: python tools/pre_commit/check_init_lazy_imports.py
11496
language: python
11597
types: [python]
11698
- id: check-filenames
@@ -122,10 +104,19 @@ repos:
122104
language: system
123105
always_run: true
124106
pass_filenames: false
107+
- id: check-filenames
108+
name: Check for spaces in all filenames
109+
entry: bash
110+
args:
111+
- -c
112+
- 'git ls-files | grep " " && echo "Filenames should not contain spaces!" && exit 1 || exit 0'
113+
language: system
114+
always_run: true
115+
pass_filenames: false
125116
# Keep `suggestion` last
126117
- id: suggestion
127118
name: Suggestion
128-
entry: bash -c 'echo "To bypass pre-commit hooks, add --no-verify to git commit."'
119+
entry: bash -c 'echo "To bypass all the pre-commit hooks, add --no-verify to git commit. To skip a specific hook, prefix the commit command with SKIP=<hook-id>."'
129120
language: system
130121
verbose: true
131122
pass_filenames: false

0 commit comments

Comments
 (0)