-
Notifications
You must be signed in to change notification settings - Fork 238
Expand file tree
/
Copy pathlefthook.yml
More file actions
120 lines (108 loc) · 3.77 KB
/
lefthook.yml
File metadata and controls
120 lines (108 loc) · 3.77 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
# Lefthook configuration
# See https://github.com/evilmartians/lefthook for documentation
#
# ===================================================================
# How to skip hooks:
# ===================================================================
#
# Skip ALL pre-commit hooks:
# LEFTHOOK=0 git commit -m "message"
#
# Skip specific commands:
# LEFTHOOK_EXCLUDE=check-main-branch git commit -m "message"
# LEFTHOOK_EXCLUDE=ggshield-scan,package-lock-check git commit -m "message"
#
# Skip only linting/type-checking (front and connectors):
# LEFTHOOK_EXCLUDE=front-lint-test-filenames,front-lint-swagger-annotations,front-typecheck,front-circular,front-docs-check,biome-format,front-biome-lint,connectors-lint-test-filenames,connectors-typecheck,connectors-biome-lint git commit -m "message"
#
# Skip only a project:
# LEFTHOOK_EXCLUDE=front git commit -m "message"
#
# Interactive mode (choose which commands to run):
# lefthook run pre-commit --interactive
#
# ===================================================================
output:
- meta # Print lefthook version
- summary # Print summary block (successful and failed steps)
- empty_summary # Print summary heading when there are no steps to run
- success # Print successful steps
- failure # Print failed steps printing
# - execution # Print any execution logs
# - execution_out # Print execution output
# - execution_info # Print `EXECUTE > ...` logging
- skips # Print "skip" (i.e. no files matched)
pre-commit:
# Run tasks in parallel for better performance
parallel: true
commands:
# Check if committing to main branch
check-main-branch:
run: |
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" = "main" ]; then
echo "Error: Committing to 'main' is not allowed. Use LEFTHOOK_EXCLUDE=check-main-branch to override."
exit 1
fi
priority: 1
# Optional: ggshield secret scanning (skip with LEFTHOOK_EXCLUDE=ggshield-scan)
ggshield-scan:
run: |
if command -v ggshield 2>&1 >/dev/null; then
ggshield secret scan pre-commit
else
echo "ggshield is not installed. Skipping secret scan. Install ggshield or use LEFTHOOK_EXCLUDE=ggshield-scan"
exit 0
fi
priority: 1
# Optional: package-lock.json sync check (skip with LEFTHOOK_EXCLUDE=package-lock-check)
package-lock-check:
glob: "**/package*.json"
run: scripts/check-package-lock-sync.sh
priority: 1
# Front directory checks
front-lint-test-filenames:
tags: front
glob: "*.{js,jsx,ts,tsx}"
root: front/
run: npm run lint:test-filenames
front-lint-swagger-annotations:
tags: front
glob: "front/pages/api/v1/**/*.ts"
root: front/
run: npm run lint:swagger-annotations
front-typecheck:
tags: front
glob: "*.{js,jsx,ts,tsx}"
root: front/
run: npm run tsgo
front-docs-check:
tags: front
glob: "front/pages/api/v1/**/*"
root: front/
run: npm run docs:check
# Connectors directory checks
connectors-typecheck:
tags: connectors
glob: "*.{js,jsx,ts,tsx}"
root: connectors/
run: npm run tsgo
# Core (Rust) format check
core-fmt:
tags: core
glob: "*.rs"
root: core/
run: cargo fmt -- {staged_files}
stage_fixed: true
# Dust Sandbox (Rust) format check
dust-sandbox-fmt:
tags: dust-sandbox
glob: "*.rs"
root: cli/dust-sandbox/
run: cargo fmt -- {staged_files}
stage_fixed: true
# Biome checks (all JS/TS files in monorepo)
biome:
glob: "*.{js,jsx,ts,tsx,css,scss}"
run: npm run biome:lefthook -- {staged_files}
stage_fixed: true