Skip to content

Commit d5ee482

Browse files
committed
lefthook added a mutex for git add commands so we can safely run everything in parallel
1 parent fb3739c commit d5ee482

1 file changed

Lines changed: 101 additions & 108 deletions

File tree

lefthook.yml

Lines changed: 101 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,106 @@
11
pre-commit:
22
parallel: true
3-
4-
jobs:
5-
# Fixes group - runs sequentially to avoid git conflicts
6-
- group:
7-
parallel: false
8-
jobs:
9-
- name: fix-whitespace
10-
file_types:
11-
- text
12-
exclude: "**/.*"
13-
run: |
14-
for file in {staged_files}; do
15-
if [[ -f "$file" ]]; then
16-
# Remove trailing whitespace (portable sed usage)
17-
if [[ "$OSTYPE" == "darwin"* ]]; then
18-
sed -i '' 's/[[:space:]]*$//' "$file"
19-
else
20-
sed -i 's/[[:space:]]*$//' "$file"
21-
fi
22-
# Ensure file ends with newline
23-
if [[ -s "$file" ]] && [[ $(tail -c1 "$file" | wc -l) -eq 0 ]]; then
24-
echo >> "$file"
25-
fi
26-
fi
27-
done
28-
stage_fixed: true
29-
30-
- name: fmt
31-
glob: "*.rs"
32-
run: cargo fmt --all
33-
stage_fixed: true
34-
35-
- name: toml-fmt
36-
glob: "*.toml"
37-
run: taplo format {staged_files}
38-
stage_fixed: true
39-
40-
- name: docs-prettier
41-
root: docs/
42-
glob: "*.{md,mdx,astro}"
43-
run: pnpm format
44-
stage_fixed: true
45-
46-
- name: docs-check
47-
root: docs/
48-
glob: "*.{md,mdx,astro,ts,js,json}"
49-
run: pnpm check
50-
51-
# Checks group - runs in parallel
52-
- group:
53-
parallel: true
54-
jobs:
55-
- name: clippy
56-
glob: "*.rs"
57-
run: cargo clippy --all-targets --all-features
58-
59-
- name: typos
60-
glob: "*.{rs,md,txt,toml,yml,yaml}"
61-
run: typos {staged_files}
62-
63-
- name: test
64-
glob: "*.rs"
65-
run: cargo test
66-
67-
- name: mcp-biome
68-
root: renamify-mcp/
69-
glob: "*.{ts,js,json}"
70-
run: biome check --write
71-
72-
- name: mcp-test
73-
root: renamify-mcp/
74-
glob: "*.ts"
75-
run: pnpm test
76-
77-
- name: mcp-tsc
78-
root: renamify-mcp/
79-
glob: "*.ts"
80-
run: tsc --noEmit
81-
82-
- name: vscode-biome
83-
root: renamify-vscode/
84-
glob: "*.{ts,js,json}"
85-
run: biome check --write
86-
87-
# Too slow, just run this on CI
88-
# - name: vscode-test
89-
# root: renamify-vscode/
90-
# glob: "*.ts"
91-
# run: pnpm test
92-
93-
- name: vscode-tsc
94-
root: renamify-vscode/
95-
glob: "*.ts"
96-
run: pnpm typecheck
97-
98-
- name: shellcheck
99-
glob: "*.sh"
100-
run: shellcheck {staged_files}
101-
102-
- name: shellcheck-scripts
103-
glob: "**/scripts/*"
104-
exclude: "*.md|*.txt|*.rs|*.toml|*.yml|*.yaml|*.json"
105-
run: |
106-
for file in {staged_files}; do
107-
if head -n 1 "$file" | grep -qE '^#!/(usr/)?bin/(ba)?sh' || [[ "$file" =~ \.sh$ ]]; then
108-
shellcheck "$file"
109-
fi
110-
done
3+
commands:
4+
fix-whitespace:
5+
file_types:
6+
- text
7+
exclude: "**/.*"
8+
run: |
9+
for file in {staged_files}; do
10+
if [[ -f "$file" ]]; then
11+
# Remove trailing whitespace (portable sed usage)
12+
if [[ "$OSTYPE" == "darwin"* ]]; then
13+
sed -i '' 's/[[:space:]]*$//' "$file"
14+
else
15+
sed -i 's/[[:space:]]*$//' "$file"
16+
fi
17+
# Ensure file ends with newline
18+
if [[ -s "$file" ]] && [[ $(tail -c1 "$file" | wc -l) -eq 0 ]]; then
19+
echo >> "$file"
20+
fi
21+
fi
22+
done
23+
stage_fixed: true
24+
25+
fmt:
26+
glob: "*.rs"
27+
run: cargo fmt --all
28+
stage_fixed: true
29+
30+
toml-fmt:
31+
glob: "*.toml"
32+
run: taplo format {staged_files}
33+
stage_fixed: true
34+
35+
docs-prettier:
36+
root: docs/
37+
glob: "*.{md,mdx,astro}"
38+
run: pnpm format
39+
stage_fixed: true
40+
41+
docs-check:
42+
root: docs/
43+
glob: "*.{md,mdx,astro,ts,js,json}"
44+
run: pnpm check
45+
46+
clippy:
47+
glob: "*.rs"
48+
run: cargo clippy --all-targets --all-features
49+
50+
typos:
51+
glob: "*.{rs,md,txt,toml,yml,yaml}"
52+
run: typos {staged_files}
53+
54+
test:
55+
glob: "*.rs"
56+
run: cargo test
57+
58+
mcp-biome:
59+
root: renamify-mcp/
60+
glob: "*.{ts,js,json}"
61+
run: biome check --write
62+
stage_fixed: true
63+
64+
mcp-test:
65+
root: renamify-mcp/
66+
glob: "*.ts"
67+
run: pnpm test
68+
69+
mcp-tsc:
70+
root: renamify-mcp/
71+
glob: "*.ts"
72+
run: tsc --noEmit
73+
74+
vscode-biome:
75+
root: renamify-vscode/
76+
glob: "*.{ts,js,json}"
77+
run: biome check --write
78+
stage_fixed: true
79+
80+
# Too slow, just run this on CI
81+
# vscode-test:
82+
# root: renamify-vscode/
83+
# glob: "*.ts"
84+
# run: pnpm test
85+
86+
vscode-tsc:
87+
root: renamify-vscode/
88+
glob: "*.ts"
89+
run: pnpm typecheck
90+
91+
shellcheck:
92+
glob: "*.sh"
93+
run: shellcheck {staged_files}
94+
95+
shellcheck-scripts:
96+
glob: "**/scripts/*"
97+
exclude: "*.md|*.txt|*.rs|*.toml|*.yml|*.yaml|*.json"
98+
run: |
99+
for file in {staged_files}; do
100+
if head -n 1 "$file" | grep -qE '^#!/(usr/)?bin/(ba)?sh' || [[ "$file" =~ \.sh$ ]]; then
101+
shellcheck "$file"
102+
fi
103+
done
111104
112105
# pre-push:
113106
# commands:

0 commit comments

Comments
 (0)