mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
fix: analyse all folders with tflint and don't stop on first execution (#289)
This commit is contained in:
parent
141f815e81
commit
7c6ad7cfb4
1 changed files with 10 additions and 6 deletions
|
|
@ -58,20 +58,24 @@ tflint_() {
|
||||||
|
|
||||||
((index += 1))
|
((index += 1))
|
||||||
done
|
done
|
||||||
|
set +e
|
||||||
|
tflint_final_exit_code=0
|
||||||
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
|
|
||||||
|
|
||||||
# Print checked PATH **only** if TFLint have any messages
|
# Print checked PATH **only** if TFLint have any messages
|
||||||
# shellcheck disable=SC2091 # Suppress error output
|
# shellcheck disable=SC2091 # Suppress error output
|
||||||
$(tflint "${ARGS[@]}" 2>&1) 2> /dev/null || {
|
$(tflint "${ARGS[@]}" $path_uniq 2>&1) 2> /dev/null || {
|
||||||
echo >&2 -e "\033[1;33m\nTFLint in $path_uniq/:\033[0m"
|
echo >&2 -e "\033[1;33m\nTFLint in $path_uniq/:\033[0m"
|
||||||
tflint "${ARGS[@]}"
|
tflint "${ARGS[@]}" $path_uniq
|
||||||
}
|
}
|
||||||
|
local exit_code=$?
|
||||||
popd > /dev/null
|
if [ $exit_code != 0 ]; then
|
||||||
|
tflint_final_exit_code=$exit_code
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
set -e
|
||||||
|
exit $tflint_final_exit_code
|
||||||
}
|
}
|
||||||
|
|
||||||
# global arrays
|
# global arrays
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue