Skip to content

Commit 43475f7

Browse files
authored
Merge pull request #515 from edgarrmondragon/compose-spec
Add Compose Spec schema and pre-commit hook
2 parents 7bbe4cf + 0c68edf commit 43475f7

File tree

8 files changed

+1278
-0
lines changed

8 files changed

+1278
-0
lines changed

.pre-commit-hooks.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@
8989
files: ^cloudbuild\.(yml|yaml|json)$
9090
types_or: [json,yaml]
9191

92+
# this hook is autogenerated from a script
93+
# to modify this hook, update `src/check_jsonschema/catalog.py`
94+
# and run `make generate-hooks` or `tox run -e generate-hooks-config`
95+
- id: check-compose-spec
96+
name: Validate Docker Compose files
97+
description: 'Validate Docker Compose files against the schema provided by SchemaStore'
98+
entry: check-jsonschema --builtin-schema vendor.compose-spec
99+
language: python
100+
files: >
101+
(?x)^(
102+
([^/]*/)*docker-compose(\.[\.a-zA-Z0-9_-]*)*\.(yml|yaml)|
103+
([^/]*/)*compose(\.[\.a-zA-Z0-9_-]*)*\.(yml|yaml)
104+
)$
105+
types: [yaml]
106+
92107
# this hook is autogenerated from a script
93108
# to modify this hook, update `src/check_jsonschema/catalog.py`
94109
# and run `make generate-hooks` or `tox run -e generate-hooks-config`

docs/precommit_usage.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,20 @@ Validate Google Cloud Build config against the schema provided by SchemaStore
127127
- id: check-cloudbuild
128128
129129
130+
``check-compose-spec``
131+
~~~~~~~~~~~~~~~~~~~~~~
132+
133+
Validate Docker Compose files against the schema provided by SchemaStore
134+
135+
.. code-block:: yaml
136+
:caption: example config
137+
138+
- repo: https://github.com/python-jsonschema/check-jsonschema
139+
rev: 0.31.0
140+
hooks:
141+
- id: check-compose-spec
142+
143+
130144
``check-dependabot``
131145
~~~~~~~~~~~~~~~~~~~~
132146

docs/usage.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ SchemaStore and other sources:
9292
- ``vendor.buildkite``
9393
- ``vendor.circle-ci``
9494
- ``vendor.cloudbuild``
95+
- ``vendor.compose-spec``
9596
- ``vendor.dependabot``
9697
- ``vendor.drone-ci``
9798
- ``vendor.github-actions``

0 commit comments

Comments
 (0)