mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
enable external sources in verify-shellcheck
This commit is contained in:
parent
255a73ffc6
commit
2b7cc095cc
@ -117,16 +117,26 @@ else
|
|||||||
fi
|
fi
|
||||||
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
|
# lint each script, tracking failures
|
||||||
errors=()
|
errors=()
|
||||||
not_failing=()
|
not_failing=()
|
||||||
for f in "${all_shell_scripts[@]}"; do
|
for f in "${all_shell_scripts[@]}"; do
|
||||||
set +o errexit
|
set +o errexit
|
||||||
if ${HAVE_SHELLCHECK}; then
|
if ${HAVE_SHELLCHECK}; then
|
||||||
failedLint=$(shellcheck --exclude="${SHELLCHECK_DISABLED}" "${f}")
|
failedLint=$(shellcheck "${SHELLCHECK_OPTIONS[@]}" "${f}")
|
||||||
else
|
else
|
||||||
failedLint=$(docker exec -t ${SHELLCHECK_CONTAINER} \
|
failedLint=$(docker exec -t ${SHELLCHECK_CONTAINER} \
|
||||||
shellcheck --exclude="${SHELLCHECK_DISABLED}" "${f}")
|
shellcheck "${SHELLCHECK_OPTIONS[@]}" "${f}")
|
||||||
fi
|
fi
|
||||||
set -o errexit
|
set -o errexit
|
||||||
kube::util::array_contains "${f}" "${failing_files[@]}" && in_failing=$? || in_failing=$?
|
kube::util::array_contains "${f}" "${failing_files[@]}" && in_failing=$? || in_failing=$?
|
||||||
|
Loading…
Reference in New Issue
Block a user