forked from lightseekorg/smg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
101 lines (93 loc) · 3.27 KB
/
.pre-commit-config.yaml
File metadata and controls
101 lines (93 loc) · 3.27 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
default_stages: [pre-commit, pre-push, manual]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-symlinks
- id: destroyed-symlinks
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents, --unsafe]
exclude: ^deploy/helm/.*/templates/|^deploy/helm/.*/tests/
- id: check-toml
- id: check-added-large-files
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
exclude: \.rs$
- id: detect-private-key
exclude: .*tests/.*_test\.rs$
- id: mixed-line-ending
- id: no-commit-to-branch
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies: ['tomli']
args: ['-L', 'cann,thi,makro,wil,rouge,PRIS,hel,te,ans,ser,wit,WIT,implementors,caf,ratatui']
exclude: |
(?x)^(
src/proto/.*\.proto$|
src/mesh/proto/.*\.proto$|
src/tokenizer/chat_template\.rs|
crates/multimodal/tests/fixtures/.*|
target/.*
)$
- repo: local
hooks:
- id: rustfmt
name: rustfmt
description: Format Rust code with rustfmt
entry: cargo +nightly fmt --all --
language: system
types: [rust]
pass_filenames: false
- id: clippy
name: clippy
description: Lint Rust code with clippy
entry: cargo clippy --workspace --all-targets --all-features -- -D warnings
language: system
types: [rust]
pass_filenames: false
- id: branch-name-check
name: Branch naming convention
description: Ensure branch name follows <type>/<desc> or <username>/<desc> format
entry: |
bash -c '
branch=$(git rev-parse --abbrev-ref HEAD)
if [[ "$branch" != "main" && ! "$branch" =~ ^[a-z0-9]([a-z0-9._-]*[a-z0-9])?/[a-z0-9._-]+$ ]]; then
echo "Branch \"$branch\" does not follow naming convention: <type>/<description> or <username>/<description>"
exit 1
fi
'
language: system
stages: [pre-push]
always_run: true
pass_filenames: false
- id: dco-check
name: DCO sign-off check
description: Check that the commit message contains a DCO sign-off matching git user config
entry: scripts/dco-check.sh
language: system
stages: [commit-msg]
always_run: true
- id: no-ai-co-author
name: No AI co-author or sign-off
description: Reject Co-authored-by or Signed-off-by lines referencing Claude or noreply@anthropic.com
entry: |
bash -c '
if grep -iE "^(Co-authored-by|Signed-off-by):.*(Claude|noreply@anthropic\.com)" "$1"; then
echo ""
echo "ERROR: Commit message must not reference Claude or noreply@anthropic.com in Co-authored-by/Signed-off-by lines."
exit 1
fi
' --
language: system
stages: [commit-msg]
always_run: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format