-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathcatalog.py
More file actions
286 lines (278 loc) · 9.21 KB
/
catalog.py
File metadata and controls
286 lines (278 loc) · 9.21 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
from __future__ import annotations
import typing as t
def _bitbucket_pipelines_url() -> str:
return "https://bitbucket.org/atlassianlabs/intellij-bitbucket-references-plugin/raw/master/src/main/resources/schemas/bitbucket-pipelines.schema.json" # noqa: E501
def _githubusercontent_url(owner: str, repo: str, ref: str, path: str) -> str:
return f"https://raw.githubusercontent.com/{owner}/{repo}/{ref}/{path}"
# this lists custom schemas which are *not* part of the catalog
CUSTOM_SCHEMA_NAMES = [
"github-workflows-require-timeout",
]
# Known configs. The SchemaCatalog lists known schema URLs with their names.
# kept in alphabetical order by name
#
# Additional config could be associated with the schemas in the future.
SCHEMA_CATALOG: dict[str, dict[str, t.Any]] = {
"azure-pipelines": {
"url": _githubusercontent_url(
"microsoft", "azure-pipelines-vscode", "main", "service-schema.json"
),
"hook_config": {
"name": "Validate Azure Pipelines",
"description": (
"Validate Azure Pipelines config against the schema provided "
"by Microsoft"
),
"add_args": [
"--data-transform",
"azure-pipelines",
"--regex-variant",
"nonunicode",
],
"files": r"^(\.)?azure-pipelines\.(yml|yaml)$",
"types": "yaml",
},
},
"bamboo-spec": {
"url": "https://json.schemastore.org/bamboo-spec.json",
"hook_config": {
"name": "Validate Bamboo Specs",
"files": r"^bamboo-specs/.*\.(yml|yaml)$",
"types": "yaml",
},
},
"bitbucket-pipelines": {
"url": _bitbucket_pipelines_url(),
"hook_config": {
"name": "Validate Bitbucket Pipelines",
"files": r"bitbucket-pipelines\.(yml|yaml)$",
"types": "yaml",
},
},
"buildkite": {
"url": _githubusercontent_url(
"buildkite", "pipeline-schema", "main", "schema.json"
),
"hook_config": {
"name": "Validate Buildkite Pipelines",
"description": (
"Validate Buildkite Pipelines against the schema provided by Buildkite"
),
"files": [
r"buildkite\.(yml|yaml|json)",
r"buildkite\.(.+)\.(yml|yaml|json)",
r"(.*/)?\.buildkite/pipeline\.(yml|yaml|json)",
r"(.*/)?\.buildkite/pipeline\.(.+)\.(yml|yaml|json)",
],
"types_or": ["json", "yaml"],
},
},
"circle-ci": {
"url": "https://json.schemastore.org/circleciconfig.json",
"hook_config": {
"name": "Validate CircleCI config",
"description": (
"Validate CircleCI config against the schema provided by SchemaStore"
),
"files": r"^\.circleci/config\.(yml|yaml)$",
"type": "yaml",
},
},
"cloudbuild": {
"url": "https://json.schemastore.org/cloudbuild.json",
"hook_config": {
"name": "Validate Google Cloud Build config",
"description": (
"Validate Google Cloud Build config against the schema provided "
"by SchemaStore"
),
"files": r"^cloudbuild\.(yml|yaml|json)$",
"types_or": ["json", "yaml"],
},
},
"compose-spec": {
"url": _githubusercontent_url(
"compose-spec",
"compose-spec",
"master",
"schema/compose-spec.json",
),
"hook_config": {
"name": "Validate Docker Compose files",
"files": [
r"([^/]*/)*docker-compose(\.[\.a-zA-Z0-9_-]*)*\.(yml|yaml)",
r"([^/]*/)*compose(\.[\.a-zA-Z0-9_-]*)*\.(yml|yaml)",
],
"types": "yaml",
},
},
"dependabot": {
"url": "https://json.schemastore.org/dependabot-2.0.json",
"hook_config": {
"name": "Validate Dependabot Config (v2)",
"files": r"^\.github/dependabot\.(yml|yaml)$",
"types": "yaml",
},
},
"drone-ci": {
"url": "https://json.schemastore.org/drone.json",
"hook_config": {
"name": "Validate Drone-CI Config",
"files": r"^\.drone\.yml$",
"types": "yaml",
},
},
"github-actions": {
"url": "https://json.schemastore.org/github-action",
"hook_config": {
"name": "Validate GitHub Actions",
"files": [
r"action\.(yml|yaml)",
r"\.github/actions/(.+/)?action\.(yml|yaml)",
],
"types": "yaml",
},
},
"github-workflows": {
"url": "https://json.schemastore.org/github-workflow",
"hook_config": {
"name": "Validate GitHub Workflows",
"files": r"^\.github/workflows/[^/]+$",
"types": "yaml",
},
},
"gitlab-ci": {
"url": (
"https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts"
"/editor/schema/ci.json"
),
"hook_config": {
"name": "Validate GitLab CI config",
"add_args": [
"--data-transform",
"gitlab-ci",
"--regex-variant",
"nonunicode",
],
"files": r"^.*\.gitlab-ci\.yml$",
"types": "yaml",
},
},
"meltano": {
"url": _githubusercontent_url(
"meltano",
"meltano",
"main",
"src/meltano/schemas/meltano.schema.json",
),
"hook_config": {
"name": "Validate Meltano Config",
"description": (
"Validate Meltano config against the schema provided by Meltano"
),
"files": [
r".*meltano\.yml",
r"meltano-manifest\.json",
r"meltano-manifest\..+\.json",
],
"types_or": ["json", "yaml"],
},
},
"mergify": {
"url": "https://docs.mergify.com/mergify-configuration-schema.json",
"hook_config": {
"name": "Validate Mergify config",
"files": [
r"\.mergify\.yml",
r"\.mergify/config\.yml",
r"\.github/mergify\.yml",
],
"types": "yaml",
},
},
"readthedocs": {
"url": _githubusercontent_url(
"readthedocs",
"readthedocs.org",
"main",
"readthedocs/rtd_tests/fixtures/spec/v2/schema.json",
),
"hook_config": {
"name": "Validate ReadTheDocs Config",
"description": (
"Validate ReadTheDocs config against the schema "
"provided by ReadTheDocs"
),
"files": r"^\.readthedocs\.(yml|yaml)$",
"types": "yaml",
},
},
"renovate": {
"url": "https://docs.renovatebot.com/renovate-schema.json",
"hook_config": {
"name": "Validate Renovate Config",
"description": (
"Validate Renovate config against the schema provided by "
"Renovate (does not support renovate config in package.json)"
),
"add_args": ["--regex-variant", "nonunicode"],
"files": [
r"renovate\.(json|json5)",
r"\.(github|gitlab)/renovate\.(json|json5)",
r"\.renovaterc",
r"\.renovaterc\.(json|json5)",
],
},
},
"snapcraft": {
"url": _githubusercontent_url(
"canonical", "snapcraft", "main", "schema/snapcraft.json"
),
"hook_config": {
"name": "Validate snapcraft files",
"description": (
"Validate snapcraft files against the schema provided by Canonical"
),
"files": r"^(.+/)?snapcraft\.yaml$",
"types": "yaml",
},
},
"taskfile": {
"url": "https://taskfile.dev/schema.json",
"hook_config": {
"name": "Validate Taskfile Config",
"description": (
"Validate Taskfile config against the schema provided by Task"
),
"files": [
r"Taskfile\.(yml|yaml)",
r"taskfile\.(yml|yaml)",
r"Taskfile\.dist\.(yml|yaml)",
r"taskfile\.dist\.(yml|yaml)",
],
"types": "yaml",
},
},
"travis": {
"url": "https://json.schemastore.org/travis",
"hook_config": {
"name": "Validate Travis Config",
"files": r"^\.travis\.(yml|yaml)$",
"types": "yaml",
},
},
"woodpecker-ci": {
"url": (
"https://raw.githubusercontent.com/woodpecker-ci/woodpecker/main/pipeline"
"/frontend/yaml/linter/schema/schema.json"
),
"hook_config": {
"name": "Validate Woodpecker Config",
"files": [
r"^\.woodpecker\.(yml|yaml)$",
r"^\.woodpecker/.+\.(yml|yaml)$",
],
"types": "yaml",
},
},
}