From 2b7cc095cc8b1334a70d6b974904c15eb24f47cb Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Mon, 1 Apr 2019 11:03:37 -0700 Subject: [PATCH] enable external sources in verify-shellcheck --- hack/verify-shellcheck.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hack/verify-shellcheck.sh b/hack/verify-shellcheck.sh index 1b882fa8b84..bd1483d4441 100755 --- a/hack/verify-shellcheck.sh +++ b/hack/verify-shellcheck.sh @@ -117,16 +117,26 @@ else fi fi +# common arguments we'll pass to shellcheck +SHELLCHECK_OPTIONS=( + # allow following sourced files that are not specified in the command, + # we need this because we specify one file at at time in order to trivially + # detect which files are failing + "--external-sources" + # include our disabled lints + "--exclude=${SHELLCHECK_DISABLED}" +) + # lint each script, tracking failures errors=() not_failing=() for f in "${all_shell_scripts[@]}"; do set +o errexit if ${HAVE_SHELLCHECK}; then - failedLint=$(shellcheck --exclude="${SHELLCHECK_DISABLED}" "${f}") + failedLint=$(shellcheck "${SHELLCHECK_OPTIONS[@]}" "${f}") else failedLint=$(docker exec -t ${SHELLCHECK_CONTAINER} \ - shellcheck --exclude="${SHELLCHECK_DISABLED}" "${f}") + shellcheck "${SHELLCHECK_OPTIONS[@]}" "${f}") fi set -o errexit kube::util::array_contains "${f}" "${failing_files[@]}" && in_failing=$? || in_failing=$?