Skip to content

Commit

Permalink
ci/checkshellcheck: Double quote ... SC2086
Browse files Browse the repository at this point in the history
Address the warning
"Double quote to prevent globbing and word splitting. [SC2086]"
When shellcheck was introduced, it was somewhat missed that there
where a ton of warnings.
Start to address the most common:
"Double quote"

There are 3 ways to adsress this:
- (1) Rewrite the code
- (2) Disable the warning on a file-by-file bases
- (3) Disable the warning on command line

This patch goes for (1) when there is only one or two lines to be changed,
and (2) when there are many lines to be changed.
(2) is choosen to avoid touching working shell-code with the risk that
something brakes: Not all shell scripts are run on a regular bases.
It is better to look at these when the file is changed the next time.

And as a side-note: More wanings need to be addressed in the next commits
  • Loading branch information
tboegi committed Nov 24, 2023
1 parent 0904e4f commit a935d74
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/install-mini-conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e -x

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
bash miniconda.sh -b -p "$HOME/miniconda"
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
conda config --set always_yes yes --set changeps1 no
Expand Down
1 change: 1 addition & 0 deletions test/pytests36/doRunTests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086

set -x

Expand Down
1 change: 1 addition & 0 deletions test/pytests36/runTests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# shellcheck disable=SC2086
#
# Wrapper scipt to run tests
# Usage:
Expand Down
1 change: 1 addition & 0 deletions test/pytests36/test-ioc-with-sim-indexer-one-TC-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086

#PVNAME=ca://IOC:m1
PVNAME=$1
Expand Down
1 change: 1 addition & 0 deletions test/pytests36/test-ioc-with-sim-indexer-one-TC.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086

set -x

Expand Down
1 change: 1 addition & 0 deletions test/pythonscripts/monEL1252-YMIR-crate007.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086
P="LabS-MCAG:MC-MCU-07:"
if ! type pvmonitor >/dev/null 2>&1; then
. ~/MCAG_SetupMotionDemo/.epics.ymir-vm-ioc-01.cn.nin.ess.eu.Linux.x86_64
Expand Down
1 change: 1 addition & 0 deletions test/pythonscripts/monEL6688-1252-crate007.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086
P="LabS-MCAG:MC-MCU-07:"
if ! type pvmonitor >/dev/null 2>&1; then
. ~/MCAG_SetupMotionDemo/.epics.ymir-vm-ioc-01.cn.nin.ess.eu.Linux.x86_64
Expand Down
1 change: 1 addition & 0 deletions test/pythonscripts/monEL6688-YMIR.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086
P="LabS-MCAG:MC-MCU-07:"
if ! type pvmonitor >/dev/null 2>&1; then
. ~/MCAG_SetupMotionDemo/.epics.ymir-vm-ioc-01.cn.nin.ess.eu.Linux.x86_64
Expand Down
1 change: 1 addition & 0 deletions test/pythonscripts/monESTIAauxbits.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086

# Script to monitor MotorPositions
# The positions are timestamped inside the controller:
Expand Down
1 change: 1 addition & 0 deletions test/pythonscripts/monPTPOffsets.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086
P="LabS-MCAG:MC-MCU-07:"
if ! type pvmonitor >/dev/null 2>&1; then
. ~/MCAG_SetupMotionDemo/.epics.ymir-vm-ioc-01.cn.nin.ess.eu.Linux.x86_64
Expand Down
1 change: 1 addition & 0 deletions test/pythonscripts/monRawMtrEnc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Monitor the values from the stepper terminal and the encoder
# terminal as well.

# shellcheck disable=SC2086
# Our motor to work against
if test -z "$P"; then
export P=LabS-MCAG:MC-MCU-07:
Expand Down
1 change: 1 addition & 0 deletions test/run-ethercatmc-ioc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086

#
# Shell script to generate (and run) an "st.cmd" for an IOC
Expand Down
2 changes: 1 addition & 1 deletion test/run-ethercatmc-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if test -z "$1"; then
exit 1
fi
./checkws.sh || {
echo >&2 $OLDPWD/checkws.sh failed
echo >&2 "$OLDPWD/checkws.sh" failed
exit 1
}
(
Expand Down
4 changes: 2 additions & 2 deletions test/run-simulator-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ if test -z "$1"; then
exit 1
fi
./checkws.sh || {
echo >&2 $OLDPWD/checkws.sh failed
echo >&2 "$OLDPWD"/checkws.sh failed
exit 1
}
(
cd pytests36/ &&
PV="$1"
shift
./runTests.sh "$PV" "$f" "$@"
./runTests.sh "$PV" "$@"
)
1 change: 1 addition & 0 deletions test/simulator/startSimulator.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2086
uname_S=$(uname -s 2>/dev/null || echo unknown)
uname_M=$(uname -m 2>/dev/null || echo unknown)
uname_R=$(uname -r 2>/dev/null | sed -e "s/[()/]/-/g" || echo unknown)
Expand Down

0 comments on commit a935d74

Please sign in to comment.