-
Notifications
You must be signed in to change notification settings - Fork 353
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
66 lines (62 loc) · 2.12 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
66 lines (62 loc) · 2.12 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
# Pre-commit hooks for open-kritt.
# Install once: pipx install pre-commit && pre-commit install
# Run on all: pre-commit run --all-files
#
# Hooks are scoped per ecosystem so contributors only need the relevant toolchain.
repos:
# Generic hygiene
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: '\.md$'
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-added-large-files
args: ['--maxkb=512']
- id: check-yaml
- id: check-json
- id: mixed-line-ending
args: ['--fix=lf']
# Detect accidentally committed secrets
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
# Python (engine) — lint + format with Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: ruff
args: ['--fix']
files: '^engine/'
- id: ruff-format
files: '^engine/'
# JS/JSX (frontend + backend) — Prettier + ESLint via local toolchains
- repo: local
hooks:
- id: prettier
name: prettier (frontend + backend)
entry: bash -c 'cd "$(git rev-parse --show-toplevel)" && npx --prefix frontend prettier --check frontend backend'
language: system
pass_filenames: false
files: '\.(js|jsx|json|css)$'
- id: eslint-frontend
name: eslint (frontend)
entry: bash -c 'cd frontend && npx eslint .'
language: system
pass_filenames: false
files: '^frontend/.*\.(js|jsx)$'
- id: eslint-backend
name: eslint (backend)
entry: bash -c 'cd backend && npx eslint .'
language: system
pass_filenames: false
files: '^backend/.*\.js$'
# Version drift guard — keep all components pinned to the root VERSION file.
- id: version-sync
name: version sync check
entry: node scripts/sync-version.mjs --check
language: system
pass_filenames: false
files: '^(VERSION|frontend/package\.json|backend/package\.json|engine/open_kritt_engine/__init__\.py)$'