Skip to content

Commit 6313436

Browse files
committed
ci: shellcheck: update to 0.8.0, fix/suppress new warnings
1. This valid warning is reported by shellcheck v0.8.0: In tests/integration/helpers.bash line 38: KERNEL_MINOR="${KERNEL_VERSION#$KERNEL_MAJOR.}" ^-----------^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: KERNEL_MINOR="${KERNEL_VERSION#"$KERNEL_MAJOR".}" Fix this. 2. These (invalid) warnings are also reported by the new version: In tests/integration/events.bats line 13: @test "events --stats" { ^-- SC2030 (info): Modification of status is local (to subshell caused by @BATS test). In tests/integration/events.bats line 41: [ "$status" -eq 0 ] ^-----^ SC2031 (info): status was modified in a subshell. That change might be lost. Basically, this is happening because shellcheck do not really track the call tree and/or local variables. This is a known (and reported) deficiency, and the alternative to disabling these warnings is moving the code around, which is worse due to more changes in git history. So we have to silence/disable these. 3. Update shellcheck to 0.8.0. Signed-off-by: Kir Kolyshkin <[email protected]> (cherry picked from commit be00ae0) Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 28fa513 commit 6313436

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.github/workflows/validate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ jobs:
102102
- uses: actions/checkout@v3
103103
- name: vars
104104
run: |
105-
echo 'VERSION=v0.7.2' >> $GITHUB_ENV
105+
echo 'VERSION=v0.8.0' >> $GITHUB_ENV
106106
echo 'BASEURL=https://github.com/koalaman/shellcheck/releases/download' >> $GITHUB_ENV
107-
echo 'SHA256SUM=12ee2e0b90a3d1e9cae24ac9b2838be66b48573cb2c8e8f3c566b959df6f050c' >> $GITHUB_ENV
107+
echo 'SHA256SUM=f4bce23c11c3919c1b20bcb0f206f6b44c44e26f2bc95f8aa708716095fa0651' >> $GITHUB_ENV
108108
echo ~/bin >> $GITHUB_PATH
109109
- name: install shellcheck
110110
run: |

tests/integration/events.bats

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function teardown() {
1010
teardown_bundle
1111
}
1212

13+
# shellcheck disable=SC2030
1314
@test "events --stats" {
1415
# XXX: currently cgroups require root containers.
1516
requires root
@@ -38,6 +39,7 @@ function test_events() {
3839
fi
3940

4041
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
42+
# shellcheck disable=SC2031
4143
[ "$status" -eq 0 ]
4244

4345
# Spawn two subshels:

tests/integration/helpers.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TESTDATA="${INTEGRATION_ROOT}/testdata"
2626
# Kernel version
2727
KERNEL_VERSION="$(uname -r)"
2828
KERNEL_MAJOR="${KERNEL_VERSION%%.*}"
29-
KERNEL_MINOR="${KERNEL_VERSION#$KERNEL_MAJOR.}"
29+
KERNEL_MINOR="${KERNEL_VERSION#"$KERNEL_MAJOR".}"
3030
KERNEL_MINOR="${KERNEL_MINOR%%.*}"
3131

3232
ARCH=$(uname -m)

0 commit comments

Comments
 (0)