cisagov / cisagov/pre-commit-packer

packer_fmt says there are no files to check when file exists

Open
#24 10 comments 0 reactions 2 assignees Claimed by @mcdonnnj View on GitHub
bug
Dominant language
Shell
Stars
21
Forks
16
PR merge metrics
No merged PRs in 30d

Description

# 🐛 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:
```yaml
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.
```hcl
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:

```console
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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.