-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathlefthook.yaml
More file actions
78 lines (66 loc) · 2.14 KB
/
Copy pathlefthook.yaml
File metadata and controls
78 lines (66 loc) · 2.14 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
pre-commit:
parallel: true
jobs:
- name: gitleaks
run: gitleaks protect --verbose --redact --staged
- name: end-of-file-fixer
glob: "*"
exclude: "LICENSE"
run: |
for file in {staged_files}; do
if [ -n "$(tail -c 1 "$file")" ]; then
echo >> "$file"
git add "$file"
fi
done
# YAML
- name: check-yaml
glob: "*.{yaml,yml}"
run: |
for file in {staged_files}; do
python -c "import yaml; yaml.safe_load(open('$file'))" || exit 1
done
# Python — ruff replaces black + flake8 + isort + bandit + add-trailing-comma;
# ty replaces mypy. Both are Astral Rust binaries, an order of magnitude
# faster than the toolchain they superseded.
- name: ruff-format
glob: "*.py"
exclude: ".venv/"
run: uv run ruff format {staged_files}
- name: ruff-check
glob: "*.py"
exclude: ".venv/"
run: uv run ruff check --fix {staged_files}
- name: ty
glob: "*.py"
exclude: ".venv/"
# ty does whole-project inference; running on the full source roots is
# both faster and more accurate than a per-file invocation.
run: uv run ty check rogue sdks/python hatch_build.py
- name: uv lock check
glob: "pyproject.toml"
run: uv lock --check
# Go
- name: gofmt
glob: "*.go"
run: gofmt -s -w {staged_files}
- name: goimports
glob: "*.go"
run: goimports -w {staged_files}
- name: go vet
glob: "*.go"
run: (cd packages/tui && go vet ./...)
# Web (TypeScript / React)
# `root:` rebases {staged_files} so they're relative to packages/web,
# which is what prettier/eslint expect when their config lives there.
- name: prettier-web
root: "packages/web/"
glob: "*.{ts,tsx,js,jsx,json,css,md}"
run: pnpm exec prettier --write {staged_files}
- name: eslint-web
root: "packages/web/"
glob: "*.{ts,tsx,js,jsx}"
run: pnpm exec eslint --fix {staged_files}
- name: tsc-web
glob: "packages/web/**/*.{ts,tsx}"
run: (cd packages/web && pnpm exec tsc --noEmit)