Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
72 lines (65 loc) · 2.96 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
72 lines (65 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Pre-commit hooks configuration for Mooncake
# Install: pip install -r requirements-dev.txt && pre-commit install
# Staged files: pre-commit run
# PR-changed files: git fetch origin main && pre-commit run --files $(git diff --name-only --diff-filter=ACMR origin/main...HEAD)
# Full-repo (intentional cleanup only): pre-commit run --all-files
# Format all C/C++ files explicitly: ./scripts/code_format.sh --all
# Note: clang-format should already be available (installed via system packages or dependencies.sh)
# Exclusions: build artifacts, vendored extern code, generated wheels.
minimum_pre_commit_version: '3.6.0'
ci:
autofix_prs: true
autoupdate_commit_msg: 'chore: pre-commit autoupdate'
# Needs Cargo + libclang, which the hosted pre-commit.ci image lacks;
# GitHub Actions is the authoritative check for this hook.
skip: [store-rust-dlopen-bindings]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: '^(build/|extern/|mooncake-wheel/repaired_wheels_.*|.*/build/|FAST25-release/)'
- id: end-of-file-fixer
exclude: '^(build/|extern/|mooncake-wheel/repaired_wheels_.*|.*/build/|FAST25-release/)'
- id: check-yaml
- id: check-merge-conflict
- id: check-added-large-files
args: ['--maxkb=1024']
- repo: local
hooks:
- id: mooncake-code-format
name: Format staged C/C++ changes
entry: ./scripts/code_format.sh --staged
language: system
files: '\.(c|cc|cpp|cxx|cu|cuh|h|hpp)$'
exclude: '^(extern/|build/|.*/build/|FAST25-release/|.*cachelib_memory_allocator/|.*/thirdparty/.*)'
require_serial: true
# Regenerate the committed dlopen bindings when store_c.h or the generator
# inputs change; a resulting diff fails the commit so they can't go stale.
- id: store-rust-dlopen-bindings
name: Regenerate Mooncake Store Rust dlopen bindings
entry: cargo run --locked --manifest-path mooncake-store/rust/Cargo.toml --example generate_dlopen_bindings
language: system
pass_filenames: false
require_serial: true
files: '^(mooncake-store/include/store_c\.h|mooncake-store/rust/(Cargo\.(toml|lock)|examples/generate_dlopen_bindings\.rs|src/generated/ffi_dlopen_bindings\.rs))$'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
args: ['--fix']
exclude: '^(extern/|FAST25-release/)'
- id: ruff-format
exclude: '^(extern/|FAST25-release/)'
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
exclude: '^(extern/|FAST25-release/)'
args: ['--ignore-words-list=te,mooncake,KVCache,cann,hsa,crate']
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
files: 'CMakeLists\.txt|.*\.cmake'
exclude: '^(extern/|build/|.*/build/|FAST25-release/)'