-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy path.pre-commit-config.yml
More file actions
204 lines (183 loc) · 5.6 KB
/
.pre-commit-config.yml
File metadata and controls
204 lines (183 loc) · 5.6 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/j178/prek/refs/heads/master/prek.schema.json
minimum_prek_version: 0.2.29
default_install_hook_types:
- pre-commit
default_stages:
- pre-commit
# define priority: 0 for linters that don't modify sources
# leave fixers with priority: null so they run sequentially
repos:
# "Built-in Fast Hooks" from prek.
- repo: builtin
hooks:
- id: check-added-large-files
name: Check for large files
priority: 0
- id: check-case-conflict
name: Check for files that would conflict in case-insensitive filesystems
priority: 0
- id: trailing-whitespace
name: Fix trailing whitespace
types: [ text ]
exclude:
glob:
- lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.java
- id: end-of-file-fixer
name: Fix newline at EOF
exclude:
glob:
# generated file
- versions.lock
# generated file
- lucene/analysis/common/src/resources/org/apache/lucene/analysis/snowball/*_stop.txt
# TODO: do this one later with more free RAM
- lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflex
- id: fix-byte-order-marker
name: Fix UTF-8 byte order marker
- id: check-json
name: Check JSON files
priority: 0
types: [ json ]
- id: check-toml
name: Check TOML files
priority: 0
types: [ toml ]
- id: check-yaml
name: Check YAML files
priority: 0
types: [ yaml ]
args: [ --allow-multiple-documents ]
- id: check-xml
name: Check XML files
priority: 0
types: [ xml ]
- id: mixed-line-ending
name: Fix line endings
types: [ text ]
- id: check-merge-conflict
name: Check for merge conflicts
priority: 0
- id: detect-private-key
name: Check for private keys
priority: 0
- id: check-executables-have-shebangs
name: Check that (non-binary) executables have a shebang
priority: 0
- repo: local
hooks:
- id: shellcheck
name: Check Shell Scripts
priority: 0
language: system
entry: uv
args: [ 'run', 'shellcheck', '--format', 'gcc' ]
env:
UV_PROJECT: dev-tools
UV_FROZEN: "1"
types: [ shell ]
exclude:
glob:
# TODO: fix these shell scripts
- dev-tools/test-patch/*.sh
- gradle/regenerate/snowball/snowball.sh
- gradlew
- lucene/distribution/src/binary-release/bin/luke.sh
- id: actionlint
name: Check Github Actions
priority: 0
language: system
entry: uv
args: [ 'run', 'actionlint' ]
env:
UV_PROJECT: dev-tools
UV_FROZEN: "1"
# run across all actions if any are touched
pass_filenames: false
files:
glob:
- .github/**/*.yml
- id: zizmor
name: Check Github Actions Security
priority: 0
language: system
entry: uv
args: [ 'run', 'zizmor', '--pedantic', '--offline', '.' ]
env:
UV_PROJECT: dev-tools
UV_FROZEN: "1"
# run across all actions if any are touched
pass_filenames: false
files:
glob:
- .github/**/*.yml
- id: rumdl
name: Fix Markdown
language: system
entry: uv
args: [ 'run', 'rumdl', 'check', '--fix' ]
env:
UV_PROJECT: dev-tools
UV_FROZEN: "1"
types: [ 'markdown']
require_serial: true
- id: ruff-check
name: Fix Python
language: system
entry: uv
args: [ 'run', 'ruff', 'check', '--fix', '--force-exclude' ]
env:
UV_PROJECT: dev-tools
UV_FROZEN: "1"
types_or: [ python, pyi, jupyter ]
require_serial: true
- id: ruff-format
language: system
name: Fix Python formatting
entry: uv
args: [ 'run', 'ruff', 'format', '--force-exclude' ]
env:
UV_PROJECT: dev-tools
UV_FROZEN: "1"
types_or: [ python, pyi, jupyter ]
require_serial: true
- id: test-ast-grep
name: Check ast-grep rules
priority: 0
language: system
entry: uv
args: [ 'run', 'ast-grep', '-c', './gradle/validation/ast-grep/sgconfig.yml', 'test', '--skip-snapshot-tests' ]
env:
UV_PROJECT: dev-tools
UV_FROZEN: "1"
# run across all rules if any are touched
pass_filenames: false
files:
glob:
- gradle/validation/ast-grep/**/*.yml
- id: ast-grep
name: Check Sources with ast-grep
priority: 0
language: system
entry: uv
args: [ 'run', 'ast-grep', '-c', './gradle/validation/ast-grep/sgconfig.yml', 'scan', '--format', 'github' ]
types_or: [ 'css', 'html', 'java', 'javascript', 'yaml']
require_serial: true
env:
UV_PROJECT: dev-tools
UV_FROZEN: "1"
# self-checks for this configuration file
- repo: meta
hooks:
- id: check-hooks-apply
name: Check prek hooks match at least one file
priority: 0
files:
glob:
.pre-commit-config.yml
- id: check-useless-excludes
name: Check prek excludes match include pattern
priority: 0
files:
glob:
.pre-commit-config.yml