A collection of pre-commit hooks.
- Supported Python 3 version (at time of writing 3.6 or later).
- pre-commmit 2.0.0 or later.
- Terraform or OpenTofu
(for the
terraform-*hooks). - Packer (for the
packer-*hooks). - Docker Compose (for the
docker-composehook).
---
- repo: https://git.shore.co.il/nimrod/pre-commit-hooks.git
rev: 0.1.0 # Check for the latest tag or run pre-commit autoupdate.
hooks:
- id: shell-validate
- id: ansible-syntax-check
- id: docker-compose
- id: terraform-fmt
- id: terraform-validate
- id: packer-fmt
- id: packer-fix
- id: packer-validate
- id: poetry-check
- id: branch-merge-conflictCheck shell scripts with /bin/sh -en.
Check Ansible playbooks for syntax errors.
Validate the Docker Compose file using docker-compose config.
Requires an install docker-compose.
With previous versions of this repo, the docker-compose version from PyPI was
installed as a dependency. However, at the time of writing, the package hasn't
been updated in over 3 years. If you wish to still use the 1.x version from
PyPI, add it in the additional_dependencies section of the hook.
Format Terraform files using terraform fmt.
Requires an installed terraform. If you wish to use tofu instead, set the
TF_CLI environment variable to tofu.
Validate Terraform modules using terraform validate.
Requires an installed terraform. If you wish to use tofu instead, set the
TF_CLI environment variable to tofu.
Fix known backwards incompatibilities in Packer templates (just JSON files, until support for HCL files is added in Packer).
Rewrites all Packer configuration files to a canonical format (just HCL files).
Checks that the Packer template is valid.
Validate pyproject.toml files using Poetry.
Checks for merge conflicts with a specific branch.
This software is licensed under the MIT license (see LICENSE.txt).
Nimrod Adar, contact me or visit my
website. Patches are welcome via
git send-email. The repository
is located at: https://git.shore.co.il/explore/.