|
| 1 | +default_install_hook_types: |
| 2 | + - pre-commit |
| 3 | + - commit-msg |
| 4 | +default_stages: |
| 5 | + - pre-commit # Run locally |
| 6 | + - manual # Run in CI |
| 7 | +exclude: 'examples/.*' # Exclude examples from all hooks by default |
| 8 | +repos: |
| 9 | +- repo: https://github.com/codespell-project/codespell |
| 10 | + rev: v2.4.1 |
| 11 | + hooks: |
| 12 | + - id: codespell |
| 13 | + args: [ |
| 14 | + --toml, pyproject.toml, |
| 15 | + '--skip', 'tests/e2e/multicard/test_torchair_graph_mode.py,tests/prompts/**,./benchmarks/sonnet.txt,*tests/lora/data/**,build/**,./vllm_ascend.egg-info/**,.github/**,typos.toml', |
| 16 | + '-L', 'CANN,cann,NNAL,nnal,ASCEND,ascend,EnQue,CopyIn' |
| 17 | + ] |
| 18 | + additional_dependencies: |
| 19 | + - tomli |
| 20 | +- repo: https://github.com/google/yapf |
| 21 | + rev: v0.43.0 |
| 22 | + hooks: |
| 23 | + - id: yapf |
| 24 | + args: [--in-place, --verbose] |
| 25 | + # Keep the same list from yapfignore here to avoid yapf failing without any inputs |
| 26 | + exclude: '(.github|benchmarks|examples|docs)/.*' |
| 27 | +- repo: https://github.com/astral-sh/ruff-pre-commit |
| 28 | + rev: v0.11.7 |
| 29 | + hooks: |
| 30 | + - id: ruff |
| 31 | + args: [--output-format, github, --fix] |
| 32 | + - id: ruff-format |
| 33 | + files: ^(benchmarks|examples)/.* |
| 34 | +- repo: https://github.com/crate-ci/typos |
| 35 | + rev: v1.32.0 |
| 36 | + hooks: |
| 37 | + - id: typos |
| 38 | +- repo: https://github.com/PyCQA/isort |
| 39 | + rev: 6.0.1 |
| 40 | + hooks: |
| 41 | + - id: isort |
| 42 | +# - repo: https://github.com/pre-commit/mirrors-clang-format |
| 43 | +# rev: v20.1.3 |
| 44 | +# hooks: |
| 45 | +# - id: clang-format |
| 46 | +# files: ^csrc/.*\.(cpp|hpp|cc|hh|cxx|hxx)$ |
| 47 | +# types_or: [c++] |
| 48 | +# args: [--style=google, --verbose] |
| 49 | +# - repo: https://github.com/jackdewinter/pymarkdown |
| 50 | +# rev: v0.9.29 |
| 51 | +# hooks: |
| 52 | +# - id: pymarkdown |
| 53 | +# args: [fix] |
| 54 | +- repo: https://github.com/rhysd/actionlint |
| 55 | + rev: v1.7.7 |
| 56 | + hooks: |
| 57 | + - id: actionlint |
| 58 | +- repo: local |
| 59 | + hooks: |
| 60 | + # For local development, you can run mypy using tools/mypy.sh script if needed. |
| 61 | + # - id: mypy-local |
| 62 | + # name: Run mypy for local Python installation |
| 63 | + # entry: tools/mypy.sh 0 "local" |
| 64 | + # language: system |
| 65 | + # types: [python] |
| 66 | + # stages: [pre-commit] # Don't run in CI |
| 67 | + - id: mypy-3.9 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward |
| 68 | + name: Run mypy for Python 3.9 |
| 69 | + entry: tools/mypy.sh 1 "3.9" |
| 70 | + # Use system python because vllm installation is required |
| 71 | + language: system |
| 72 | + types: [python] |
| 73 | + stages: [manual] # Only run in CI |
| 74 | + - id: mypy-3.10 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward |
| 75 | + name: Run mypy for Python 3.10 |
| 76 | + entry: tools/mypy.sh 1 "3.10" |
| 77 | + # Use system python because vllm installation is required |
| 78 | + language: system |
| 79 | + types: [python] |
| 80 | + stages: [manual] # Only run in CI |
| 81 | + - id: mypy-3.11 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward |
| 82 | + name: Run mypy for Python 3.11 |
| 83 | + entry: tools/mypy.sh 1 "3.11" |
| 84 | + # Use system python because vllm installation is required |
| 85 | + language: system |
| 86 | + types: [python] |
| 87 | + stages: [manual] # Only run in CI |
| 88 | + - id: mypy-3.12 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward |
| 89 | + name: Run mypy for Python 3.12 |
| 90 | + entry: tools/mypy.sh 1 "3.12" |
| 91 | + # Use system python because vllm installation is required |
| 92 | + language: system |
| 93 | + types: [python] |
| 94 | + stages: [manual] # Only run in CI |
| 95 | + # FIXME: enable shellcheck |
| 96 | + # - id: shellcheck |
| 97 | + # name: Lint shell scripts |
| 98 | + # entry: tools/shellcheck.sh |
| 99 | + # language: script |
| 100 | + # types: [shell] |
| 101 | + - id: png-lint |
| 102 | + name: Lint PNG exports from excalidraw |
| 103 | + entry: tools/png-lint.sh |
| 104 | + language: script |
| 105 | + types: [png] |
| 106 | + - id: signoff-commit |
| 107 | + name: Sign-off Commit |
| 108 | + entry: bash |
| 109 | + args: |
| 110 | + - -c |
| 111 | + - | |
| 112 | + if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then |
| 113 | + printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)" |
| 114 | + fi |
| 115 | + language: system |
| 116 | + verbose: true |
| 117 | + stages: [commit-msg] |
| 118 | + - id: check-filenames |
| 119 | + name: Check for spaces in all filenames |
| 120 | + entry: bash |
| 121 | + args: |
| 122 | + - -c |
| 123 | + - 'git ls-files | grep " " && echo "Filenames should not contain spaces!" && exit 1 || exit 0' |
| 124 | + language: system |
| 125 | + always_run: true |
| 126 | + pass_filenames: false |
| 127 | + - id: enforce-import-regex-instead-of-re |
| 128 | + name: Enforce import regex as re |
| 129 | + entry: python tools/enforce_regex_import.py |
| 130 | + language: python |
| 131 | + types: [python] |
| 132 | + pass_filenames: false |
| 133 | + additional_dependencies: [regex] |
| 134 | + # Keep `suggestion` last |
| 135 | + - id: suggestion |
| 136 | + name: Suggestion |
| 137 | + entry: bash -c 'echo "To bypass pre-commit hooks, add --no-verify to git commit."' |
| 138 | + language: system |
| 139 | + verbose: true |
| 140 | + pass_filenames: false |
| 141 | + # Insert new entries above the `suggestion` entry |
0 commit comments