From fc774967a7c4eba4b62811a21f083f2af5ff2570 Mon Sep 17 00:00:00 2001 From: Tim Johnson Date: Mon, 14 Oct 2019 09:27:23 -0700 Subject: [PATCH] Change case of 'maven_options' Shellcheck will check for 'used-before-set' only if variable is lower-case. Change-Id: I5c91d493a584d332cc587be37d53b3c98e5dbb3a Signed-off-by: Tim Johnson --- jenkins-init-scripts/lf-env.sh | 11 +++++------ .../notes/update-lf-bash-library-3a19064371ef7fca.yaml | 5 +++++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/update-lf-bash-library-3a19064371ef7fca.yaml diff --git a/jenkins-init-scripts/lf-env.sh b/jenkins-init-scripts/lf-env.sh index 68e6cf03..252328f8 100644 --- a/jenkins-init-scripts/lf-env.sh +++ b/jenkins-init-scripts/lf-env.sh @@ -66,15 +66,14 @@ function lf-activate() # Functions that assign Variables ################################################################################ -# Although these variables are 'shell' variables, they need to be upper-case so -# 'shellcheck' does check for 'used-before-set' when they are referenced. So if -# forget to 'source' this file, you will get a 'run-time' error (if you have -u -# set), otherwise you will get "MAVEN_OPIONS=''. +# These variables are shell (local) variables and need to be lower-case so +# Shellcheck knows they are shell variables and will check for +# 'used-before-set'. function lf-set-maven-options() { # shellcheck disable=SC2034 # Disable 'unused-variable' check - MAVEN_OPTIONS=$(echo --show-version --batch-mode -Djenkins \ + maven_options="--show-version --batch-mode -Djenkins \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ - -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r) + -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r" } diff --git a/releasenotes/notes/update-lf-bash-library-3a19064371ef7fca.yaml b/releasenotes/notes/update-lf-bash-library-3a19064371ef7fca.yaml new file mode 100644 index 00000000..57662a3c --- /dev/null +++ b/releasenotes/notes/update-lf-bash-library-3a19064371ef7fca.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Update to lf-env.sh. Change lf-set-maven-options(): MAVEN_OPTIONS to + maven_options to better support shellcheck. -- 2.16.6