"vllm/vscode:/vscode.git/clone" did not exist on "2273ec322cddb59431a124bb982340870ed06920"
.pre-commit-config.yaml 5.9 KB
Newer Older
1
2
3
default_install_hook_types:
  - pre-commit
  - commit-msg
4
5
6
default_stages:
  - pre-commit # Run locally
  - manual # Run in CI
7
exclude: 'vllm/third_party/.*'
8
9
repos:
- repo: https://github.com/google/yapf
10
  rev: v0.43.0
11
12
13
  hooks:
  - id: yapf
    args: [--in-place, --verbose]
14
15
    # Keep the same list from yapfignore here to avoid yapf failing without any inputs
    exclude: '(.buildkite|benchmarks|build|examples)/.*'
16
- repo: https://github.com/astral-sh/ruff-pre-commit
17
  rev: v0.11.7
18
19
  hooks:
  - id: ruff
20
    args: [--output-format, github, --fix]
21
  - id: ruff-format
22
    files: ^(.buildkite|benchmarks|examples)/.*
23
- repo: https://github.com/crate-ci/typos
24
  rev: v1.35.5
25
  hooks:
26
  - id: typos
27
- repo: https://github.com/PyCQA/isort
28
  rev: 6.0.1
29
30
31
  hooks:
  - id: isort
- repo: https://github.com/pre-commit/mirrors-clang-format
32
  rev: v20.1.3
33
34
  hooks:
  - id: clang-format
35
    exclude: 'csrc/(moe/topk_softmax_kernels.cu|quantization/gguf/(ggml-common.h|dequantize.cuh|vecdotq.cuh|mmq.cuh|mmvq.cuh))|vllm/third_party/.*'
36
37
    types_or: [c++, cuda]
    args: [--style=file, --verbose]
38
39
- repo: https://github.com/igorshubovych/markdownlint-cli
  rev: v0.45.0
40
  hooks:
41
  - id: markdownlint
42
    exclude: '.*\.inc\.md'
43
    stages: [manual] # Only run in CI
44
- repo: https://github.com/rhysd/actionlint
45
  rev: v1.7.7
46
47
  hooks:
  - id: actionlint
48
- repo: https://github.com/astral-sh/uv-pre-commit
49
  rev: 0.6.17
50
51
  hooks:
    - id: pip-compile
52
      args: [requirements/test.in, -o, requirements/test.txt, --index-strategy, unsafe-best-match, --torch-backend, cu128]
53
      files: ^requirements/test\.(in|txt)$
54
55
- repo: local
  hooks:
56
57
58
59
60
  - id: format-torch-nightly-test
    name: reformat nightly_torch_test.txt to be in sync with test.in
    language: python
    entry: python tools/generate_nightly_torch_test.py
    files: ^requirements/test\.(in|txt)$
61
62
  - id: mypy-local
    name: Run mypy for local Python installation
63
    entry: tools/mypy.sh 0 "local"
64
65
    language: python
    types: [python]
66
    additional_dependencies: &mypy_deps [mypy==1.11.1, types-cachetools, types-setuptools, types-PyYAML, types-requests, pydantic]
67
    stages: [pre-commit] # Don't run in CI
68
69
70
71
72
  - id: mypy-3.9 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
    name: Run mypy for Python 3.9
    entry: tools/mypy.sh 1 "3.9"
    language: python
    types: [python]
73
74
    additional_dependencies: *mypy_deps
    stages: [manual] # Only run in CI
75
76
77
78
79
80
  - id: mypy-3.10 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
    name: Run mypy for Python 3.10
    entry: tools/mypy.sh 1 "3.10"
    language: python
    types: [python]
    additional_dependencies: *mypy_deps
81
    stages: [manual] # Only run in CI
82
83
84
85
86
87
  - id: mypy-3.11 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
    name: Run mypy for Python 3.11
    entry: tools/mypy.sh 1 "3.11"
    language: python
    types: [python]
    additional_dependencies: *mypy_deps
88
    stages: [manual] # Only run in CI
89
90
91
92
93
94
  - id: mypy-3.12 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
    name: Run mypy for Python 3.12
    entry: tools/mypy.sh 1 "3.12"
    language: python
    types: [python]
    additional_dependencies: *mypy_deps
95
    stages: [manual] # Only run in CI
96
97
98
99
100
101
102
103
104
105
  - id: shellcheck
    name: Lint shell scripts
    entry: tools/shellcheck.sh
    language: script
    types: [shell]
  - id: png-lint
    name: Lint PNG exports from excalidraw
    entry: tools/png-lint.sh
    language: script
    types: [png]
106
107
108
109
110
111
  - id: signoff-commit
    name: Sign-off Commit
    entry: bash
    args:
      - -c
      - |
112
113
        if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then
          printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)"
114
115
116
117
        fi
    language: system
    verbose: true
    stages: [commit-msg]
118
119
120
121
122
  - id: check-spdx-header
    name: Check SPDX headers
    entry: python tools/check_spdx_header.py
    language: python
    types: [python]
123
124
125
126
127
  - id: check-root-lazy-imports
    name: Check root lazy imports
    entry: python tools/check_init_lazy_imports.py
    language: python
    types: [python]
128
129
  - id: check-filenames
    name: Check for spaces in all filenames
130
131
132
133
    entry: bash
    args:
      - -c
      - 'git ls-files | grep " " && echo "Filenames should not contain spaces!" && exit 1 || exit 0'
134
135
136
    language: system
    always_run: true
    pass_filenames: false
137
138
139
140
  - id: update-dockerfile-graph
    name: Update Dockerfile dependency graph
    entry: tools/update-dockerfile-graph.sh
    language: script
141
142
143
144
145
146
147
  - id: enforce-import-regex-instead-of-re
    name: Enforce import regex as re
    entry: python tools/enforce_regex_import.py
    language: python
    types: [python]
    pass_filenames: false
    additional_dependencies: [regex]
148
149
150
151
152
153
154
  # forbid directly import triton
  - id: forbid-direct-triton-import
    name: "Forbid direct 'import triton'"
    entry: python tools/check_triton_import.py
    language: python
    types: [python]
    pass_filenames: false
155
    additional_dependencies: [regex]
156
157
158
159
160
161
162
  - id: check-pickle-imports
    name: Prevent new pickle/cloudpickle imports
    entry: python tools/check_pickle_imports.py
    language: python
    types: [python]
    pass_filenames: false
    additional_dependencies: [pathspec, regex]
163
164
165
166
  - id: validate-config
    name: Validate configuration has default values and that each field has a docstring
    entry: python tools/validate_config.py
    language: python
167
    additional_dependencies: [regex]
168
169
170
  # Keep `suggestion` last
  - id: suggestion
    name: Suggestion
171
    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>."'
172
173
174
175
    language: system
    verbose: true
    pass_filenames: false
  # Insert new entries above the `suggestion` entry