Skip to content

Commit 57c51c7

Browse files
Fix shellcheck for more scripts in hack
Making more of the scripts in hack pass the shellcheck linter.
1 parent 139a13d commit 57c51c7

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

hack/.shellcheck_failures

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,10 @@
100100
./hack/verify-golint.sh
101101
./hack/verify-govet.sh
102102
./hack/verify-import-boss.sh
103-
./hack/verify-linkcheck.sh
104103
./hack/verify-no-vendor-cycles.sh
105104
./hack/verify-openapi-spec.sh
106-
./hack/verify-pkg-names.sh
107105
./hack/verify-readonly-packages.sh
108-
./hack/verify-spelling.sh
109-
./hack/verify-staging-godeps.sh
110106
./hack/verify-staging-meta-files.sh
111-
./hack/verify-symbols.sh
112107
./hack/verify-test-featuregates.sh
113108
./test/cmd/apply.sh
114109
./test/cmd/apps.sh

hack/verify-linkcheck.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222
source "${KUBE_ROOT}/hack/lib/init.sh"
2323

2424
kube::golang::setup_env
@@ -38,7 +38,7 @@ mkdir -p "$OUTPUT"
3838
APIROOT="${KUBE_ROOT}/pkg/api/"
3939
APISROOT="${KUBE_ROOT}/pkg/apis/"
4040
DOCROOT="${KUBE_ROOT}/docs/"
41-
ROOTS=($APIROOT $APISROOT $DOCROOT)
41+
ROOTS=("$APIROOT" "$APISROOT" "$DOCROOT")
4242
found_invalid=false
4343
for root in "${ROOTS[@]}"; do
4444
"${linkcheck}" "--root-dir=${root}" 2> >(tee -a "${OUTPUT}/error" >&2) && ret=0 || ret=$?
@@ -54,7 +54,7 @@ done
5454

5555
if [ ${found_invalid} = true ]; then
5656
echo "Summary of invalid links:"
57-
cat ${OUTPUT}/error
57+
cat "${OUTPUT}/error"
5858
exit 1
5959
fi
6060

hack/verify-pkg-names.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -o errexit
2020
set -o nounset
2121
set -o pipefail
2222

23-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
23+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2424
source "${KUBE_ROOT}/hack/lib/init.sh"
2525

2626
kube::golang::verify_go_version

hack/verify-spelling.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ set -o errexit
1717
set -o nounset
1818
set -o pipefail
1919

20-
export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
20+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
21+
export KUBE_ROOT
2122
source "${KUBE_ROOT}/hack/lib/init.sh"
2223

2324
# Ensure that we find the binaries we build before anything else.
@@ -30,5 +31,5 @@ go install k8s.io/kubernetes/vendor/github.com/client9/misspell/cmd/misspell
3031
# Spell checking
3132
# All the skipping files are defined in hack/.spelling_failures
3233
skipping_file="${KUBE_ROOT}/hack/.spelling_failures"
33-
failing_packages=$(echo `cat ${skipping_file}` | sed "s| | -e |g")
34-
git ls-files | grep -v -e ${failing_packages} | xargs misspell -i "Creater,creater,ect" -error -o stderr
34+
failing_packages=$(sed "s| | -e |g" "${skipping_file}")
35+
git ls-files | grep -v -e "${failing_packages}" | xargs misspell -i "Creater,creater,ect" -error -o stderr

hack/verify-staging-godeps.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222
source "${KUBE_ROOT}/hack/lib/init.sh"
2323

2424
readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}}
@@ -32,4 +32,4 @@ if ! [[ ${KUBE_FORCE_VERIFY_CHECKS:-} =~ ^[yY]$ ]] && \
3232
exit 0
3333
fi
3434

35-
KUBE_VERBOSE="${KUBE_VERBOSE:-3}" KUBE_RUN_COPY_OUTPUT=N ${KUBE_ROOT}/hack/update-staging-godeps.sh -d -f "$@"
35+
KUBE_VERBOSE="${KUBE_VERBOSE:-3}" KUBE_RUN_COPY_OUTPUT=N "${KUBE_ROOT}/hack/update-staging-godeps.sh" -d -f "$@"

hack/verify-symbols.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222
source "${KUBE_ROOT}/hack/lib/init.sh"
2323

2424
kube::golang::setup_env
@@ -33,7 +33,7 @@ BADSYMBOLS=(
3333
)
3434

3535
# b/c hyperkube binds everything simply check that for bad symbols
36-
SYMBOLS="$(nm ${KUBE_OUTPUT_HOSTBIN}/hyperkube)"
36+
SYMBOLS="$(nm "${KUBE_OUTPUT_HOSTBIN}/hyperkube")"
3737

3838
RESULT=0
3939
for BADSYMBOL in "${BADSYMBOLS[@]}"; do

0 commit comments

Comments
 (0)