-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
75 lines (69 loc) · 2.36 KB
/
.pre-commit-config.yaml
File metadata and controls
75 lines (69 loc) · 2.36 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
# See https://github.com/pre-commit for more information
# jhrg 7/14/24
#
# Updated via ChatGPT to fix issues with JSON files. This stemmed from
# the addition of the CMake Preset JSON file. CLang is not a good way
# to format JSON. This fixes that and adds a few other features. jhrg 10/31/25
#
# Multi-language: C/C++ (clang-format), JSON (prettier), YAML (prettier + yamllint)
# Run: pre-commit install && pre-commit run --all-files
fail_fast: false
default_stages: [pre-commit]
# Common exclusions (build outputs)
exclude: |
(?x)(
^(autotest|build|retired|conf|gl|\.git|\.cache)/
)
repos:
# --- Baseline sanity checks (fast, safe) ---
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
# This is lame, and there's supposed to be a better way, but I cannot
# get it to work on OSX and in GitHub's action. jhrg 10/31/25
exclude: |
(?x)(
^(unit-tests|tests|autotest|build|retired|conf|gl|\.git|\.cache)/
)
- id: trailing-whitespace
exclude: |
(?x)(
^(unit-tests|tests|autotest|build|retired|conf|gl|\.git|\.cache)/
)
- id: check-yaml
- id: check-json
exclude: |
(?x)(
^(\.vscode)/
)
- id: mixed-line-ending
exclude: |
(?x)(
^(unit-tests|tests|autotest|build|retired|conf|gl|\.git|\.cache)/
)
args: ["--fix=lf"] # <— converts CRLF → LF on staged files
# --- C/C++ formatting (clang-format reads your .clang-format) ---
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
hooks:
- id: clang-format
args: [--style=file, -i]
types_or: [c, c++]
# --- YAML linting (rules via .yamllint.yml if present) ---
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
types_or: [yaml]
# --- Formatting for JSON (and YAML/MD if you want) ---
# Pin Prettier version via additional_dependencies.
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args: ["--no-cache"] # Problems with caching on OSX. jhrg 10/31/25
# Choose what Prettier formats:
types_or: [json, yaml, markdown]
additional_dependencies:
- prettier@3.6.0