Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@
\.renovaterc\.(json|json5)
)$
# this hook is autogenerated from a script
# to modify this hook, update `src/check_jsonschema/catalog.py`
# and run `make generate-hooks` or `tox run -e generate-hooks-config`
- id: check-snapcraft
name: Validate snapcraft files
description: 'Validate snapcraft files against the schema provided by SchemaStore'
entry: check-jsonschema --builtin-schema vendor.snapcraft
language: python
files: >
(?x)^(
([^/]*/)*snapcraft.yaml
)$
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to read more to see where a snapcraft.yaml may appear, but my understanding is that it can go anywhere. So I think the desired pattern here is snapcraft\.yaml with no anchors. If the current hook generator doesn't support this, I think we should extend it rather than using a less nice pattern.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a small change here, but unfortunately the way this is tested doesn't let us have what I think is the simplest pattern. The test demands a full match, but I think a suffix match would probably be best. I'll leave it only partly refined for now.

types: [yaml]

# this hook is autogenerated from a script
# to modify this hook, update `src/check_jsonschema/catalog.py`
# and run `make generate-hooks` or `tox run -e generate-hooks-config`
Expand Down
14 changes: 14 additions & 0 deletions docs/precommit_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,20 @@ Validate Renovate config against the schema provided by Renovate (does not suppo
- id: check-renovate


``check-snapcraft``
~~~~~~~~~~~~~~~~~~~

Validate snapcraft files against the schema provided by SchemaStore

.. code-block:: yaml
:caption: example config

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.31.3
hooks:
- id: check-snapcraft


``check-taskfile``
~~~~~~~~~~~~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ SchemaStore and other sources:
- ``vendor.mergify``
- ``vendor.readthedocs``
- ``vendor.renovate``
- ``vendor.snapcraft``
- ``vendor.taskfile``
- ``vendor.travis``
- ``vendor.woodpecker-ci``
Expand Down
674 changes: 674 additions & 0 deletions src/check_jsonschema/builtin_schemas/vendor/licenses/LICENSE.snapcraft

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5284c12e66fcc7fdd171fc211d7d7fb47166e114d5ed69993685e288b0078525
Loading
Loading