-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
39 lines (35 loc) · 1.25 KB
/
Copy pathlefthook.yml
File metadata and controls
39 lines (35 loc) · 1.25 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
# Tokimo monorepo pre-commit hooks (Lefthook)
# 触发:git commit 时自动按文件类型并行 fmt staged 文件
# 文档:https://lefthook.dev
#
# 安装/启用:./scripts/install-hooks.sh(也会在 pnpm install 时自动跑)
# 同步到所有 submodule:./scripts/sync-hooks-to-submodules.sh
pre-commit:
parallel: true
commands:
rustfmt:
tags: rust fmt
glob: "*.rs"
# Shell script in a separate file avoids inline quoting issues on Windows.
run: scripts/lefthook-rustfmt.sh {staged_files}
stage_fixed: true
clippy:
tags: rust lint
glob: "*.rs"
run: cargo clippy --lib --bins --tests -- -D warnings
biome:
tags: web fmt
glob: "*.{ts,tsx,js,jsx,mjs,cjs,json,jsonc,css}"
run: |
files="{staged_files}"
[ -z "$files" ] && exit 0
pnpm exec biome format --write --no-errors-on-unmatched $files
stage_fixed: true
# pre-push 镜像 CI 关键检查,阻止 lint/fmt/clippy 不绿就推到远端,避免 CI 邮件刷屏。
# 紧急情况可以 `git push --no-verify` 绕过。
pre-push:
commands:
fmt-check:
run: cargo fmt -p tokimo-web-fetch -- --check
clippy:
run: cargo clippy -p tokimo-web-fetch --lib --bins --tests -- -D warnings