Skip to content

packer_fmt says there are no files to check when file exists #24

@nandac

Description

@nandac

🐛 Summary

When running the packer_fmt hook the message I receive is:
Packer Format........................................(no files to check)Skipped

Even though I have .pkr.hcl file in my repository

To reproduce

Steps to reproduce the behavior:

  1. Create a .pre-commit-config.yml something like this:
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.2.0
    hooks:
      - id: pretty-format-json
        args: ["--autofix", "--no-sort-keys", "--indent=2"]
      - id: fix-byte-order-marker
      - id: check-added-large-files
        args: ["--maxkb=500"]
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: check-symlinks
      - id: check-merge-conflict
      - id: detect-private-key
      - id: detect-aws-credentials
        args: ["--allow-missing-credentials"]
      - id: trailing-whitespace

  - repo: https://github.com/cisagov/pre-commit-packer
    rev: v0.0.2
    hooks:
      - id: packer_validate
      - id: packer_fmt
  1. Create some dummy config file with the .pkr.hcl extension.
packer {
  required_plugins {
    amazon = {
      version = ">= 0.0.2"
      source  = "github.com/hashicorp/amazon"
    }
  }
}

Expected behavior

I should not receive the no files to check message.

Any helpful log output or screenshots

Paste the results here:
When running the command pre-commit run --all-files --color always I get the following output:

pretty format json...................................(no files to check)Skipped
fix utf-8 byte order marker..............................................Passed
check for added large files..............................................Passed
check for case conflicts.................................................Passed
check that executables have shebangs.................(no files to check)Skipped
check for broken symlinks............................(no files to check)Skipped
check for merge conflicts................................................Passed
detect private key.......................................................Passed
detect aws credentials...................................................Passed
trim trailing whitespace.................................................Passed
Packer Validate..........................................................Passed
Packer Format........................................(no files to check)Skipped

Metadata

Metadata

Assignees

Labels

bugThis issue or pull request addresses broken functionality

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions