Skip to main content

Pre-commit Hook

The validator has a ready-made pre-commit hook that validates config files on every commit.

Setup

Add to your .pre-commit-config.yaml:

repos:
- repo: https://github.com/Boeing/config-file-validator
rev: v2.2.0
hooks:
- id: config-file-validator

Available hooks

Two hooks are provided:

HookBehavior
config-file-validatorValidates only changed config files. Fast, intended for local development.
config-file-validator-fullValidates all config files in the repo. Intended for CI.

Passing flags

Add flags via the args key:

hooks:
- id: config-file-validator
args: ['--schemastore']
hooks:
- id: config-file-validator
args: ['--exclude-dirs=node_modules,vendor', '--schemastore']

Pinning a version

The rev field should point to a release tag. Update it when you upgrade:

repos:
- repo: https://github.com/Boeing/config-file-validator
rev: v2.2.0
hooks:
- id: config-file-validator

Run pre-commit autoupdate to bump to the latest release automatically.