2025-11-24 13:14:08 +08:00
default_install_hook_types :
- pre-commit
- commit-msg
2025-10-24 12:16:48 +08:00
repos :
- repo : https://github.com/pre-commit/pre-commit-hooks
2025-12-26 14:11:35 +08:00
rev : v6.0.0
2025-10-24 12:16:48 +08:00
hooks :
# list of supported hooks: https://pre-commit.com/hooks.html
- id : check-yaml
args : [ "--unsafe" ]
2026-03-09 17:02:23 +01:00
exclude : "examples/online_serving/chart-helm/templates/"
2025-10-24 12:16:48 +08:00
- id : debug-statements
- id : end-of-file-fixer
- id : mixed-line-ending
args : [ "--fix=lf" ]
- id : trailing-whitespace
args : [ "--markdown-linebreak-ext=md" ]
2025-11-17 18:13:05 +08:00
- repo : https://github.com/astral-sh/ruff-pre-commit
2025-12-26 14:11:35 +08:00
rev : v0.14.10
2025-10-24 12:16:48 +08:00
hooks :
2025-11-18 20:54:26 +08:00
- id : ruff-check
args : [ --output-format, github, --fix]
- id : ruff-format
2025-11-17 18:13:05 +08:00
- repo : https://github.com/crate-ci/typos
2026-08-20 21:07:04 +08:00
rev : v1.49.0
2025-11-17 18:13:05 +08:00
hooks :
- id : typos
# only for staged files
- repo : https://github.com/rhysd/actionlint
2026-01-27 10:22:40 +08:00
# v1.7.8+ sets `go 1.24.0` in go.mod, which older Go toolchains (and most
# current CI images) cannot parse. Pin to v1.7.7 until actionlint fixes the
# go.mod directive.
rev : v1.7.7
2025-11-17 18:13:05 +08:00
hooks :
- id : actionlint
files : ^\.github/workflows/.*\.ya?ml$
2025-11-24 13:14:08 +08:00
2026-08-20 21:07:04 +08:00
- repo : https://github.com/DavidAnson/markdownlint-cli2
rev : v0.23.2
hooks :
- id : markdownlint-cli2
language_version : lts
args : [ --fix]
files : (^docs/|^recipes/|(^|/)README\.md$|^CONTRIBUTING\.md$)
# Agent skill docs and CLAUDE.md are not user-facing docs/READMEs.
exclude : (^|/)CLAUDE\.md$|^\.claude/|^\.cursor/
2025-11-24 13:14:08 +08:00
2026-08-20 21:07:04 +08:00
# Keep `local` last so `suggestion` stays the final hook. Autofix repos
# (ruff, typos, markdownlint, trailing-whitespace, etc.) must run first;
# otherwise their "files were modified" output displaces the SKIP tip.
2025-11-24 13:14:08 +08:00
- repo : local
hooks :
- 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 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)"
fi
language : system
verbose : true
stages : [ commit-msg]
2026-08-20 21:07:04 +08:00
# TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup
# is less awkward. Local wrapper groups files so follow_imports=skip on
# tests does not leak into library code.
# mypy-3.10 runs on git commit (changed files). CI SKIPs it because
# --all-files is not clean yet. Extra versions are manual-stage only
# (not in default `pre-commit run --all-files`):
# pre-commit run --hook-stage manual mypy-3.12
- id : mypy-3.10
name : Run mypy for Python 3.10
entry : python tools/pre_commit/mypy.py "3.10"
<< : &mypy_common
language : python
types_or : [ python, pyi]
require_serial : true
additional_dependencies :
- mypy==1.11.1
- regex
- types-cachetools
- types-setuptools
- types-PyYAML
- types-requests
- types-torch
- pydantic
- id : mypy-3.11
name : Run mypy for Python 3.11
entry : python tools/pre_commit/mypy.py "3.11"
<< : *mypy_common
stages : [ manual]
- id : mypy-3.12
name : Run mypy for Python 3.12
entry : python tools/pre_commit/mypy.py "3.12"
<< : *mypy_common
stages : [ manual]
- id : mypy-3.13
name : Run mypy for Python 3.13
entry : python tools/pre_commit/mypy.py "3.13"
<< : *mypy_common
stages : [ manual]
2026-08-29 18:42:33 +08:00
- id : check-mark
name : Ensure test files have CI marks (no direct SKU)
2026-07-19 00:03:07 -06:00
entry : python tools/pre_commit/check_test_marks.py
language : python
types : [ python]
files : ^tests/
2026-08-09 06:30:05 -07:00
- id : check-tts-adapter-migration
name : Ratchet TTS per-model branches out of serving_speech.py
entry : python tools/pre_commit/check_tts_adapter.py
language : python
pass_filenames : false
2026-08-17 12:14:26 +08:00
files : ^(vllm_omni/entrypoints/openai/serving_speech\.py|tools/pre_commit/check_tts_adapter\.py)$
2026-08-10 17:08:31 -04:00
# The budget-is-now-slack reminder is printed on a PASSING run, and
# pre-commit hides output from passing hooks unless the hook is verbose.
verbose : true
2026-08-09 06:30:05 -07:00
2026-08-20 21:07:04 +08:00
- id : shellcheck
name : Lint shell scripts
# language: script breaks on Windows (shebang path loses slashes).
# Invoke the vLLM-style wrapper with bash so Linux CI and Win/Git Bash work.
entry : bash
args : [ tools/pre_commit/shellcheck.sh]
language : system
types : [ shell]
- id : check-spdx-header
name : Check SPDX headers
entry : python tools/pre_commit/check_spdx_header.py
language : python
types_or : [ python, pyi, rust, proto, shell]
files : \.(py|pyi|rs|proto|sh)$
- id : check-forbidden-imports
name : Check forbidden imports
entry : python tools/pre_commit/check_forbidden_imports.py
language : python
types : [ python]
additional_dependencies : [ regex]
- id : check-torch-cuda-call
name : Prevent new torch.cuda API calls
entry : python tools/pre_commit/check_torch_cuda.py
language : python
types : [ python]
additional_dependencies : [ regex]
- id : check-buildkite
name : Validate Buildkite Pipelines
entry : python tools/pre_commit/check_buildkite.py
language : python
files : ^\.buildkite/.*\.ya?ml$
additional_dependencies : [ pyyaml, check-jsonschema==0.38.0]
# Keep `suggestion` as the final hook. Run after autofix hooks so the
# bypass/SKIP tip is not displaced.
2025-11-24 13:14:08 +08:00
- id : suggestion
name : Suggestion
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>."'
language : system
verbose : true
pass_filenames : false
# Insert new entries above the `suggestion` entry