-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
97 lines (85 loc) · 3.35 KB
/
.pre-commit-config.yaml
File metadata and controls
97 lines (85 loc) · 3.35 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=500']
- id: check-merge-conflict
- id: check-json
- id: detect-private-key
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args: [--style=file]
- id: cpplint
args: ['--filter=-legal/copyright,-runtime/explicit,-whitespace/comments,--quiet']
- id: cppcheck
args: [--enable=all, --inline-suppr, --std=c++17, --language=c++, --suppress=unmatchedSuppression, --suppress=missingIncludeSystem, --suppress=noExplicitConstructor, -Isrc/cpp, -Isrc/cpp/common]
- repo: local
hooks:
- id: ruff-lint
name: Ruff - Lint
entry: uv run -- ruff check --force-exclude --fix
language: system
types_or: [python, pyi]
require_serial: true
- id: ruff-format
name: Ruff - Format code
entry: uv run -- ruff format --force-exclude
language: system
types_or: [python, pyi]
require_serial: true
- id: mypy
name: mypy - Check typing
entry: uv run -- mypy
language: system
require_serial: true
types: [python]
- id: uv-check-lock
name: uv - Check `uv.lock`
entry: uv lock --check
language: system
pass_filenames: false
files: ^pyproject\.toml|uv\.lock$
- id: trailing-whitespace
name: Trim trailing whitespace
entry: uv run -- trailing-whitespace-fixer
language: system
types: [text]
stages: [pre-commit, pre-push, manual]
- id: end-of-file-fixer
name: Fix end of files
entry: uv run -- end-of-file-fixer
language: system
types: [text]
stages: [pre-commit, pre-push, manual]
- id: check-merge-conflict
name: Check for merge conflicts
entry: uv run -- check-merge-conflict
args: [--assume-in-merge]
language: system
types: [text]
- id: no-dynamic-allocation
name: Detect dynamic allocation (review only)
entry: bash -c 'echo "[INFO] Checking for dynamic allocation..." && (grep -r "new \|malloc\|calloc\|realloc" --include="*.cpp" --include="*.h" . 2>/dev/null && echo "[REVIEW] Found dynamic allocation - ensure it is not in hot paths") || echo "[OK] No obvious dynamic allocation found"; true'
language: system
files: \.(cpp|h|hpp)$
- id: no-locks-in-latency-critical
name: Detect mutex/lock usage (review for latency)
entry: bash -c 'grep -r "std::mutex\|pthread_mutex\|std::lock" --include="*.cpp" --include="*.h" . 2>/dev/null || true'
language: system
files: \.(cpp|h|hpp)$
- id: no-syscalls-in-hot-loop
name: Detect potential syscalls in loops
entry: bash -c 'grep -r "syscall\|getenv\|system\|popen" --include="*.cpp" --include="*.h" . 2>/dev/null || true'
language: system
files: \.(cpp|h|hpp)$
- id: check-atomic-usage
name: Verify atomic operations are lock-free
entry: bash -c 'grep -r "std::atomic" --include="*.cpp" --include="*.h" . | grep -v "is_lock_free" || true'
language: system
files: \.(cpp|h|hpp)$