[PATCH 1/2] Documentation/scripts: fix shellcheck issues
There's an open issue about teaching shellcheck to automatically recognize nix-shell shebangs: https://github.com/koalaman/shellcheck/issues/1210 Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com> --- Documentation/scripts/build.sh | 2 +- Documentation/scripts/update-gems.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/scripts/build.sh b/Documentation/scripts/build.sh index 85bd5a5..e6a2cd8 100755 --- a/Documentation/scripts/build.sh +++ b/Documentation/scripts/build.sh @@ -4,7 +4,7 @@ cd "$(dirname "$0")/.." -if [ ! -w . -a ! -w .jekyll-cache ]; then +if [ ! -w . ] && [ ! -w .jekyll-cache ]; then JEKYLLFLAGS=--disable-disk-cache fi diff --git a/Documentation/scripts/update-gems.sh b/Documentation/scripts/update-gems.sh index 7ba98d8..d70f55f 100755 --- a/Documentation/scripts/update-gems.sh +++ b/Documentation/scripts/update-gems.sh @@ -1,8 +1,11 @@ #! /usr/bin/env nix-shell #! nix-shell -i bash -p bundler bundix + # SPDX-FileCopyrightText: 2022 Unikie # SPDX-License-Identifier: EUPL-1.2+ +# shellcheck shell=bash + set -euo pipefail bundle lock --update -- 2.35.1
I didn't realise that bash's ** feature (which matches any depth of directories) wasn't enabled by default, because it appeared to work, just didn't find all scripts. Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com> Fixes: 169fdd6 ("release.nix: run shellcheck on build scripts") --- nix/checks.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/checks.nix b/nix/checks.nix index 9eb261f..b2af72a 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -17,6 +17,7 @@ nativeBuildInputs = [ shellcheck ]; } '' + shopt -s globstar shellcheck $src/**/*.sh touch $out '' -- 2.35.1
On Tue, Nov 15, 2022 at 10:56:37AM +0000, Alyssa Ross wrote:
I didn't realise that bash's ** feature (which matches any depth of directories) wasn't enabled by default, because it appeared to work, just didn't find all scripts.
I'm getting shellcheck warnings from host/rootfs/build/etc/mdev/modalias.sh. Did you intentionally include scripts under 'build' too, or should those be excluded?
Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com> Fixes: 169fdd6 ("release.nix: run shellcheck on build scripts") --- nix/checks.nix | 1 + 1 file changed, 1 insertion(+)
diff --git a/nix/checks.nix b/nix/checks.nix index 9eb261f..b2af72a 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -17,6 +17,7 @@
nativeBuildInputs = [ shellcheck ]; } '' + shopt -s globstar shellcheck $src/**/*.sh touch $out '' -- 2.35.1
On Wed, Nov 16, 2022 at 10:56:18AM +0200, Henri Rosten wrote:
On Tue, Nov 15, 2022 at 10:56:37AM +0000, Alyssa Ross wrote:
I didn't realise that bash's ** feature (which matches any depth of directories) wasn't enabled by default, because it appeared to work, just didn't find all scripts.
I'm getting shellcheck warnings from host/rootfs/build/etc/mdev/modalias.sh. Did you intentionally include scripts under 'build' too, or should those be excluded?
They should indeed be excluded. Thanks for catching!
participants (2)
-
Alyssa Ross -
Henri Rosten