-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
93 lines (86 loc) · 2.61 KB
/
.pre-commit-config.yaml
File metadata and controls
93 lines (86 loc) · 2.61 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
89
90
91
92
93
# Unified pre-commit config for frontend and backend
# See https://pre-commit.com for more information
ci:
autofix_prs: false
autoupdate_schedule: quarterly
autoupdate_branch: pre-commit-autoupdate
# Combine excludes from both subprojects, and keep path scoping in hooks below
exclude: |
(?x)^(
backend/tests/test-data/.*|
backend/.venv/.*|
backend/venv/.*|
frontend/dist/.*|
frontend/node_modules/.*|
frontend/public/.*|
frontend/src/client/.*|
.*\.gen\.ts$
)$
repos:
# Shared general-purpose checks across the repo
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
files: ^backend/
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
args: [--unsafe]
- id: debug-statements
files: ^backend/
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
# Backend: Ruff (lint + format)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
files: ^backend/
- id: ruff-format
files: ^backend/
# Backend: mypy and check that no forbidden files are present
- repo: local
hooks:
- id: backend-forbidden-files
name: backend forbidden files
entry: found Copier update rejection files; review them and remove them
language: fail
files: "\\.rej$"
- id: mypy
name: mypy (backend)
entry: make -C backend mypy
language: system
types: [python]
pass_filenames: false
require_serial: true
files: ^backend/
# Frontend: Biome format + lint
- repo: local
hooks:
- id: biome-format
name: Biome format (write)
entry: bash -lc "cd frontend && npx --yes @biomejs/biome check --write"
language: system
files: ^frontend/.*\.(ts|tsx|js|jsx|json|md|css)$
pass_filenames: true
- id: biome-lint
name: Biome lint
entry: bash -lc "cd frontend && npx --yes @biomejs/biome check"
language: system
files: ^frontend/.*\.(ts|tsx|js|jsx)$
pass_filenames: true
# Frontend: TypeScript typecheck
- id: typescript-typecheck
name: TypeScript typecheck
entry: bash -lc "cd frontend && npx --yes tsc --noEmit"
language: system
pass_filenames: false
files: ^frontend/