Miscellaneous hooks for pre-commit.
-
check-zero-width-spaces- Forbid files which have one or more zero width spaces (U+200B). -
hadolint- Run Hadolint on Dockerfiles.- You may use any Hadolint CLI argument, e.g.
--config example.yaml,--ignore RULE,--trusted-registry REGISTRY, etc See the example below.
- You may use any Hadolint CLI argument, e.g.
-
nomad-fmt- Runnomad fmton Nomad manifests. -
packer-validate- Runpacker validateon JSON files.
-
Install dependencies:
- pre-commit
- Hadolint (for
hadolint) - Nomad (for
nomad-fmt) - Packer (for
packer-validate)
-
Install the pre-commit hook globally:
pre-commit init-templatedir -t pre-commit ~/.git-template -
Create the
.pre-commit-config.yamlfile:cd /path/to/my/repo/ vim .pre-commit-config.yamlTip: use the example from the next section as a start point.
-
Run:
pre-commit run -a
# .pre-commit-config.yaml
repos:
- repo: https://github.com/flaudisio/pre-commit-hooks
rev: v0.11.1
hooks:
- id: check-zero-width-spaces
- id: hadolint
args:
- --config .hadolint.strict.yaml
- --ignore DL3013
- --ignore DL3018
- --trusted-registry registry.example.com:5000
exclude: ^cookiecutter/.+/Dockerfile$
- id: packer-validate
files: ^templates/.+\.json$MIT.