Skip to content

Commit 7c6ad7c

Browse files
authored
fix: analyse all folders with tflint and don't stop on first execution (antonbabenko#289)
1 parent 141f815 commit 7c6ad7c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

terraform_tflint.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,24 @@ tflint_() {
5858

5959
((index += 1))
6060
done
61-
61+
set +e
62+
tflint_final_exit_code=0
6263
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
6364
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"
64-
pushd "$path_uniq" > /dev/null
6565

6666
# Print checked PATH **only** if TFLint have any messages
6767
# shellcheck disable=SC2091 # Suppress error output
68-
$(tflint "${ARGS[@]}" 2>&1) 2> /dev/null || {
68+
$(tflint "${ARGS[@]}" $path_uniq 2>&1) 2> /dev/null || {
6969
echo >&2 -e "\033[1;33m\nTFLint in $path_uniq/:\033[0m"
70-
tflint "${ARGS[@]}"
70+
tflint "${ARGS[@]}" $path_uniq
7171
}
72-
73-
popd > /dev/null
72+
local exit_code=$?
73+
if [ $exit_code != 0 ]; then
74+
tflint_final_exit_code=$exit_code
75+
fi
7476
done
77+
set -e
78+
exit $tflint_final_exit_code
7579
}
7680

7781
# global arrays

0 commit comments

Comments
 (0)