From 26136320f9fdb62c99943649df75e63acc659a3d Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 24 Mar 2022 21:17:38 -0700 Subject: [PATCH] Declare and assign variable separately in setup script Coverage of `readonly` was added to ShellCheck rule SC2155: https://github.com/koalaman/shellcheck/wiki/SC2155#problematic-code-in-the-case-of-readonly > ### Problematic code in the case of `readonly`: > > ```sh > readonly foo="$(mycmd)" > ``` > > #### Correct code: > > ```sh > foo="$(mycmd)" > readonly foo > ``` There was this sort of "problematic code" in the action setup script, which caused the "Lint shell scripts" CI workflow to start failing after the 0.7.2 release of ShellCheck. The script's usage of `readonly` is now adjusted according to ShellCheck's recommendation. --- action-setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action-setup.sh b/action-setup.sh index 9f32d9b..61c09a1 100755 --- a/action-setup.sh +++ b/action-setup.sh @@ -5,7 +5,7 @@ readonly PYTHON_PACKAGE_VERSION='3.8' # https://stackoverflow.com/a/29835459 -readonly SCRIPT_PATH="$( +SCRIPT_PATH="$( CDPATH='' \ cd -- "$( dirname -- "$0" @@ -13,6 +13,7 @@ readonly SCRIPT_PATH="$( pwd -P ) )" +readonly SCRIPT_PATH readonly PYTHON_COMMAND="python${PYTHON_PACKAGE_VERSION}" readonly PYTHON_VENV_PATH="${SCRIPT_PATH}/compilesketches/.venv"