Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
100 lines (96 loc) · 3.7 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
100 lines (96 loc) · 3.7 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
94
95
96
97
98
99
100
fail_fast: true
# `pre-commit install` sets up both: the checks below on commit, and the Conventional Commit check on its message
default_install_hook_types: [pre-commit, commit-msg]
default_stages: [pre-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=500"]
exclude: >
(?x)^(
package-lock\.json
)$
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: detect-private-key
- id: check-yaml
args: [--unsafe] # mkdocs.yml uses Python tags
- id: check-toml
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.7.7.23
hooks:
- id: actionlint
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.12.2
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
- repo: local
hooks:
- id: conventional-commit
name: Conventional Commit message
entry: python3 .github/scripts/release.py check-message
language: system
stages: [commit-msg]
- id: frontend-lint
name: run frontend lint
entry: sh -c 'cd nextjs-frontend && pnpm run lint'
language: system
types: [ file ]
files: ^nextjs-frontend/.*\.(js|jsx|ts|tsx)$
pass_filenames: false # the command checks the whole app; with file names, pre-commit runs it once per batch of files, in parallel
- id: frontend-prettier
name: Run Prettier on frontend files
entry: sh -c 'cd nextjs-frontend && pnpm run prettier'
language: system
types: [ file ]
files: ^nextjs-frontend/.*\.(js|jsx|ts|tsx)$
pass_filenames: false # the command checks the whole app; with file names, pre-commit runs it once per batch of files, in parallel
- id: frontend-tsc
name: run frontend tsc
entry: sh -c 'cd nextjs-frontend && pnpm run tsc'
language: system
types: [ file ]
files: ^nextjs-frontend/.*\.(ts|tsx)$
pass_filenames: false
- id: generate-openapi-schema
name: generate OpenAPI schema
entry: sh -c 'cd fastapi_backend && uv run python -m commands.generate_openapi_schema'
language: system
# Only when the app, its routes, its schemas or the package version change:
files: ^fastapi_backend/(app/main\.py|app/api/.*\.py|app/schemas/.*\.py|pyproject\.toml)$
pass_filenames: false
46E1
- id: generate-frontend-client
name: generate frontend client
entry: sh -c 'cd nextjs-frontend && pnpm run generate-client'
language: system
# Only run frontend client generation if frontend files have changed:
files: openapi\.json$
pass_filenames: false
- id: requirements
name: README requirements name checks that exist (docs/requirements.md)
entry: python3 ci/check_requirements.py
language: system
always_run: true # a test, journey or workflow step can go without the README changing
pass_filenames: false
- id: requirements-tests
name: tests of the requirements check
entry: python3 ci/test_check_requirements.py
language: system
files: ^ci/(check|test_check)_requirements\.py$
pass_filenames: false
- id: release-tests
name: tests of the release script (changelog fragments)
entry: python3 .github/scripts/test_release.py
language: system
files: ^\.github/scripts/(release|test_release)\.py$
pass_filenames: false