pre-commit Usage¶
check-jsonschema is designed to seamlessly integrate into your workflow as
a pre-commit hook.
Supported Hooks¶
check-jsonschema¶
Validate JSON or YAML files against a jsonschema on disk or fetched via HTTP(S).
You must specify a schema using pre-commit args configuration.
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-jsonschema
files: ^data/.*\.json$
args: ["--schemafile", "schemas/foo.json"]
check-metaschema¶
Validate JSON Schema files against their matching metaschema, as specified in their
"$schema" key.
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-metaschema
files: ^schemas/.*\.json$
check-azure-pipelines¶
Validate Azure Pipelines config against the schema provided by Microsoft
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-azure-pipelines
check-bamboo-spec¶
Validate Bamboo Specs against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-bamboo-spec
check-bitbucket-pipelines¶
Validate Bitbucket Pipelines against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-bitbucket-pipelines
check-buildkite¶
Validate Buildkite Pipelines against the schema provided by Buildkite
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-buildkite
check-changie¶
Validate Changie configuration
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-changie
check-circle-ci¶
Validate CircleCI config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-circle-ci
check-citation-file-format¶
Validate Citation File Format
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-citation-file-format
check-cloudbuild¶
Validate Google Cloud Build config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-cloudbuild
check-codecov¶
Validate Codecov config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-codecov
check-compose-spec¶
Validate Docker Compose files against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-compose-spec
check-dependabot¶
Validate Dependabot Config (v2) against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-dependabot
check-drone-ci¶
Validate Drone-CI Config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-drone-ci
check-github-actions¶
Validate GitHub Actions against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-github-actions
check-github-discussion¶
Validate GitHub discussion against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-github-discussion
check-github-issue-config¶
Validate GitHub issue config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-github-issue-config
check-github-issue-forms¶
Validate GitHub issue forms against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-github-issue-forms
check-github-workflows¶
Validate GitHub Workflows against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-github-workflows
check-gitlab-ci¶
Validate GitLab CI config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-gitlab-ci
check-meltano¶
Validate Meltano config against the schema provided by Meltano
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-meltano
check-mergify¶
Validate Mergify config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-mergify
check-readthedocs¶
Validate ReadTheDocs config against the schema provided by ReadTheDocs
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-readthedocs
check-renovate¶
Validate Renovate config against the schema provided by Renovate (does not support renovate config in package.json)
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-renovate
check-snapcraft¶
Validate snapcraft files against the schema provided by Canonical
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-snapcraft
check-taskfile¶
Validate Taskfile config against the schema provided by Task
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-taskfile
check-travis¶
Validate Travis Config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-travis
check-woodpecker-ci¶
Validate Woodpecker Config against the schema provided by SchemaStore
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-woodpecker-ci
Example Usages¶
Reimplement check-github-workflows¶
Note
This behaves slightly differently from check-github-workflows and is not
recommended. It is here only to demonstrate how --schemafile can be used.
The check-jsonschema hook can run any JSON Schema against a
file or set of files. For example, to implement the GitHub workflow check
manually, you could do this:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
files: ^\.github/workflows/[^/]+$
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
Check a builtin schema¶
check-jsonschema packages some builtin schemas for implementing checks.
To check with the builtin schema that a GitHub workflow sets
timeout-minutes on all jobs:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows set timeout-minutes"
files: ^\.github/workflows/[^/]+$
types: [yaml]
args: ["--builtin-schema", "github-workflows-require-timeout"]