-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
58 lines (52 loc) · 2.08 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
58 lines (52 loc) · 2.08 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
# Run on every commit:
# pre-commit install
# Run on the whole repo manually:
# pre-commit run --all-files
# Third-party patches must match upstream byte-for-byte; never reformat them
# (trailing whitespace on diff context lines is significant — trimming breaks
# `git apply`). Covers both .patch and .diff (e.g. patches/mooncake_cpp/*.diff).
exclude: ^deploy/docker/patches/.*\.(patch|diff)$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents] # k8s manifests bundle several docs
exclude: ^deploy/operator/helm/.*/templates/ # Helm Go-templates aren't valid YAML
- id: check-added-large-files
args: [--maxkb=500]
- id: check-merge-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.0
hooks:
- id: ruff-format
- id: ruff-check
args: [--fix]
# Rust formatting gate (needs a local toolchain: rustup + rustfmt). clippy and
# tests are heavier, so they run in CI (.github/workflows/ci.yml, job `rust`).
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt (rust)
entry: cargo fmt --manifest-path rust/Cargo.toml --all -- --check
language: system
files: ^rust/.*\.rs$
pass_filenames: false
# Go formatting gate (needs a local toolchain). Only the operator is Go.
# `go vet` and the tests are heavier, so they run in CI.
- id: gofmt
name: gofmt (go)
entry: scripts/check-gofmt.sh
language: script
files: ^deploy/operator/.*\.go$
# Refuse a commit whose git email is a machine-generated local hostname
# (git's fallback when user.email is unset), so an internal build-host
# name can't leak into permanent public history. Skipped in CI.
- id: check-author-email
name: reject local-hostname / auto-generated git emails
entry: scripts/check-author-email.sh
language: script
always_run: true
pass_filenames: false