Skip to content

Commit 2104b56

Browse files
committed
Fix some SC2086 warnings
1 parent 78b07cd commit 2104b56

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed

.ci/travis/linux/script.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ source $(git rev-parse --show-toplevel)/.ci/travis/scripts/travis_envvar_helper.
2020

2121
DOCKER_QGIS_IMAGE_BUILD_PUSH=$(create_qgis_image)
2222

23-
mkdir -p $CCACHE_DIR
23+
mkdir -p "$CCACHE_DIR"
2424

2525
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ true ]]; then
2626
DIR=$(git rev-parse --show-toplevel)/.docker
2727
pushd "${DIR}"
2828
echo "${bold}Building QGIS Docker image '${DOCKER_TAG}'...${endbold}"
2929
docker build --build-arg CACHE_DIR=/root/.ccache \
30-
--build-arg DOCKER_TAG=${DOCKER_TAG} \
30+
--build-arg DOCKER_TAG="${DOCKER_TAG}" \
3131
--cache-from "qgis/qgis:${DOCKER_TAG}" \
3232
-t "qgis/qgis:${DOCKER_TAG}" \
3333
-f qgis.dockerfile ..

.ci/travis/macos/script.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ TIMEOUT=$((40 * 60 - $(date +%s) + $(cat /tmp/travis_timestamp)))
3333
export CTEST_BUILD_COMMAND=/usr/local/bin/ninja
3434
export CTEST_BUILD_DIR=${TRAVIS_BUILD_DIR}
3535

36-
gtimeout "${TIMEOUT}s" ctest -V -E "$(cat ${DIR}/blacklist.txt | gsed -r '/^(#.*?)?$/d' | gpaste -sd '|' -)" -S "${DIR}/../travis.ctest" --output-on-failure
36+
gtimeout "${TIMEOUT}s" ctest -V -E "$(cat "${DIR}"/blacklist.txt | gsed -r '/^(#.*?)?$/d' | gpaste -sd '|' -)" -S "${DIR}/../travis.ctest" --output-on-failure
3737

3838
rv=$?
3939

scripts/customwidget_create.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare -a EXT=("cpp" "h")
2626
for i in "${EXT[@]}"
2727
do
2828
DESTFILE=$DIR/../src/customwidgets/${CLASSLOWER}plugin.$i
29-
cp $DIR/customwidget.$i.template $DESTFILE
29+
cp "$DIR"/customwidget."$i".template "$DESTFILE"
3030
sed -i s/%DATE%/"$TODAY"/g "$DESTFILE"
3131
sed -i s/%YEAR%/"$YEAR"/g "$DESTFILE"
3232
sed -i s/%AUTHOR%/"$AUTHOR"/g "$DESTFILE"

scripts/prepare-commit.sh

+25-25
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if ! tty -s && [[ "$0" =~ /pre-commit ]]; then
2222
exec </dev/tty
2323
fi
2424

25-
cd $TOPLEVEL
25+
cd "$TOPLEVEL"
2626

2727
# GNU prefix command for mac os support (gsed, gsplit)
2828
GP=
@@ -57,25 +57,25 @@ if [ -z "$MODIFIED" ]; then
5757
exit 0
5858
fi
5959

60-
if [[ -n "$QGIS_CHECK_SPELLING" && -x ${TOPLEVEL}/scripts/spell_check/check_spelling.sh ]]; then ${TOPLEVEL}/scripts/spell_check/check_spelling.sh $MODIFIED; fi
60+
if [[ -n "$QGIS_CHECK_SPELLING" && -x "${TOPLEVEL}"/scripts/spell_check/check_spelling.sh ]]; then "${TOPLEVEL}"/scripts/spell_check/check_spelling.sh "$MODIFIED"; fi
6161

6262

6363
# save original changes
6464
REV=$(git log -n1 --pretty=%H)
65-
git diff >sha-$REV.diff
65+
git diff >sha-"$REV".diff
6666

6767
ASTYLEDIFF=astyle.$REV.diff
68-
true > $ASTYLEDIFF
68+
true > "$ASTYLEDIFF"
6969

7070
# reformat
7171
i=0
72-
N=$(echo $MODIFIED | wc -w)
72+
N=$(echo "$MODIFIED" | wc -w)
7373
for f in $MODIFIED; do
7474
(( i++ )) || true
7575

7676
case "$f" in
7777
src/core/gps/qextserialport/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*|src/3d/poly2tri/*)
78-
echo $f skipped
78+
echo "$f" skipped
7979
continue
8080
;;
8181

@@ -89,59 +89,59 @@ for f in $MODIFIED; do
8989

9090
m=$f.$REV.prepare
9191

92-
cp $f $m
93-
ASTYLEPROGRESS=" [$i/$N]" astyle.sh $f
94-
if diff -u $m $f >>$ASTYLEDIFF; then
92+
cp "$f" "$m"
93+
ASTYLEPROGRESS=" [$i/$N]" astyle.sh "$f"
94+
if diff -u "$m" "$f" >>"$ASTYLEDIFF"; then
9595
# no difference found
96-
rm $m
96+
rm "$m"
9797
fi
9898
done
9999

100100
if [ -s "$ASTYLEDIFF" ]; then
101101
if tty -s; then
102102
# review astyle changes
103-
colordiff <$ASTYLEDIFF | less -r
103+
colordiff <"$ASTYLEDIFF" | less -r
104104
else
105105
echo "Files changed (see $ASTYLEDIFF)"
106106
fi
107107
else
108-
rm $ASTYLEDIFF
108+
rm "$ASTYLEDIFF"
109109
fi
110110

111111

112112
# verify SIP files
113113
SIPIFYDIFF=sipify.$REV.diff
114-
true > $SIPIFYDIFF
114+
true > "$SIPIFYDIFF"
115115
for f in $MODIFIED; do
116116
# if cpp header
117117
if [[ $f =~ ^src\/(core|gui|analysis|server)\/.*\.h$ ]]; then
118118
# look if corresponding SIP file
119-
sip_file=$(${GP}sed -r 's@^src/(core|gui|analysis|server)/@@; s@\.h$@.sip@' <<<$f )
120-
pyfile=$(${GP}sed -E 's@([^\/]+\/)*([^\/]+)\.sip@\2.py@;' <<< $sip_file)
121-
module=$(${GP}sed -r 's@src/(core|gui|analysis|server)/.*$@\1@' <<<$f )
122-
if grep -Fq "$sip_file" ${TOPLEVEL}/python/${module}/${module}_auto.sip; then
123-
sip_file=$(${GP}sed -r 's@^src/(core|gui|analysis|server)@\1/auto_generated@; s@\.h$@.sip.in@' <<<$f )
119+
sip_file=$(${GP}sed -r 's@^src/(core|gui|analysis|server)/@@; s@\.h$@.sip@' <<<"$f" )
120+
pyfile=$(${GP}sed -E 's@([^\/]+\/)*([^\/]+)\.sip@\2.py@;' <<< "$sip_file")
121+
module=$(${GP}sed -r 's@src/(core|gui|analysis|server)/.*$@\1@' <<<"$f" )
122+
if grep -Fq "$sip_file" "${TOPLEVEL}"/python/"${module}"/"${module}"_auto.sip; then
123+
sip_file=$(${GP}sed -r 's@^src/(core|gui|analysis|server)@\1/auto_generated@; s@\.h$@.sip.in@' <<<"$f" )
124124
m=python/$sip_file.$REV.prepare
125-
touch python/$sip_file
126-
cp python/$sip_file $m
127-
${TOPLEVEL}/scripts/sipify.pl -s python/$sip_file -p python/${module}/auto_additions/${pyfile} $f
128-
if ! diff -u $m python/$sip_file >>$SIPIFYDIFF; then
125+
touch python/"$sip_file"
126+
cp python/"$sip_file" "$m"
127+
"${TOPLEVEL}"/scripts/sipify.pl -s python/"$sip_file" -p python/"${module}"/auto_additions/"${pyfile}" "$f"
128+
if ! diff -u "$m" python/"$sip_file" >>"$SIPIFYDIFF"; then
129129
echo "python/$sip_file is not up to date"
130130
fi
131-
rm $m
131+
rm "$m"
132132
fi
133133
fi
134134
done
135135
if [[ -s "$SIPIFYDIFF" ]]; then
136136
if tty -s; then
137137
# review astyle changes
138-
colordiff <$SIPIFYDIFF | less -r
138+
colordiff <"$SIPIFYDIFF" | less -r
139139
else
140140
echo "Files changed (see $ASTYLEDIFF)"
141141
fi
142142
exit 1
143143
else
144-
rm $SIPIFYDIFF
144+
rm "$SIPIFYDIFF"
145145
fi
146146
if [ -s "$ASTYLEDIFF" ]; then
147147
exit 1

scripts/replacev2.sh

+17-17
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,57 @@ r=$(mktemp -t repl.XXXX.pl)
99
d=$(mktemp -t apibreak.XXXX.txt)
1010

1111
# Rename classes
12-
for i in $(git --no-pager grep "Qgs[a-zA-Z0-9_]*V2" $codepaths | perl -pe 's#^.*(Qgs[a-zA-Z0-9_]*)V2([a-zA-Z0-9_]*).*$#$1V2$2#' | sort -u)
12+
for i in $(git --no-pager grep "Qgs[a-zA-Z0-9_]*V2" "$codepaths" | perl -pe 's#^.*(Qgs[a-zA-Z0-9_]*)V2([a-zA-Z0-9_]*).*$#$1V2$2#' | sort -u)
1313
do
1414
src=$i
1515
dst=${src/V2/}
16-
if git --no-pager grep -l "\<$dst\>" $codepaths; then
17-
echo "$src vs $dst" >>$s
16+
if git --no-pager grep -l "\<$dst\>" "$codepaths"; then
17+
echo "$src vs $dst" >>"$s"
1818
else
1919
echo " REPLACE $src => $dst"
20-
echo "s/\b$src\b/$dst/g;" >>$r
21-
echo "s/\bsipType_$src\b/sipType_$dst/;" >>$r
22-
echo "<tr><td>$src<td>$dst" >>$d
20+
echo "s/\b$src\b/$dst/g;" >>"$r"
21+
echo "s/\bsipType_$src\b/sipType_$dst/;" >>"$r"
22+
echo "<tr><td>$src<td>$dst" >>"$d"
2323
fi
2424
done
2525

26-
for i in $(git --no-pager grep "::[a-zA-Z0-9_]*V2" $codepaths | perl -pe 's#^.*::([a-zA-Z0-9_]*)V2([a-zA-Z0-9_]*).*$#$1V2$2#' | grep -v -E "^Qgs|SslV2" | sort -u)
26+
for i in $(git --no-pager grep "::[a-zA-Z0-9_]*V2" "$codepaths" | perl -pe 's#^.*::([a-zA-Z0-9_]*)V2([a-zA-Z0-9_]*).*$#$1V2$2#' | grep -v -E "^Qgs|SslV2" | sort -u)
2727
do
2828
src=$i
2929
dst=${src/V2/}
3030

31-
if git --no-pager grep -l "\<$dst\>" $codepaths; then
32-
echo "$src vs $dst" >>$s
31+
if git --no-pager grep -l "\<$dst\>" "$codepaths"; then
32+
echo "$src vs $dst" >>"$s"
3333
else
3434
echo " REPLACE $src => $dst"
35-
echo "s/\b$src\b/$dst/g;" >>$r
36-
echo "<tr><td>$src<td>$dst" >>$d
35+
echo "s/\b$src\b/$dst/g;" >>"$r"
36+
echo "<tr><td>$src<td>$dst" >>"$d"
3737
fi
3838
done
3939

40-
find $codepaths \( -name "*v2*.h" -o -name "*v2*.cpp" -o -name "*v2*.sip" \) -type f | while read f; do
40+
find "$codepaths" \( -name "*v2*.h" -o -name "*v2*.cpp" -o -name "*v2*.sip" \) -type f | while read f; do
4141
s=${f##*/}
4242
d=${s/v2/}
4343
echo "FIND $d"
44-
if [ $(find $codepaths -name "$d" -print | wc -l) -gt 0 ]; then
45-
echo "$f vs $b" >>$s
44+
if [ $(find "$codepaths" -name "$d" -print | wc -l) -gt 0 ]; then
45+
echo "$f vs $b" >>"$s"
4646
continue
4747
fi
4848

4949
git mv "$f" "${f/v2/}"
5050

5151
case "$s" in
5252
*.sip)
53-
echo "s#\b$s\b#$d#g;" >>$r
53+
echo "s#\b$s\b#$d#g;" >>"$r"
5454
;;
5555

5656
*)
57-
echo "s#\b$s\b#$d#g;" >>$r
57+
echo "s#\b$s\b#$d#g;" >>"$r"
5858
;;
5959
esac
6060
done
6161

6262
echo "API breaks logged to: $d"
6363
echo "Skipped V2 symbols: $s"
6464
echo "Replacing from $r"
65-
find $codepaths -type f | xargs perl -i -p $r
65+
find "$codepaths" -type f | xargs perl -i -p "$r"

scripts/sort_include.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ do
7373
sort -u $FILE3 >> $FILE1
7474
SORTING=false
7575
fi
76-
mv $FILE1 $file
76+
mv $FILE1 "$file"
7777
rm -f $FILE1 $FILE2 $FILE3
7878
done
7979

0 commit comments

Comments
 (0)