mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
fix: terrafrom_tflint ERROR output for files located in repo root (#243)
This commit is contained in:
parent
25cddd9880
commit
3f6643280e
1 changed files with 4 additions and 11 deletions
|
|
@ -61,19 +61,12 @@ tflint_() {
|
||||||
|
|
||||||
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
|
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
|
||||||
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"
|
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"
|
||||||
|
|
||||||
pushd "$path_uniq" > /dev/null
|
pushd "$path_uniq" > /dev/null
|
||||||
TFLINT_MSG=$(
|
|
||||||
tflint "${ARGS[@]}" 2>&1 ||
|
|
||||||
echo >&2 -e "\033[1;31m\nERROR in ./$path_uniq/:\033[0m" &&
|
|
||||||
tflint "${ARGS[@]}" # Print TFLint error with PATH
|
|
||||||
)
|
|
||||||
|
|
||||||
# Print checked PATH if TFLint have any messages
|
# Print checked PATH **only** if TFLint have any messages
|
||||||
if [ ! -z "$TFLINT_MSG" ]; then
|
# shellcheck disable=SC2091 # Suppress error output
|
||||||
echo -e "\n./$path_uniq/:"
|
$(tflint "${ARGS[@]}" 2>&1) ||
|
||||||
echo "$TFLINT_MSG"
|
echo >&2 -e "\033[1;31m\nERROR in $path_uniq/:\033[0m" && tflint "${ARGS[@]}"
|
||||||
fi
|
|
||||||
|
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue