-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
88 lines (79 loc) · 3.02 KB
/
.pre-commit-config.yaml
File metadata and controls
88 lines (79 loc) · 3.02 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
# Pre-commit hooks for LANCE
# Install: pip install pre-commit && pre-commit install
# Run manually: pre-commit run --all-files
# https://pre-commit.com
repos:
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: ['--maxkb=1000']
- id: mixed-line-ending
args: ['--fix=lf']
# Rust formatting
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt
description: Format Rust code with rustfmt
entry: cargo fmt --all --
language: system
types: [rust]
pass_filenames: false
- id: cargo-check
name: cargo check
description: Check Rust code compiles
entry: cargo check --all-targets --all-features
language: system
types: [rust]
pass_filenames: false
- id: cargo-clippy
name: cargo clippy
description: Lint Rust code with Clippy
entry: cargo clippy --all-targets --all-features -- -D warnings -D clippy::unwrap_used -D clippy::expect_used
language: system
types: [rust]
pass_filenames: false
# Mechanical integrity checks from CodingGuidelines
- id: no-mutex-hot-path
name: No Mutex on hot path
description: Prevent Mutex usage in hot path crates
entry: bash -c 'if grep -rE "std::sync::Mutex|parking_lot::Mutex" --include="*.rs" lnc-core lnc-io 2>/dev/null; then echo "❌ Mutex found in hot path crates"; exit 1; fi'
language: system
pass_filenames: false
always_run: true
- id: no-to-vec-network
name: No to_vec() in network code
description: Prevent to_vec() allocation in network path
entry: bash -c 'if grep -rE "\.to_vec\(\)" --include="*.rs" lnc-network 2>/dev/null; then echo "❌ to_vec() found in network code"; exit 1; fi'
language: system
pass_filenames: false
always_run: true
- id: no-dynamic-dispatch
name: No dynamic dispatch on data plane
description: Prevent Box<dyn> and &dyn in data plane
entry: bash -c 'if grep -rE "Box<dyn|&dyn" --include="*.rs" lnc-core lnc-io lnc-network 2>/dev/null; then echo "❌ Dynamic dispatch found in data plane"; exit 1; fi'
language: system
pass_filenames: false
always_run: true
# Commit message format (Conventional Commits)
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.1.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, deps]
# CI configuration
ci:
autofix_commit_msg: "style: auto-fix from pre-commit hooks"
autofix_prs: true
autoupdate_branch: "main"
autoupdate_commit_msg: "chore: update pre-commit hooks"
autoupdate_schedule: monthly