-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
118 lines (110 loc) · 4.59 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
118 lines (110 loc) · 4.59 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Pre-commit hooks: mirror the fast checks in .github/workflows/ci.yml so
# common failures (ruff, eslint, lockfile drift, EOF newline, etc.) are caught
# locally before they hit CI.
#
# Setup (one-time, per developer):
# pip install pre-commit # or: pipx install pre-commit
# pre-commit install # installs the pre-commit git hook
# pre-commit install --hook-type pre-push
# pre-commit run --all-files # optional one-time clean-up pass
#
# Bypass (emergencies only -- CI will still gate):
# git commit --no-verify
# git push --no-verify
default_install_hook_types: [pre-commit, pre-push]
fail_fast: false
repos:
# ------------------------------------------------------------------
# Generic hygiene: syntax validation and small auto-fixes.
# ------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
# Catches the same class of issue as ruff's W292
# ("no newline at end of file"), but for every text file in
# the repo -- not only Python.
exclude: ^services/(py-genai-helper/generated|spring-.*/src/generated)/
- id: trailing-whitespace
# Preserve intentional two-space line breaks in markdown.
args: [--markdown-linebreak-ext=md]
exclude: ^services/(py-genai-helper/generated|spring-.*/src/generated)/
- id: check-yaml
# --allow-multiple-documents is defensive for the planned
# Helm charts under infra/; current YAML files are all
# single-document and unaffected.
args: [--allow-multiple-documents]
# docker-compose.override.yml uses Compose's custom `!override`
# tag, which strict YAML parsers (PyYAML) cannot resolve.
# infra/helm/**/templates/* are Helm (Go-template) files, not plain
# YAML, so PyYAML cannot parse their `{{ ... }}` directives.
exclude: |
(?x)^(
infra/docker-compose\.override\.yml|
infra/helm/.*/templates/.*
)$
- id: check-json
# tsconfig*.json files use JSONC (comments allowed), which is
# valid for TypeScript but rejected by strict JSON parsers.
exclude: ^web-client/tsconfig.*\.json$
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=500]
# ------------------------------------------------------------------
# Python: ruff lint + format, scoped to services/py-genai-helper.
# Version kept in sync with services/py-genai-helper/requirements-dev.txt
# ("ruff>=0.6").
# ------------------------------------------------------------------
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
name: ruff (lint + autofix)
args: [--fix]
files: ^services/py-genai-helper/.*\.py$
exclude: ^services/py-genai-helper/generated/
- id: ruff-format
name: ruff-format
files: ^services/py-genai-helper/.*\.py$
exclude: ^services/py-genai-helper/generated/
# ------------------------------------------------------------------
# Local hooks -- delegate to the project's own toolchain (pnpm,
# gradle) so lint configuration and tool versions stay
# identical to CI. Logic lives in scripts/hooks/*.sh, which makes
# the hooks shellcheck-able and runnable standalone for debugging.
# ------------------------------------------------------------------
- repo: local
hooks:
- id: eslint
name: eslint (web-client, --fix)
language: system
entry: scripts/hooks/run-eslint.sh
files: ^web-client/.*\.(js|jsx|ts|tsx|mjs|cjs)$
pass_filenames: true
- id: pnpm-lock-sync
name: pnpm-lock-sync (web-client)
language: system
entry: scripts/hooks/sync-pnpm-lock.sh
files: ^web-client/package\.json$
pass_filenames: false
- id: spectral-openapi
name: spectral (api/openapi.yaml)
language: system
entry: scripts/hooks/run-spectral.sh
files: ^api/openapi\.yaml$
pass_filenames: false
stages: [pre-push]
- id: checkstyle
name: checkstyle (all Spring services)
language: system
entry: scripts/hooks/run-checkstyle.sh
files: ^services/spring-.*/.*\.java$
pass_filenames: false
stages: [pre-push]
- id: openapi-codegen
name: openapi codegen (all services)
language: system
entry: scripts/hooks/run-codegen.sh
files: ^api/openapi\.yaml$
pass_filenames: false
stages: [pre-commit]