Skip to content

Commit ce02cd1

Browse files
authored
feat: Add PATH outputs when TFLint found any problem (antonbabenko#234)
1 parent 3bdcf51 commit ce02cd1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

terraform_tflint.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,18 @@ tflint_() {
6363
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"
6464

6565
pushd "$path_uniq" > /dev/null
66-
tflint "${ARGS[@]}"
66+
TFLINT_MSG=$(
67+
tflint "${ARGS[@]}" 2>&1 ||
68+
echo >&2 -e "\033[1;31m\nERROR in ./$path_uniq/:\033[0m" &&
69+
tflint "${ARGS[@]}" # Print TFLint error with PATH
70+
)
71+
72+
# Print checked PATH if TFLint have any messages
73+
if [ ! -z "$TFLINT_MSG" ]; then
74+
echo -e "\n./$path_uniq/:"
75+
echo "$TFLINT_MSG"
76+
fi
77+
6778
popd > /dev/null
6879
done
6980
}

0 commit comments

Comments
 (0)