Skip to content

Commit 2b7cc09

Browse files
committed
enable external sources in verify-shellcheck
1 parent 255a73f commit 2b7cc09

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

hack/verify-shellcheck.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,26 @@ else
117117
fi
118118
fi
119119

120+
# common arguments we'll pass to shellcheck
121+
SHELLCHECK_OPTIONS=(
122+
# allow following sourced files that are not specified in the command,
123+
# we need this because we specify one file at at time in order to trivially
124+
# detect which files are failing
125+
"--external-sources"
126+
# include our disabled lints
127+
"--exclude=${SHELLCHECK_DISABLED}"
128+
)
129+
120130
# lint each script, tracking failures
121131
errors=()
122132
not_failing=()
123133
for f in "${all_shell_scripts[@]}"; do
124134
set +o errexit
125135
if ${HAVE_SHELLCHECK}; then
126-
failedLint=$(shellcheck --exclude="${SHELLCHECK_DISABLED}" "${f}")
136+
failedLint=$(shellcheck "${SHELLCHECK_OPTIONS[@]}" "${f}")
127137
else
128138
failedLint=$(docker exec -t ${SHELLCHECK_CONTAINER} \
129-
shellcheck --exclude="${SHELLCHECK_DISABLED}" "${f}")
139+
shellcheck "${SHELLCHECK_OPTIONS[@]}" "${f}")
130140
fi
131141
set -o errexit
132142
kube::util::array_contains "${f}" "${failing_files[@]}" && in_failing=$? || in_failing=$?

0 commit comments

Comments
 (0)