-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
88 lines (80 loc) · 3.42 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
88 lines (80 loc) · 3.42 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
79
80
81
82
83
84
85
86
87
88
default_install_hook_types: [pre-commit, pre-push]
default_stages: [pre-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-json
exclude: tsconfig.*\.json$|frontend/apps/demo/public/
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
# Patch files carry significant whitespace: a blank context line is a
# single space, and normalising it stops pnpm applying the patch.
- id: end-of-file-fixer
stages: [pre-commit]
exclude: ^frontend/(apps/demo/public/|patches/)
- id: trailing-whitespace
stages: [pre-commit]
exclude: ^frontend/(apps/demo/public/|patches/)
# Recorded HTTP cassettes are scrubbed at record time; this gate catches
# anything the scrubbing missed before it can be committed. Known-benign
# matches live in .secrets.baseline (regenerate with:
# uvx detect-secrets scan api/tests/mock/mymdc/mymdc.yaml \
# api/tests/refactor/e2e/cassettes/*/*.yaml > .secrets.baseline).
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
name: detect-secrets (recorded cassettes)
args: ["--baseline", ".secrets.baseline"]
files: ^api/tests/(mock/mymdc/.*\.ya?ml|refactor/e2e/cassettes/.*\.ya?ml)$
# ruff walks up from each file to find api/ruff.toml automatically
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.8
hooks:
- id: ruff-check
files: ^api/
- id: ruff-format
files: ^api/
# Local hooks cd into subdirectories and strip the prefix from
# file arguments so tools see project-relative paths.
- repo: local
hooks:
- id: uv-lock
name: uv-lock
entry: uv lock
language: system
files: (^|api/)pyproject\.toml$|^uv\.lock$
pass_filenames: false
# pyright temporarily disabled while a backend change is in flight.
# Uncomment to restore (already set up for pre-push).
# - id: pyright
# name: pyright
# entry: bash -c 'cd api && uv run --group lint pyright'
# language: system
# files: ^api/
# types: [python]
# pass_filenames: false
# stages: [pre-push]
- id: frontend-eslint
name: frontend-eslint
entry: bash -c '. scripts/ensure-node.sh && cd frontend && pnpm exec eslint --fix --cache --cache-location node_modules/.cache/eslint/.eslintcache "${@#frontend/}"' --
language: system
files: ^frontend/
types_or: [javascript, jsx, ts, tsx]
- id: frontend-prettier
name: frontend-prettier
entry: bash -c '. scripts/ensure-node.sh && cd frontend && pnpm exec prettier --write "${@#frontend/}"' --
language: system
files: ^frontend/
types_or: [javascript, jsx, ts, tsx, json, html, css, markdown]
- id: frontend-tsc
name: frontend-tsc
entry: bash -c '. scripts/ensure-node.sh && cd frontend && pnpm exec tsc -b --noEmit'
language: system
files: ^frontend/
types_or: [ts, tsx]
pass_filenames: false
stages: [pre-push]