Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
Use hclfmt to lint terraform.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwilkie committed Dec 9, 2016
1 parent fd875e2 commit 4c0d046
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lint
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ lint_sh() {
return $lint_result
}

lint_tf() {
filename="$1"
local lint_result=0

if [ -n "$(diff <(hclfmt "${filename}") "${filename}")" ]; then
lint_result=1
echo "${filename}: run hclfmt -w ${filename}"
fi

return $lint_result
}

lint() {
filename="$1"
ext="${filename##*\.}"
Expand All @@ -168,6 +180,7 @@ lint() {
case "$ext" in
go) lint_go "${filename}" || lint_result=1 ;;
sh) lint_sh "${filename}" || lint_result=1 ;;
tf) lint_tf "${filename}" || lint_result=1 ;;
esac

if [ -z "$IGNORE_TEST_PACKAGES" ]; then
Expand Down

0 comments on commit 4c0d046

Please sign in to comment.