Add check-file-in-alphabetical-order for cleanup
Both verify-golint.sh and verify-shellcheck.sh have the same logic which checks failure_file in alphabetical order. In addition, we'd like to add another script which requires the same logic. So this add a common function for cleanup.
This commit is contained in:
@@ -20,6 +20,7 @@ set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
source "${KUBE_ROOT}/hack/lib/util.sh"
|
||||
|
||||
# required version for this script, if not installed on the host we will
|
||||
# use the official docker image instead. keep this in sync with SHELLCHECK_IMAGE
|
||||
@@ -79,16 +80,7 @@ done < <(find . -name "*.sh" \
|
||||
|
||||
# make sure known failures are sorted
|
||||
failure_file="${KUBE_ROOT}/hack/.shellcheck_failures"
|
||||
if ! diff -u "${failure_file}" <(LC_ALL=C sort "${failure_file}"); then
|
||||
{
|
||||
echo
|
||||
echo "hack/.shellcheck_failures is not in alphabetical order. Please sort it:"
|
||||
echo
|
||||
echo " LC_ALL=C sort -o hack/.shellcheck_failures hack/.shellcheck_failures"
|
||||
echo
|
||||
} >&2
|
||||
false
|
||||
fi
|
||||
kube::util::check-file-in-alphabetical-order "${failure_file}"
|
||||
|
||||
# load known failure files
|
||||
failing_files=()
|
||||
|
Reference in New Issue
Block a user