-
Notifications
You must be signed in to change notification settings - Fork 7
/
.pre-commit-config.yaml
206 lines (190 loc) Β· 7.48 KB
/
.pre-commit-config.yaml
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
205
206
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2023-2024 The Enola <https://enola.dev> Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# NB: When adding new hooks, or making changes to existing hooks configuration,
# run `pre-commit run --all-files` one time, to run the hooks against all of the existing files!
# (Because regular pre-commit will only run on the changed files.)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
# TODO - id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-vcs-permalinks
- id: check-yaml
args: [--allow-multiple-documents]
exclude: mkdocs.yaml
- id: destroyed-symlinks
- id: end-of-file-fixer
# https://github.com/Lucas-C/pre-commit-hooks/issues/70
exclude: ^(LICENSE-header.txt|.*test-random-binary|.*.svg|.*.expected|third_party/.*)$
- id: trailing-whitespace
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: insert-license
files: \.(proto)$
args:
- --comment-style
- "//"
- --license-filepath
- LICENSE-header.txt
- --fuzzy-match-generates-todo
- --use-current-year
- id: insert-license
files: \.(java|js)$
exclude: ^(third_party/.*)$
args:
- --no-extra-eol
- --comment-style
- /*| *| */
- --license-filepath
- LICENSE-header.txt
- --fuzzy-match-generates-todo
- --use-current-year
- id: insert-license
files: \.(bash|bazel|textproto|ttl|yaml)$
exclude: ^docs/use|test/
args:
- --comment-style
- "#"
- --license-filepath
- LICENSE-header.txt
- --fuzzy-match-generates-todo
- --use-current-year
- id: insert-license
files: \.(md|html)$
exclude: ^.github|test/|docs/blog/posts/|docs/use/execmd/demo.md
args:
- --comment-style
- "<!--| |-->"
- --license-filepath
- LICENSE-header.txt
- --fuzzy-match-generates-todo
- --use-current-year
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.5
hooks:
- id: clang-format
# clang-format can also do e.g. *.java and *.json but we only want proto
# and textproto - which doesn't actually work yet; TODO bump version after a
# release which includes https://github.com/pre-commit/identify/pull/373
# and https://github.com/pre-commit/mirrors-clang-format/pull/22.
# In the mean-time, it's possible to manually clang-format -i the.textproto
files: \.(proto|textproto)$
exclude: ^test
- repo: https://github.com/yoheimuta/protolint
# This version must be kept in the sync with the one in tools/protolint/install.bash
# NB: v0.51.0 requires go v1.23 (so Fedora 41 not 40; TODO check GitHub Runner...)
rev: v0.50.5
hooks:
- id: protolint
# Alternative: https://github.com/dustinsand/pre-commit-jvm/ now that
# https://github.com/dustinsand/pre-commit-jvm/issues/8 is fixed, but that requires
# https://get-coursier.io to be installed as a pre-req, which seems overkill just
# for a single fat JAR without any dependencies.
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-java
# Keep this version in sync with the same version in .vscode/settings.json
args: [--autofix, --aosp, --google-java-formatter-version=1.25.1]
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.16.0
hooks:
- id: markdownlint-cli2
exclude: (^.github/|test/|docs/use/docgen/docgen.md)
# Until https://github.com/DavidAnson/markdownlint/issues/121
- repo: https://github.com/tcort/markdown-link-check
# TODO v3.13.6 causes https://github.com/tcort/markdown-link-check/issues/387 ...
rev: v3.12.2
hooks:
- id: markdown-link-check
exclude: (models/|test/|docs/use/docgen/docgen.md|docs/use/server/index.md|docs/concepts/timeline.md)
args: [--quiet, --config, .markdown-link-check.json]
# Alternative: https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md
- repo: https://github.com/keith/pre-commit-buildifier
rev: 7.3.1.1
hooks:
- id: buildifier
args: &args
- --warnings=all
- id: buildifier-lint
args: *args
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
# NOT markdown, because we use markdownlint for that
types_or: [css, html, javascript, json, json5, scss, ts, tsx, yaml]
exclude: ^docs/use|test/|.devcontainer/devcontainer.json|third_party/
additional_dependencies:
- repo: https://github.com/pre-commit/mirrors-csslint
rev: v1.0.5
hooks:
- id: csslint
# https://yamllint.readthedocs.io/en/stable/integration.html#integration-with-pre-commit
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
# https://yamllint.readthedocs.io/en/stable/configuration.html#errors-and-warnings
args: [--strict]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
exclude: mvnw
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
hooks:
- id: check-github-actions
args: ["--verbose"]
- id: check-github-workflows
args: ["--verbose"]
- id: check-dependabot
args: ["--verbose"]
- id: check-renovate
args: ["--verbose"]
additional_dependencies: ["pyjson5==1.6.7"]
- id: check-metaschema
files: \.schema\.json$
args: ["--verbose"]
# Keep this in sync with yaml.schemas in settings.json
# TODO Change once https://github.com/python-jsonschema/check-jsonschema/issues/340 is implemented
- id: check-jsonschema
# files: .+/models/.+\.(yaml|json)$
files: \.types\.yaml$
args: ["--verbose", "--schemafile", "docs/models/enola/schemas/Types.schema.json"]
- id: check-jsonschema
files: \.type\.yaml$
args: ["--verbose", "--schemafile", "docs/models/enola/schemas/Type.schema.json"]
- id: check-jsonschema
files: \.thing\.yaml$
args: ["--verbose", "--schemafile", "docs/models/enola/schemas/Thing.schema.json"]
# https://editorconfig.org check should run AFTER all of the formatters (above)
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.0.3
hooks:
- id: editorconfig-checker
exclude: mvnw