-
Notifications
You must be signed in to change notification settings - Fork 398
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
102 lines (87 loc) · 2.88 KB
/
.pre-commit-config.yaml
File metadata and controls
102 lines (87 loc) · 2.88 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
# Prek/pre-commit configuration
# Install: prek install (or: pre-commit install)
# Run manually: prek run --all-files
fail_fast: false
exclude: |
(?x)^(
crates/.*/snapshots/.*
)$
repos:
# Fast built-in hooks (no network, no environment setup)
- repo: builtin
hooks:
- id: no-commit-to-branch
args: [-b, canary]
always_run: true
fail_fast: true
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
fail_fast: true
files: ^baml_language/
# Exclude: snapshots, IDE test files, and special test files (class.rs, enum.rs)
exclude: (baml_tests/projects/|lsp_actions_tests/test_files/|lsp2_actions_tests/test_files/|\.snap$|class\.rs$|enum\.rs$)
- id: check-merge-conflict
fail_fast: true
- id: check-toml
fail_fast: true
- id: check-yaml
fail_fast: true
- repo: local
hooks:
# Priority ordering:
# 0: Code generation (rig) - must run first to generate files
# 1: Formatters and validators (fmt, stow, bep-readme) - format/validate generated code
# 2: Linters (clippy) - final checks on formatted code
- id: rig
name: rig
entry: bash -c 'cd baml_language && cargo run -p tools_rig -- --check'
language: system
pass_filenames: false
files: ^baml_language/(rig_tests/|crates/tools_rig/|crates/baml_codegen)
priority: 1
- id: cargo-fmt
name: cargo fmt
entry: bash -c 'cd baml_language && mise run fmt'
language: system
pass_filenames: false
types: [rust]
files: ^baml_language/
priority: 2
- id: cargo-stow
name: cargo stow
entry: bash -c 'cd baml_language && mise run stow'
language: system
pass_filenames: false
files: ^baml_language/(Cargo\.toml|stow\.toml|crates/.*/Cargo\.toml|crates/tools_stow/)
priority: 2
- id: bep-readme
name: bep readme
entry: bash -c 'mise run bep:readme'
language: system
pass_filenames: false
files: ^beps/
priority: 3
- id: validate-markdown
name: validate markdown files
entry: bash -c 'cd baml_language && mise run validate-markdown'
language: system
pass_filenames: false
files: ^baml_language/(.*\.md|\.markdown-whitelist)$
priority: 0
- id: cargo-clippy
name: cargo clippy
entry: bash -c 'cd baml_language && mise run clippy'
language: system
pass_filenames: false
types: [rust]
files: ^baml_language/
priority: 3
- id: cargo-clippy-wasm
name: cargo clippy (wasm)
entry: bash -c 'cd baml_language && mise run clippy-wasm'
language: system
pass_filenames: false
types: [rust]
files: ^baml_language/
priority: 4
stages: [manual]