-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
175 lines (172 loc) · 6.67 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
175 lines (172 loc) · 6.67 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
default_install_hook_types:
- pre-commit
- pre-push
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-merge-conflict
stages:
- pre-commit
- id: mixed-line-ending
# Fixer: pre-commit only. Pre-push must stay check-only so a push
# never mutates the working tree.
stages:
- pre-commit
- repo: https://github.com/adrienverge/yamllint
rev: v1.38.0
hooks:
- id: yamllint
args:
- -c
- .yamllint.yaml
files: '(?i)\.(ya?ml)$'
# YAML is fixed before commit and checked in CI; do not spend pre-push
# budget on non-script/non-asmdef files.
stages:
- pre-commit
- repo: local
hooks:
- id: dotnet-tool-restore
name: Install .NET tools
entry: dotnet tool restore
language: system
files: '^\.config/dotnet-tools\.json$'
pass_filenames: false
stages:
- pre-commit
description: Install the .NET tools listed at .config/dotnet-tools.json.
- id: fix-csharp-underscore-methods
name: Auto-fix C# method names (remove underscores)
entry: node scripts/fix-csharp-underscore-methods.js
language: system
types:
- c#
stages:
- pre-commit
- id: csharpier
name: Run CSharpier on C# files
entry: dotnet tool run csharpier format
language: system
types:
- c#
require_serial: true
stages:
- pre-commit
description: Opinionated C# formatter. Restage files it rewrites.
- id: sync-banner-version
name: Sync banner version from package.json
entry: node scripts/sync-banner-version.js
language: system
# The banner version is derived solely from package.json, so the hook
# only needs to run when package.json or the banner itself is staged.
files: (^package\.json$|^docs/images/DxMessaging-banner\.svg$)
pass_filenames: false
stages:
- pre-commit
description: >-
Sync the package version into the SVG banner. If it rewrites the
banner, pre-commit reports the modified file; restage and commit
again.
- id: prettier
name: Prettier (markdown, JSON, asmdef, asmref, YAML)
entry: npx --no-install prettier --write
language: system
files: '(?i)\.(md|markdown|json|asmdef|asmref|ya?ml)$'
require_serial: true
stages:
- pre-commit
- id: markdownlint
name: markdownlint-cli2
entry: npx --no-install markdownlint-cli2 --fix
language: system
files: '(?i)\.(md|markdown)$'
stages:
- pre-commit
- id: update-llms-txt
name: Verify llms.txt is up-to-date
entry: node scripts/update-llms-txt.js --check
language: system
pass_filenames: false
# always_run (not a files: filter): pre-commit's changed-file list
# excludes deletions, so a files: pattern would never fire when a
# .llm/skills/*.md file is deleted, even though llms.txt enumerates
# the skills directory and would go stale until CI's
# validate-llms-txt workflow caught it. The --check run is fast and
# idempotent, so run it on every commit.
always_run: true
stages:
- pre-commit
description: Run "npm run update:llms-txt" when this fails.
- id: llm-harness
name: Verify .llm skill harness is current
entry: node scripts/llm/harness.js check
language: system
pass_filenames: false
# always_run for the same reason as update-llms-txt: pre-commit's
# changed-file list excludes deletions, so a files: pattern would miss
# a removed skill even though .llm/index.md and the context registry
# block both enumerate the skills directory.
always_run: true
stages:
- pre-commit
description: Run "npm run llm:index" when this fails.
- id: validate-devcontainer-cache-contract
name: Validate devcontainer cache mounts
entry: bash .devcontainer/validate-caching.sh
language: system
files: '^\.devcontainer/'
pass_filenames: false
stages:
- pre-commit
description: >-
Validate named-volume mounts, ownership, and cache paths when the
devcontainer configuration changes.
- id: validate-asmdef-references
name: Validate asmdef precompiled references
entry: node scripts/validate-asmdef-references.js
language: system
pass_filenames: false
files: '\.asmdef$'
stages:
- pre-push
description: >-
Fail when a package asmdef populates precompiledReferences while
overrideReferences is false (compiles in the Editor but breaks
standalone/IL2CPP player builds).
- id: validate-unity-metas
name: Validate repository Unity .meta files
entry: node scripts/validate-npm-meta.js --repo-metas-only
language: system
pass_filenames: false
# Run for every commit because pre-commit's changed-file list omits
# deleted and untracked companions. The git-backed validator is fast
# and detects both missing and orphaned metadata across the repository.
always_run: true
stages:
- pre-commit
description: >-
Fail when an imported tracked asset lacks its .meta companion, a
tracked .meta is orphaned, or a C# .meta has a non-canonical
MonoImporter block.
- id: script-tests
name: Run fast JavaScript script tests (node --test)
# Curated unit/mocked subset only. Real subprocess/archive integration
# tests stay in `npm test` so pre-push remains a fast backstop.
entry: >-
node --test
scripts/lib/__tests__/lib.test.js
scripts/__tests__/analyzer-runtime-placement.test.js
scripts/__tests__/fix-csharp-underscore-methods.test.js
scripts/__tests__/package-script-contract.test.js
scripts/__tests__/sync-banner-version.test.js
scripts/__tests__/unity-perf.test.js
scripts/__tests__/validate-asmdef-references.test.js
scripts/__tests__/validate-npm-meta.test.js
scripts/__tests__/validate-unity-versions.test.js
scripts/wiki/__tests__/transform.test.js
language: system
pass_filenames: false
files: '^(package\.json|Runtime/Analyzers/|Editor/.*\.asmdef|Editor/Analyzers/|Runtime/.*\.asmdef|SourceGenerators/|scripts/.*\.js)$'
stages:
- pre-push