Search code examples
terraformpre-commit-hookpre-commitpre-commit.com

pre commit hook files skipped


repos:
  - repo: https://github.com/terraform-docs/terraform-docs
    rev: "v0.16.0"
    hooks:
      - id: terraform-docs-go
        args: ["markdown", "table", "--output-file", "README.md", "./"]
  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: "v1.74.1"
    hooks:
      - id: terraform_fmt

files are being skipped, and only when i run this manually

pre-commit run --all-files

Will the hook run, so when i run git add . && git commit -m 'whatever' it doesnt check... whats the point of that?


Solution

  • pre-commit will only run on files changed in the commit. there's no reason to re-lint a file that already passes checks over and over wasting time

    if you're not changing terraform files in a commit then your terraform linters will not run


    disclaimer: I wrote pre-commit