Skip to content
Snippets Groups Projects
Select Git revision
  • main default
  • v0.5.2
  • v0.5.1
  • v0.5.0
  • v0.4.0
  • v0.3.0
  • v0.2.0
  • v0.1.0
8 results

pre-commit-hooks

  • Clone with SSH
  • Clone with HTTPS
  • Adar Nimrod's avatar
    nimrod authored
    New hooks for packer fmt, fix and validate. Includes test files.
    41f44255
    History

    pre-commit hooks

    pipeline status

    A collection of pre-commit hooks.

    Requirements

    • Supported Python 3 version (at time of writing 3.6 or later).
    • pre-commmit 2.0.0 or later.
    • Terraform (for the terraform hooks).

    Example .pre-commit-config.yaml

    ---
    - 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-conflict

    Available hooks

    shell-validate

    Check shell scripts with /bin/sh -en.

    ansible-syntax-check

    Check Ansible playbooks for syntax errors.

    docker-compose

    Validate the Docker Compose file using docker-compose config.

    terraform-fmt

    Format Terraform files using terraform fmt. Requires an installed terraform.

    terraform-validate

    Validate Terraform modules using terraform validate. Requires an installed terraform.

    packer-fix

    Fix known backwards incompatibilities in Packer templates.

    packer-fmt

    Rewrites all Packer configuration files to a canonical format (just HCL files).

    packer-validate

    Checks that the Packer template is valid.

    poetry-check

    Validate pyproject.toml files using Poetry.

    branch-merge-conflict

    Checks for merge conflicts with a specific branch.

    License

    This software is licensed under the MIT license (see LICENSE.txt).

    Author Information

    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/.