Skip to content

Commit

Permalink
fix(packer_fmt): updates packer_fmt hook to format files that fail th…
Browse files Browse the repository at this point in the history
…e check

This updates the packer_fmt hook so that it will format the file that failed its check.
This allows a user to simply add the modified file and proceed with their commit.
  • Loading branch information
greenkiwi committed Feb 3, 2022
1 parent 9871013 commit 492f495
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ repos:
rev: v2.5.1
hooks:
- id: prettier
stages: [commit]
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
hooks:
Expand Down
1 change: 1 addition & 0 deletions hooks/packer_fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ error=0

for file in "$@"; do
if ! packer fmt -check "$file"; then
packer fmt -write "$file"
error=1
echo
echo "Failed path: $file"
Expand Down

0 comments on commit 492f495

Please sign in to comment.