-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
74 lines (73 loc) · 1.92 KB
/
lefthook.yml
File metadata and controls
74 lines (73 loc) · 1.92 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
# Lefthook configuration for cigen
# https://github.com/evilmartians/lefthook
pre-commit:
jobs:
- name: trim-trailing-whitespace
run: |
for file in {staged_files}; do
if [[ -f "$file" ]]; then
# Remove trailing whitespace (portable sed usage)
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/[[:space:]]*$//' "$file"
else
sed -i 's/[[:space:]]*$//' "$file"
fi
# Ensure file ends with newline
if [[ -s "$file" && -z $(tail -c 1 "$file" | od -An -tx1) ]]; then
echo >> "$file"
fi
fi
done
file_types:
- text
stage_fixed: true
- run: pnpm exec ultracite fix {staged_files}
glob:
- "*.js"
- "*.jsx"
- "*.ts"
- "*.tsx"
- "*.json"
- "*.jsonc"
- "*.css"
- "**/*.js"
- "**/*.jsx"
- "**/*.ts"
- "**/*.tsx"
- "**/*.json"
- "**/*.jsonc"
- "**/*.css"
stage_fixed: true
- run: pnpm exec prettier --write {staged_files}
exclude: "^AGENTS\\.md$"
glob:
- "*.yml"
- "*.yaml"
- "*.md"
- "**/*.yml"
- "**/*.yaml"
- "**/*.md"
stage_fixed: true
parallel: true
commands:
fmt:
glob: "*.rs"
run: cargo fmt --all
stage_fixed: true
clippy:
glob: "*.rs"
run: cargo clippy --all-targets --all-features -- -D warnings
test:
glob: "*.rs"
run: cargo test
actionlint:
glob: ".github/workflows/*.{yml,yaml}"
run: |
if ! command -v actionlint &> /dev/null; then
echo "actionlint not found. Please install it:"
echo " brew install actionlint"
echo " or"
echo " go install github.com/rhysd/actionlint/cmd/actionlint@latest"
exit 1
fi
actionlint {staged_files}