-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
120 lines (109 loc) · 4.3 KB
/
.pre-commit-config.yaml
File metadata and controls
120 lines (109 loc) · 4.3 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# =============================================================================
# Void eID Pre-commit Configuration
# =============================================================================
# Install: pre-commit install
# Run manually: pre-commit run --all-files
# =============================================================================
repos:
# ===========================================================================
# General Checks
# ===========================================================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: ^(src/frontend/bun\.lock|.*\.lock)$
- id: end-of-file-fixer
exclude: ^(src/frontend/bun\.lock|.*\.lock)$
- id: check-yaml
args: ["--unsafe"]
- id: check-json
exclude: ^(package-lock\.json|src/frontend/package-lock\.json|.*tsconfig.*\.json|\.vscode/.*\.json|\.devcontainer/.*\.json)$
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: check-merge-conflict
- id: detect-private-key
# ===========================================================================
# Secret Scanning (gitleaks - industry standard, widely used)
# ===========================================================================
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.4
hooks:
- id: gitleaks
# ===========================================================================
# Rust Backend
# ===========================================================================
- repo: local
hooks:
# Rust Format Check
- id: rust-fmt
name: Rust Format (cargo fmt)
entry: bash -c 'cd src/backend && cargo fmt --all'
language: system
files: \.rs$
pass_filenames: false
# Rust Linting
- id: rust-clippy
name: Rust Lint (cargo clippy)
entry: bash -c 'cd src/backend && cargo clippy --all-targets --all-features -- -D warnings'
language: system
files: \.rs$
pass_filenames: false
# Rust Build Check
- id: rust-build
name: Rust Build (cargo build)
entry: bash -c 'cd src/backend && cargo build'
language: system
files: \.rs$
pass_filenames: false
# Rust Unit Tests
- id: rust-test
name: Rust Tests (cargo test)
entry: bash -c 'cd src/backend && cargo test'
language: system
files: \.rs$
pass_filenames: false
# ===========================================================================
# Frontend (TypeScript/React)
# ===========================================================================
- repo: local
hooks:
# TypeScript Type Check
- id: frontend-typecheck
name: Frontend TypeScript Check
entry: bash -c 'cd src/frontend && bun run build -- --noEmit 2>/dev/null || (bun run build 2>&1 | head -50)'
language: system
files: \.(ts|tsx)$
pass_filenames: false
# Frontend Lint (ESLint)
- id: frontend-lint
name: Frontend Lint (ESLint)
entry: bash -c 'cd src/frontend && bun run lint'
language: system
files: \.(ts|tsx|js|jsx)$
pass_filenames: false
# Frontend Build
- id: frontend-build
name: Frontend Build
entry: bash -c 'cd src/frontend && bun run build'
language: system
files: \.(ts|tsx|js|jsx|css|html)$
pass_filenames: false
# ===========================================================================
# Playwright E2E Tests (optional - can be slow, run on push instead)
# ===========================================================================
# Uncomment below to run E2E tests on every commit (may be slow)
# - repo: local
# hooks:
# - id: playwright-tests
# name: Playwright E2E Tests
# entry: bash -c 'cd src/frontend && bun x playwright test'
# language: system
# files: \.(ts|tsx)$
# pass_filenames: false
# stages: [push] # Only run on push, not on every commit
# =============================================================================
# Configuration
# =============================================================================
default_stages: [pre-commit]
fail_fast: false