Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.1] ci: shellcheck: update to 0.8.0, fix/suppress new warnings #3640

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

kolyshkin
Copy link
Contributor

This is a backport of #3371 to release 1.1 branch.


  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.

  1. 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.

  1. Update shellcheck to 0.8.0.

@kolyshkin kolyshkin added this to the 1.1.5 milestone Oct 18, 2022
@kolyshkin kolyshkin marked this pull request as ready for review October 18, 2022 20:50
@kolyshkin kolyshkin changed the title ci: shellcheck: update to 0.8.0, fix/suppress new warnings [1.1] ci: shellcheck: update to 0.8.0, fix/suppress new warnings Oct 18, 2022
@kolyshkin kolyshkin added the backport/1.1-pr A backport PR to release-1.1 label Oct 18, 2022
@kolyshkin
Copy link
Contributor Author

The goal here is to have the same version of shellcheck in main and release-1.1, so in case we backport something, it won't result in any new warnings in CI.

@kolyshkin
Copy link
Contributor Author

@thaJeztah PTAL

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 <kolyshkin@gmail.com>
(cherry picked from commit be00ae0)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin force-pushed the 1.1-bump-shellcheck branch from 6313436 to e6a8287 Compare October 27, 2022 18:30
@kolyshkin
Copy link
Contributor Author

@thaJeztah PTAL

@mrunalp mrunalp merged commit bd4d05c into opencontainers:release-1.1 Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci backport/1.1-pr A backport PR to release-1.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants