Skip to content

Commit 2613632

Browse files
committed
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.
1 parent afbfe52 commit 2613632

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: action-setup.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
readonly PYTHON_PACKAGE_VERSION='3.8'
66

77
# https://stackoverflow.com/a/29835459
8-
readonly SCRIPT_PATH="$(
8+
SCRIPT_PATH="$(
99
CDPATH='' \
1010
cd -- "$(
1111
dirname -- "$0"
1212
)" && (
1313
pwd -P
1414
)
1515
)"
16+
readonly SCRIPT_PATH
1617

1718
readonly PYTHON_COMMAND="python${PYTHON_PACKAGE_VERSION}"
1819
readonly PYTHON_VENV_PATH="${SCRIPT_PATH}/compilesketches/.venv"

0 commit comments

Comments
 (0)