-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
69 lines (65 loc) · 2.33 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
69 lines (65 loc) · 2.33 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
# See https://pre-commit.com for documentation.
# After editing, run: pre-commit autoupdate
#
# Hook strategy:
# - General hygiene (whitespace, large files, private keys) — pre-commit-hooks
# - Python formatting + linting — ruff (replaces black/isort/flake8)
# - Secret detection — gitleaks (runs against the staged diff)
# - mypy + pytest are CI-only (too slow + finicky for every commit)
#
# Install once per clone: pre-commit install
# Run against all files: pre-commit run --all-files
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-added-large-files
args: ["--maxkb=500"]
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-private-key
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
# Belt-and-suspenders: never let the local-state files into a commit
- repo: local
hooks:
- id: beads-leak-scan
name: scan beads issue data for PII / secrets
# bd dolt push bypasses git hooks entirely; this catches leaks in the
# issue DB early, and scripts/bd-push.sh re-checks at push time.
# Stdlib-only + plain python3 + skips-without-bd, so it runs anywhere
# (CI and contributor machines have neither uv-managed venvs nor bd).
entry: python3 scripts/beads_leak_scan.py
language: system
always_run: true
pass_filenames: false
- id: forbid-local-state
name: forbid local config / credentials / state files
entry: |
bash -c '
for f in "$@"; do
case "$f" in
config.toml|credentials.json|sync_state.json|sync.log|launchd.out.log|launchd.err.log)
echo "ERROR: $f is gitignored runtime state — do not commit." >&2
exit 1
;;
esac
done
' --
language: system
files: '^(config\.toml|credentials\.json|sync_state\.json|sync\.log|launchd\..*\.log)$'