2025-01-20 17:36:24 +08:00
|
|
|
default_stages:
|
|
|
|
- pre-commit # Run locally
|
|
|
|
- manual # Run in CI
|
2025-01-20 06:58:01 +00:00
|
|
|
repos:
|
|
|
|
- repo: https://github.com/google/yapf
|
2025-01-28 00:23:08 +00:00
|
|
|
rev: v0.43.0
|
2025-01-20 06:58:01 +00:00
|
|
|
hooks:
|
|
|
|
- id: yapf
|
|
|
|
args: [--in-place, --verbose]
|
|
|
|
additional_dependencies: [toml] # TODO: Remove when yapf is upgraded
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
2025-01-28 00:23:08 +00:00
|
|
|
rev: v0.9.3
|
2025-01-20 06:58:01 +00:00
|
|
|
hooks:
|
|
|
|
- id: ruff
|
2025-02-13 02:45:38 -05:00
|
|
|
args: [--output-format, github, --fix]
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- repo: https://github.com/codespell-project/codespell
|
2025-01-28 00:23:08 +00:00
|
|
|
rev: v2.4.0
|
2025-01-20 06:58:01 +00:00
|
|
|
hooks:
|
|
|
|
- id: codespell
|
2025-02-13 23:19:43 -05:00
|
|
|
additional_dependencies: ['tomli']
|
|
|
|
args: ['--toml', 'pyproject.toml']
|
2025-01-20 06:58:01 +00:00
|
|
|
- repo: https://github.com/PyCQA/isort
|
2025-02-20 16:00:14 +00:00
|
|
|
rev: 0a0b7a830386ba6a31c2ec8316849ae4d1b8240d # 6.0.0
|
2025-01-20 06:58:01 +00:00
|
|
|
hooks:
|
|
|
|
- id: isort
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
2025-01-28 00:23:08 +00:00
|
|
|
rev: v19.1.7
|
2025-01-20 06:58:01 +00:00
|
|
|
hooks:
|
|
|
|
- id: clang-format
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'csrc/(moe/topk_softmax_kernels.cu|quantization/gguf/(ggml-common.h|dequantize.cuh|vecdotq.cuh|mmq.cuh|mmvq.cuh))|vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
types_or: [c++, cuda]
|
|
|
|
args: [--style=file, --verbose]
|
|
|
|
- repo: https://github.com/jackdewinter/pymarkdown
|
|
|
|
rev: v0.9.27
|
|
|
|
hooks:
|
|
|
|
- id: pymarkdown
|
2025-02-08 20:25:15 +08:00
|
|
|
args: [fix]
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 18:06:24 +08:00
|
|
|
- repo: https://github.com/rhysd/actionlint
|
2025-01-28 00:23:08 +00:00
|
|
|
rev: v1.7.7
|
2025-01-20 18:06:24 +08:00
|
|
|
hooks:
|
|
|
|
- id: actionlint
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- repo: local
|
|
|
|
hooks:
|
2025-01-20 17:36:24 +08:00
|
|
|
- id: mypy-local
|
|
|
|
name: Run mypy for local Python installation
|
2025-01-20 23:49:18 +08:00
|
|
|
entry: tools/mypy.sh 0 "local"
|
2025-01-20 17:36:24 +08:00
|
|
|
language: python
|
|
|
|
types: [python]
|
|
|
|
additional_dependencies: &mypy_deps [mypy==1.11.1, types-setuptools, types-PyYAML, types-requests]
|
|
|
|
stages: [pre-commit] # Don't run in CI
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- 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]
|
2025-01-20 17:36:24 +08:00
|
|
|
additional_dependencies: *mypy_deps
|
|
|
|
stages: [manual] # Only run in CI
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- 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
|
2025-01-20 17:36:24 +08:00
|
|
|
stages: [manual] # Only run in CI
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- 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
|
2025-01-20 17:36:24 +08:00
|
|
|
stages: [manual] # Only run in CI
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- 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
|
2025-01-20 17:36:24 +08:00
|
|
|
stages: [manual] # Only run in CI
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- id: shellcheck
|
|
|
|
name: Lint shell scripts
|
|
|
|
entry: tools/shellcheck.sh
|
|
|
|
language: script
|
|
|
|
types: [shell]
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-20 06:58:01 +00:00
|
|
|
- id: png-lint
|
|
|
|
name: Lint PNG exports from excalidraw
|
|
|
|
entry: tools/png-lint.sh
|
|
|
|
language: script
|
|
|
|
types: [png]
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-01-31 12:30:33 -08:00
|
|
|
- id: signoff-commit
|
|
|
|
name: Sign-off Commit
|
|
|
|
entry: bash
|
|
|
|
args:
|
|
|
|
- -c
|
|
|
|
- |
|
|
|
|
if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" .git/COMMIT_EDITMSG; then
|
|
|
|
printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> .git/COMMIT_EDITMSG
|
|
|
|
fi
|
|
|
|
language: system
|
|
|
|
verbose: true
|
|
|
|
stages: [commit-msg]
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-02-02 14:58:18 -05:00
|
|
|
- id: check-spdx-header
|
|
|
|
name: Check SPDX headers
|
|
|
|
entry: python tools/check_spdx_header.py
|
|
|
|
language: python
|
|
|
|
types: [python]
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-02-06 15:36:21 -08:00
|
|
|
- id: check-filenames
|
|
|
|
name: Check for spaces in all filenames
|
2025-02-07 05:04:39 -08:00
|
|
|
entry: bash
|
|
|
|
args:
|
|
|
|
- -c
|
|
|
|
- 'git ls-files | grep " " && echo "Filenames should not contain spaces!" && exit 1 || exit 0'
|
2025-02-06 15:36:21 -08:00
|
|
|
language: system
|
|
|
|
always_run: true
|
|
|
|
pass_filenames: false
|
2025-02-09 15:00:00 +08:00
|
|
|
exclude: 'vllm/third_party/.*'
|
2025-02-11 17:34:16 -05:00
|
|
|
# Keep `suggestion` last
|
|
|
|
- id: suggestion
|
|
|
|
name: Suggestion
|
|
|
|
entry: bash -c 'echo "To bypass pre-commit hooks, add --no-verify to git commit."'
|
|
|
|
language: system
|
|
|
|
verbose: true
|
|
|
|
pass_filenames: false
|
|
|
|
exclude: 'vllm/third_party/.*'
|
|
|
|
# Insert new entries above the `suggestion` entry
|