Skip to content

Commit 8f395aa

Browse files
authored
chore: drop shellcheck level to warning (#2371)
* update shellcheck presubmit to report warnings and above * use shfmt's logic for finding shell files instead of my hacky script * fix most existing warnings
1 parent 35110d3 commit 8f395aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+154
-136
lines changed

.github/actions/janitor/ami-sweeper/script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ fi
1212
set -o nounset
1313

1414
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-retries.html
15-
AWS_RETRY_MODE=standard
16-
AWS_MAX_ATTEMPTS=5
15+
export AWS_RETRY_MODE=standard
16+
export AWS_MAX_ATTEMPTS=5
1717

1818
function jqb64() {
1919
if [ "$#" -lt 2 ]; then

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ lint: lint-docs lint-code
6363
.PHONY: lint-code
6464
lint-code: ## Check the source files for syntax and format issues
6565
hack/shfmt --diff
66-
hack/shellcheck --format gcc --severity error
66+
hack/shellcheck --format gcc --severity warning
6767
hack/lint-space-errors.sh
6868

6969
.PHONY: test

hack/findshell.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

hack/generate-nvidia-open-supported-devices.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ if [ "$#" -ne 1 ]; then
1111
exit 1
1212
fi
1313

14-
cd $(dirname $0)
14+
cd "$(dirname $0)"
1515

1616
RUNFILE="${1}"
1717
RUNFILE_DIR=$(basename "${RUNFILE}" | sed s/\.run//g)
1818
TEMP_DIR=$(mktemp -d)
19-
DEVICE_FILE="devices.txt"
2019
SUPPORTED_GPUS_FILE="supported-gpus/supported-gpus.json"
2120

2221
cp "${RUNFILE}" "${TEMP_DIR}"

hack/lint-docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -o errexit
44

5-
cd $(dirname $0)
5+
cd "$(dirname $0)"
66

77
./generate-template-variable-doc.py
88
if ! git diff --exit-code ../doc/usage/; then

hack/lint-space-errors.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env bash
22

3-
cd $(dirname $0)/..
3+
set -o errexit
4+
5+
cd "$(dirname $0)/.."
46

57
# `git apply|diff` can check for space errors, with the core implementation being `git diff-tree`
68
# this tool compares two trees, generally used to find errors in proposed changes
79
# we want to check the entire existing tree, so we compare HEAD against an empty tree
8-
git diff-tree --check $(git hash-object -t tree /dev/null) HEAD ':!nodeadm/vendor/'
10+
git diff-tree --check "$(git hash-object -t tree /dev/null)" HEAD ':!nodeadm/vendor/'

hack/mkdocs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -o errexit
44

5-
cd $(dirname $0)
5+
cd "$(dirname $0)"
66

77
IMAGE_ID=$(docker build --file mkdocs.Dockerfile --quiet .)
88
cd ..

hack/nodeadm-check-generate.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22

3-
cd $(dirname $0)/../nodeadm
3+
set -o errexit
4+
5+
cd "$(dirname $0)/../nodeadm"
46
make generate
57
if ! git diff --exit-code .; then
68
echo "ERROR: nodeadm generated code is out of date. Please run make generate and commit the changes."

hack/nodeadm-check-vendor.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ set -o errexit
44
set -o nounset
55
set -o pipefail
66

7-
cd $(dirname $0)/../nodeadm
7+
cd "$(dirname $0)/../nodeadm"
88

99
TEMP_DIR="$(mktemp -d)"
1010
go mod vendor -o "${TEMP_DIR}"
11-
if ! DIFF="$(diff -Naupr vendor ${TEMP_DIR})"; then
11+
if ! diff -Naupr vendor ${TEMP_DIR}; then
1212
echo "ERROR: the vendor directory is not up to date! You need to run 'go mod vendor' and commit the changes." >&2
1313
exit 1
1414
fi

hack/shellcheck

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
set -o nounset
55

66
WORKDIR=$(realpath .)
7-
FILES=$(hack/findshell.sh ${WORKDIR})
7+
FILES=$(hack/shfmt_command.sh --find --language-dialect auto "${WORKDIR}" | grep -v "nodeadm/vendor/")
88
SHELLCHECK_COMMAND=$(which shellcheck 2> /dev/null)
99
if [ -z "$SHELLCHECK_COMMAND" ]; then
1010
SHELLCHECK_COMMAND="docker run --rm -v $WORKDIR:$WORKDIR -w $WORKDIR koalaman/shellcheck:stable"
1111
fi
12-
$SHELLCHECK_COMMAND $* $FILES
12+
$SHELLCHECK_COMMAND "$@" $FILES

0 commit comments

Comments
 (0)