first refactoring fr *.bats according to shellcheck

This commit is contained in:
Georg Lauterbach 2020-11-05 13:32:42 +01:00
parent 46998dd816
commit 9ce719213b
No known key found for this signature in database
GPG key ID: 386D76E7AD496709
31 changed files with 141 additions and 134 deletions

View file

@ -90,7 +90,7 @@ function _eclint
return 102
fi
__log_info 'linter version:' "$(${LINT[0]} --version))"
__log_info 'linter version:' "$(${LINT[0]} --version)"
if "${LINT[@]}"
then
@ -113,7 +113,7 @@ function _hadolint
fi
__log_info 'linter version:' \
"$(${LINT[0]} --version | grep -E -o "v[0-9\.]*"))"
"$(${LINT[0]} --version | grep -E -o "v[0-9\.]*")"
if git ls-files --exclude='Dockerfile*' --ignored | \
xargs --max-lines=1 "${LINT[@]}"
@ -138,7 +138,7 @@ function _shellcheck
fi
__log_info 'linter version:' \
"$(${LINT[0]} --version | grep -m 2 -o "[0-9.]*"))"
"$(${LINT[0]} --version | grep -m 2 -o "[0-9.]*")"
# an overengineered solution to allow shellcheck -x to
# properly follow `source=<SOURCE FILE>` when sourcing
@ -176,21 +176,19 @@ function _shellcheck
done < <(find target/bin -executable -type f)
# the same for all test files
# while read -r FILE
# do
# if ! (
# cd "$(realpath "$(dirname "$(readlink -f "${FILE}")")")"
# if ! "${LINT[@]}" "$(basename -- "${FILE}")"
# then
# return 1
# fi
# )
# then
# # ! Errors / warnings found here are
# # ! currently NOT accounted for.
# :
# fi
# done < <(find test/ -maxdepth 1 -type f -iname "*.bats")
while read -r FILE
do
if ! (
cd "$(realpath "$(dirname "$(readlink -f "${FILE}")")")"
if ! "${LINT[@]}" "$(basename -- "${FILE}")"
then
return 1
fi
)
then
ERR=1
fi
done < <(find test/ -maxdepth 1 -type f -iname "*.bats")
if [[ ERR -eq 1 ]]
then