Skip to content

Commit c179b95

Browse files
committed
ci(shellcheck): drop SC2086 in demoLibrary.source (C3b)
PR C3b of the ratchet cleanup. Closes the file-level SC2086 disable for docker/scripts/demoLibrary.source via shellcheck's `-f diff` auto-fix (filtered with `-e SC2006,SC2155` so the diff covers only SC2086 hunks; C3a owns the SC2006 + SC2155 work and is in flight as a parallel PR). Auto-fix changes (72 sites): Pattern is uniformly mechanical quoting -- `${1}` -> `"${1}"`, `$MYSQLIP` -> `"$MYSQLIP"`, etc. Most are inside docker / mysql / mysqladmin command lines, where each `${...}` is a single arg (cluster name, password, image string) -- safe to quote without changing behavior. No intentional-word-split sites in this file (unlike $rpassparam in demo_build.sh and $EXTRA_ARGS in test.sh which needed inline disables in C2). File-level disable on demoLibrary.source: - Trimmed from `disable=SC2086,SC2006,SC2155` to `disable=SC2006`. (The 4 SC2006 backtick sites + the 4 SC2155 sites they mask are still here pending C3a's land.) Once C3a lands and is merged, the directive becomes empty and can be removed entirely. Verification: - `shellcheck --check-sourced --external-sources` repo-wide -- clean. - `./tools/build-tests/test.sh` -- 7/7 PASS. - `./tools/auto-derive/fixtures-and-tests/test.sh` -- 8/8 PASS. Coordination with C3a: Both PRs touch the same file-level `# shellcheck disable=...` line. Whichever lands second will rebase and re-apply its directive edit (or it'll be a trivial 3-way merge -- both PRs trim entries from the same comma-separated list). State after both C3a and C3b land: - .shellcheckrc: zero `disable=` lines (just `external-sources=true`) - demoLibrary.source file-level directive: removed entirely - Full repo is shellcheck-clean. Refs: openemr#146 (parent), openemr#149 + openemr#150 + openemr#151 + openemr#152 (prior ratchet PRs), openemr#156 (C3a) Assisted-by: Claude Code
1 parent e39b924 commit c179b95

1 file changed

Lines changed: 29 additions & 37 deletions

File tree

docker/scripts/demoLibrary.source

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
#
1010
# Bash library for openemr demo farm
1111
#
12-
# Per-file shellcheck ratchet (issue #146 cleanup, post-C2 + C3a):
13-
# the 72 SC2086 violations in this file remain deferred to PR C3b.
14-
# C3a closed out SC2006 (4 sites) and SC2155 (4 sites — surfaced after
15-
# SC2006 fix at the same code positions, same masked-warning pattern
16-
# as C2's SC2002 fold-in). C3b will fix each SC2086 site individually
17-
# and remove this directive.
18-
# shellcheck disable=SC2086
19-
2012
# This is the wrapper to start the demo, so only need to modify the specifics in 1 place
2113
# rather than 2. Picks the right flex image + instance count per cluster, then
2214
# delegates to startDemo() which does the docker run.
@@ -93,31 +85,31 @@ stopDemo () {
9385

9486
# Stop the docker
9587
echo "Stop ${1}-openemr docker"
96-
docker stop ${1}-openemr
97-
docker rm ${1}-openemr
88+
docker stop "${1}"-openemr
89+
docker rm "${1}"-openemr
9890

9991
# Remove the database stuff
10092
echo "Clear ${1}-openemr databases and users"
101-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}
102-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_a
103-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_b
104-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_c
105-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_d
106-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_e
107-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_f
108-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_g
109-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_h
110-
mysqladmin -f -h ${MYSQLIP} -u root -p${2} drop ${1}_i
111-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}';FLUSH PRIVILEGES;"
112-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_a';FLUSH PRIVILEGES;"
113-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_b';FLUSH PRIVILEGES;"
114-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_c';FLUSH PRIVILEGES;"
115-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_d';FLUSH PRIVILEGES;"
116-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_e';FLUSH PRIVILEGES;"
117-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_f';FLUSH PRIVILEGES;"
118-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_g';FLUSH PRIVILEGES;"
119-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_h';FLUSH PRIVILEGES;"
120-
mysql -f -h ${MYSQLIP} -u root -p${2} -e "DROP USER '${1}_i';FLUSH PRIVILEGES;"
93+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"
94+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_a
95+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_b
96+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_c
97+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_d
98+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_e
99+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_f
100+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_g
101+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_h
102+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${2}" drop "${1}"_i
103+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}';FLUSH PRIVILEGES;"
104+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_a';FLUSH PRIVILEGES;"
105+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_b';FLUSH PRIVILEGES;"
106+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_c';FLUSH PRIVILEGES;"
107+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_d';FLUSH PRIVILEGES;"
108+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_e';FLUSH PRIVILEGES;"
109+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_f';FLUSH PRIVILEGES;"
110+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_g';FLUSH PRIVILEGES;"
111+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_h';FLUSH PRIVILEGES;"
112+
mysql -f -h "${MYSQLIP}" -u root -p"${2}" -e "DROP USER '${1}_i';FLUSH PRIVILEGES;"
121113
}
122114

123115
# Will start an openemr demo
@@ -136,7 +128,7 @@ stopDemo () {
136128
startDemo () {
137129
# Start docker
138130
echo "Start ${1}-openemr docker"
139-
docker run --detach --name ${1}-openemr \
131+
docker run --detach --name "${1}"-openemr \
140132
--env "DOCKERDEMO=${1}" \
141133
--env "DOCKERMYSQLHOST=${2}" \
142134
--env "DOCKERNUMBERDEMOS=${4}" \
@@ -151,7 +143,7 @@ startDemo () {
151143
-v ~/cred/sasl_passwd.db:/etc/postfix/sasl_passwd.db:ro \
152144
-v ~/cred/github-key:/home/openemr/github-key:ro \
153145
--net mynet \
154-
${3} \
146+
"${3}" \
155147
bash -c "mkdir -p /home/openemr/git && cd /home/openemr/git && git clone https://github.com/openemr/demo_farm_openemr.git && bash /home/openemr/git/demo_farm_openemr/demo_build.sh"
156148
}
157149

@@ -165,13 +157,13 @@ restartSubdemo () {
165157

166158
# Remove the database stuff
167159
if [ "$2" == "empty" ]; then
168-
mysqladmin -f -h ${MYSQLIP} -u root -p${3} drop ${1}
160+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${3}" drop "${1}"
169161
else
170-
mysqladmin -f -h ${MYSQLIP} -u root -p${3} drop ${1}_${2}
162+
mysqladmin -f -h "${MYSQLIP}" -u root -p"${3}" drop "${1}"_"${2}"
171163
fi
172164

173165
# Now need to reset the demo within the docker
174-
docker exec -t ${1}-openemr bash -c "cd /home/openemr/git/demo_farm_openemr &&
166+
docker exec -t "${1}"-openemr bash -c "cd /home/openemr/git/demo_farm_openemr &&
175167
git fetch &&
176168
git pull origin master &&
177169
cd ~/ &&
@@ -300,11 +292,11 @@ snapshotDemo() {
300292
mkdir -p "${tmpPath}"
301293
if [ "$2" == "empty" ]; then
302294
echo "snapshot of empty subname (ie. the one without a letter)"
303-
mysqldump --ignore-table=${1}.onsite_activity_view --hex-blob -u root -p${3} -h ${MYSQLIP} ${1} > "${tmpPath}/backup.sql"
295+
mysqldump --ignore-table="${1}".onsite_activity_view --hex-blob -u root -p"${3}" -h "${MYSQLIP}" "${1}" > "${tmpPath}/backup.sql"
304296
docker cp "${1}-openemr:/var/www/localhost/htdocs/openemr/sites" "${tmpPath}"
305297
else
306298
echo "snapshot of non-empty subname (ie. with a letter)"
307-
mysqldump --ignore-table=${1}_${2}.onsite_activity_view --hex-blob -u root -p${3} -h ${MYSQLIP} ${1}_${2} > "${tmpPath}/backup.sql"
299+
mysqldump --ignore-table="${1}"_"${2}".onsite_activity_view --hex-blob -u root -p"${3}" -h "${MYSQLIP}" "${1}"_"${2}" > "${tmpPath}/backup.sql"
308300
docker cp "${1}-openemr:/var/www/localhost/htdocs/${2}/openemr/sites" "${tmpPath}"
309301
fi
310302
cd "${tmp}" || return 1

0 commit comments

Comments
 (0)