Skip to content

Commit

Permalink
Fix some SC2086 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 21, 2018
1 parent 78b07cd commit 2104b56
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .ci/travis/linux/script.sh
Expand Up @@ -20,14 +20,14 @@ source $(git rev-parse --show-toplevel)/.ci/travis/scripts/travis_envvar_helper.


DOCKER_QGIS_IMAGE_BUILD_PUSH=$(create_qgis_image) DOCKER_QGIS_IMAGE_BUILD_PUSH=$(create_qgis_image)


mkdir -p $CCACHE_DIR mkdir -p "$CCACHE_DIR"


if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ true ]]; then if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ true ]]; then
DIR=$(git rev-parse --show-toplevel)/.docker DIR=$(git rev-parse --show-toplevel)/.docker
pushd "${DIR}" pushd "${DIR}"
echo "${bold}Building QGIS Docker image '${DOCKER_TAG}'...${endbold}" echo "${bold}Building QGIS Docker image '${DOCKER_TAG}'...${endbold}"
docker build --build-arg CACHE_DIR=/root/.ccache \ docker build --build-arg CACHE_DIR=/root/.ccache \
--build-arg DOCKER_TAG=${DOCKER_TAG} \ --build-arg DOCKER_TAG="${DOCKER_TAG}" \
--cache-from "qgis/qgis:${DOCKER_TAG}" \ --cache-from "qgis/qgis:${DOCKER_TAG}" \
-t "qgis/qgis:${DOCKER_TAG}" \ -t "qgis/qgis:${DOCKER_TAG}" \
-f qgis.dockerfile .. -f qgis.dockerfile ..
Expand Down
2 changes: 1 addition & 1 deletion .ci/travis/macos/script.sh
Expand Up @@ -33,7 +33,7 @@ TIMEOUT=$((40 * 60 - $(date +%s) + $(cat /tmp/travis_timestamp)))
export CTEST_BUILD_COMMAND=/usr/local/bin/ninja export CTEST_BUILD_COMMAND=/usr/local/bin/ninja
export CTEST_BUILD_DIR=${TRAVIS_BUILD_DIR} export CTEST_BUILD_DIR=${TRAVIS_BUILD_DIR}


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


rv=$? rv=$?


Expand Down
2 changes: 1 addition & 1 deletion scripts/customwidget_create.sh
Expand Up @@ -26,7 +26,7 @@ declare -a EXT=("cpp" "h")
for i in "${EXT[@]}" for i in "${EXT[@]}"
do do
DESTFILE=$DIR/../src/customwidgets/${CLASSLOWER}plugin.$i DESTFILE=$DIR/../src/customwidgets/${CLASSLOWER}plugin.$i
cp $DIR/customwidget.$i.template $DESTFILE cp "$DIR"/customwidget."$i".template "$DESTFILE"
sed -i s/%DATE%/"$TODAY"/g "$DESTFILE" sed -i s/%DATE%/"$TODAY"/g "$DESTFILE"
sed -i s/%YEAR%/"$YEAR"/g "$DESTFILE" sed -i s/%YEAR%/"$YEAR"/g "$DESTFILE"
sed -i s/%AUTHOR%/"$AUTHOR"/g "$DESTFILE" sed -i s/%AUTHOR%/"$AUTHOR"/g "$DESTFILE"
Expand Down
50 changes: 25 additions & 25 deletions scripts/prepare-commit.sh
Expand Up @@ -22,7 +22,7 @@ if ! tty -s && [[ "$0" =~ /pre-commit ]]; then
exec </dev/tty exec </dev/tty
fi fi


cd $TOPLEVEL cd "$TOPLEVEL"


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


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




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


ASTYLEDIFF=astyle.$REV.diff ASTYLEDIFF=astyle.$REV.diff
true > $ASTYLEDIFF true > "$ASTYLEDIFF"


# reformat # reformat
i=0 i=0
N=$(echo $MODIFIED | wc -w) N=$(echo "$MODIFIED" | wc -w)
for f in $MODIFIED; do for f in $MODIFIED; do
(( i++ )) || true (( i++ )) || true


case "$f" in case "$f" in
src/core/gps/qextserialport/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*|src/3d/poly2tri/*) src/core/gps/qextserialport/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*|src/3d/poly2tri/*)
echo $f skipped echo "$f" skipped
continue continue
;; ;;


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


m=$f.$REV.prepare m=$f.$REV.prepare


cp $f $m cp "$f" "$m"
ASTYLEPROGRESS=" [$i/$N]" astyle.sh $f ASTYLEPROGRESS=" [$i/$N]" astyle.sh "$f"
if diff -u $m $f >>$ASTYLEDIFF; then if diff -u "$m" "$f" >>"$ASTYLEDIFF"; then
# no difference found # no difference found
rm $m rm "$m"
fi fi
done done


if [ -s "$ASTYLEDIFF" ]; then if [ -s "$ASTYLEDIFF" ]; then
if tty -s; then if tty -s; then
# review astyle changes # review astyle changes
colordiff <$ASTYLEDIFF | less -r colordiff <"$ASTYLEDIFF" | less -r
else else
echo "Files changed (see $ASTYLEDIFF)" echo "Files changed (see $ASTYLEDIFF)"
fi fi
else else
rm $ASTYLEDIFF rm "$ASTYLEDIFF"
fi fi




# verify SIP files # verify SIP files
SIPIFYDIFF=sipify.$REV.diff SIPIFYDIFF=sipify.$REV.diff
true > $SIPIFYDIFF true > "$SIPIFYDIFF"
for f in $MODIFIED; do for f in $MODIFIED; do
# if cpp header # if cpp header
if [[ $f =~ ^src\/(core|gui|analysis|server)\/.*\.h$ ]]; then if [[ $f =~ ^src\/(core|gui|analysis|server)\/.*\.h$ ]]; then
# look if corresponding SIP file # look if corresponding SIP file
sip_file=$(${GP}sed -r 's@^src/(core|gui|analysis|server)/@@; s@\.h$@.sip@' <<<$f ) sip_file=$(${GP}sed -r 's@^src/(core|gui|analysis|server)/@@; s@\.h$@.sip@' <<<"$f" )
pyfile=$(${GP}sed -E 's@([^\/]+\/)*([^\/]+)\.sip@\2.py@;' <<< $sip_file) pyfile=$(${GP}sed -E 's@([^\/]+\/)*([^\/]+)\.sip@\2.py@;' <<< "$sip_file")
module=$(${GP}sed -r 's@src/(core|gui|analysis|server)/.*$@\1@' <<<$f ) module=$(${GP}sed -r 's@src/(core|gui|analysis|server)/.*$@\1@' <<<"$f" )
if grep -Fq "$sip_file" ${TOPLEVEL}/python/${module}/${module}_auto.sip; then if grep -Fq "$sip_file" "${TOPLEVEL}"/python/"${module}"/"${module}"_auto.sip; then
sip_file=$(${GP}sed -r 's@^src/(core|gui|analysis|server)@\1/auto_generated@; s@\.h$@.sip.in@' <<<$f ) sip_file=$(${GP}sed -r 's@^src/(core|gui|analysis|server)@\1/auto_generated@; s@\.h$@.sip.in@' <<<"$f" )
m=python/$sip_file.$REV.prepare m=python/$sip_file.$REV.prepare
touch python/$sip_file touch python/"$sip_file"
cp python/$sip_file $m cp python/"$sip_file" "$m"
${TOPLEVEL}/scripts/sipify.pl -s python/$sip_file -p python/${module}/auto_additions/${pyfile} $f "${TOPLEVEL}"/scripts/sipify.pl -s python/"$sip_file" -p python/"${module}"/auto_additions/"${pyfile}" "$f"
if ! diff -u $m python/$sip_file >>$SIPIFYDIFF; then if ! diff -u "$m" python/"$sip_file" >>"$SIPIFYDIFF"; then
echo "python/$sip_file is not up to date" echo "python/$sip_file is not up to date"
fi fi
rm $m rm "$m"
fi fi
fi fi
done done
if [[ -s "$SIPIFYDIFF" ]]; then if [[ -s "$SIPIFYDIFF" ]]; then
if tty -s; then if tty -s; then
# review astyle changes # review astyle changes
colordiff <$SIPIFYDIFF | less -r colordiff <"$SIPIFYDIFF" | less -r
else else
echo "Files changed (see $ASTYLEDIFF)" echo "Files changed (see $ASTYLEDIFF)"
fi fi
exit 1 exit 1
else else
rm $SIPIFYDIFF rm "$SIPIFYDIFF"
fi fi
if [ -s "$ASTYLEDIFF" ]; then if [ -s "$ASTYLEDIFF" ]; then
exit 1 exit 1
Expand Down
34 changes: 17 additions & 17 deletions scripts/replacev2.sh
Expand Up @@ -9,57 +9,57 @@ r=$(mktemp -t repl.XXXX.pl)
d=$(mktemp -t apibreak.XXXX.txt) d=$(mktemp -t apibreak.XXXX.txt)


# Rename classes # Rename classes
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) 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)
do do
src=$i src=$i
dst=${src/V2/} dst=${src/V2/}
if git --no-pager grep -l "\<$dst\>" $codepaths; then if git --no-pager grep -l "\<$dst\>" "$codepaths"; then
echo "$src vs $dst" >>$s echo "$src vs $dst" >>"$s"
else else
echo " REPLACE $src => $dst" echo " REPLACE $src => $dst"
echo "s/\b$src\b/$dst/g;" >>$r echo "s/\b$src\b/$dst/g;" >>"$r"
echo "s/\bsipType_$src\b/sipType_$dst/;" >>$r echo "s/\bsipType_$src\b/sipType_$dst/;" >>"$r"
echo "<tr><td>$src<td>$dst" >>$d echo "<tr><td>$src<td>$dst" >>"$d"
fi fi
done done


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) 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)
do do
src=$i src=$i
dst=${src/V2/} dst=${src/V2/}


if git --no-pager grep -l "\<$dst\>" $codepaths; then if git --no-pager grep -l "\<$dst\>" "$codepaths"; then
echo "$src vs $dst" >>$s echo "$src vs $dst" >>"$s"
else else
echo " REPLACE $src => $dst" echo " REPLACE $src => $dst"
echo "s/\b$src\b/$dst/g;" >>$r echo "s/\b$src\b/$dst/g;" >>"$r"
echo "<tr><td>$src<td>$dst" >>$d echo "<tr><td>$src<td>$dst" >>"$d"
fi fi
done done


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


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


case "$s" in case "$s" in
*.sip) *.sip)
echo "s#\b$s\b#$d#g;" >>$r echo "s#\b$s\b#$d#g;" >>"$r"
;; ;;


*) *)
echo "s#\b$s\b#$d#g;" >>$r echo "s#\b$s\b#$d#g;" >>"$r"
;; ;;
esac esac
done done


echo "API breaks logged to: $d" echo "API breaks logged to: $d"
echo "Skipped V2 symbols: $s" echo "Skipped V2 symbols: $s"
echo "Replacing from $r" echo "Replacing from $r"
find $codepaths -type f | xargs perl -i -p $r find "$codepaths" -type f | xargs perl -i -p "$r"
2 changes: 1 addition & 1 deletion scripts/sort_include.sh
Expand Up @@ -73,7 +73,7 @@ do
sort -u $FILE3 >> $FILE1 sort -u $FILE3 >> $FILE1
SORTING=false SORTING=false
fi fi
mv $FILE1 $file mv $FILE1 "$file"
rm -f $FILE1 $FILE2 $FILE3 rm -f $FILE1 $FILE2 $FILE3
done done


0 comments on commit 2104b56

Please sign in to comment.