Skip to content

Commit be00ae0

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]>
1 parent 4318644 commit be00ae0

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
@@ -96,9 +96,9 @@ jobs:
9696
- uses: actions/checkout@v2
9797
- name: vars
9898
run: |
99-
echo 'VERSION=v0.7.2' >> $GITHUB_ENV
99+
echo 'VERSION=v0.8.0' >> $GITHUB_ENV
100100
echo 'BASEURL=https://github.com/koalaman/shellcheck/releases/download' >> $GITHUB_ENV
101-
echo 'SHA256SUM=12ee2e0b90a3d1e9cae24ac9b2838be66b48573cb2c8e8f3c566b959df6f050c' >> $GITHUB_ENV
101+
echo 'SHA256SUM=f4bce23c11c3919c1b20bcb0f206f6b44c44e26f2bc95f8aa708716095fa0651' >> $GITHUB_ENV
102102
echo ~/bin >> $GITHUB_PATH
103103
- name: install shellcheck
104104
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
@@ -29,7 +29,7 @@ command -v criu &>/dev/null && HAVE_CRIU=yes
2929
# Kernel version
3030
KERNEL_VERSION="$(uname -r)"
3131
KERNEL_MAJOR="${KERNEL_VERSION%%.*}"
32-
KERNEL_MINOR="${KERNEL_VERSION#$KERNEL_MAJOR.}"
32+
KERNEL_MINOR="${KERNEL_VERSION#"$KERNEL_MAJOR".}"
3333
KERNEL_MINOR="${KERNEL_MINOR%%.*}"
3434

3535
ARCH=$(uname -m)

0 commit comments

Comments
 (0)