From 78b07cdf31140da18c0fa1190f13a9e72cafe8a8 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Thu, 21 Jun 2018 12:37:17 +1000 Subject: [PATCH] Fix SC2196 warnings --- scripts/chkcopyrights.sh | 2 +- scripts/chkspelling.sh | 2 +- scripts/replacev2.sh | 2 +- scripts/sip_include.sh | 4 ++-- tests/code_layout/test_shellcheck.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/chkcopyrights.sh b/scripts/chkcopyrights.sh index ba1c42fbc2d..1100845e236 100755 --- a/scripts/chkcopyrights.sh +++ b/scripts/chkcopyrights.sh @@ -16,5 +16,5 @@ licensecheck -r . | - egrep -v "\/debian\/|\.\/python\/ext-libs|\.\/ms-windows\/osgeo4w\/untgz\/|\.\/src\/app\/gps\/qwtpolar-|\.\/src\/app\/gps\/qwtpolar-1.0|: BSD \(3 clause\)|: GPL \(v[23] or later\)$|: LGPL \(v2 or later\)$|: MIT\/X11 \(BSD like\)$|: Apache \(v2\.0\) GPL \(v2 or later\)$|: LGPL$|: Apache \(v2\.0\)$|: zlib\/libpng$|: GPL LGPL$|GENERATED FILE" | + grep -v -E "\/debian\/|\.\/python\/ext-libs|\.\/ms-windows\/osgeo4w\/untgz\/|\.\/src\/app\/gps\/qwtpolar-|\.\/src\/app\/gps\/qwtpolar-1.0|: BSD \(3 clause\)|: GPL \(v[23] or later\)$|: LGPL \(v2 or later\)$|: MIT\/X11 \(BSD like\)$|: Apache \(v2\.0\) GPL \(v2 or later\)$|: LGPL$|: Apache \(v2\.0\)$|: zlib\/libpng$|: GPL LGPL$|GENERATED FILE" | sed -e "s/:.*$//" diff --git a/scripts/chkspelling.sh b/scripts/chkspelling.sh index dc0e74f7178..dfd72c1392c 100755 --- a/scripts/chkspelling.sh +++ b/scripts/chkspelling.sh @@ -19,4 +19,4 @@ RE=$(echo $(cut -d: -f1 scripts/spelling.dat | sed -e 's/^/\\|/;') | sed -e 's/| /|/g; s/|$//;') EX="\.(svn-base|tmp|xpm|ts|o)|spelling\.dat|Exception_to_GPL_for_Qt.txt|sqlite3.c|qgisstyle|LexerR.py|debian/build.*|debian/.*/usr/|ms-windows/osgeo4w|ChangeLog|src/plugins/grass/qtermwidget|src/app/gps/qwtpolar-|python/ext-libs|i18n/" -egrep --exclude=*.{png,svg,db,bz2,pdf,qgs,qml,api,pyc} --exclude-dir=.git --exclude-dir=debian/build* --color=always "$RE" -ir . | egrep -iv "$EX" +grep --exclude=*.{png,svg,db,bz2,pdf,qgs,qml,api,pyc} --exclude-dir=.git --exclude-dir=debian/build* --color=always -E "$RE" -ir . | grep -iv -E "$EX" diff --git a/scripts/replacev2.sh b/scripts/replacev2.sh index bef3a432465..3d075e40724 100755 --- a/scripts/replacev2.sh +++ b/scripts/replacev2.sh @@ -23,7 +23,7 @@ do fi 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#' | egrep -v "^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 src=$i dst=${src/V2/} diff --git a/scripts/sip_include.sh b/scripts/sip_include.sh index 5cf17bb3b71..b8c84f4ebf7 100755 --- a/scripts/sip_include.sh +++ b/scripts/sip_include.sh @@ -58,9 +58,9 @@ for module in "${modules[@]}"; do #echo "src/${module}/$header not found" continue fi - if ! egrep -xq '^(#define +)?SIP_NO_FILE' src/${module}/${header}; then + if ! grep -xq -E '^(#define +)?SIP_NO_FILE' src/${module}/${header}; then sip=$(${GP}sed -r 's/(.*)\.h$/\1.sip/' <<< ${header}) - if_cond=$(egrep -x '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \ + if_cond=$(grep -x -E '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \ ${GP}sed -r -e 's/(#define +)?SIP_IF_MODULE\((.*)\)/%If (\2)/') if [[ ! -z $if_cond ]]; then echo "$if_cond" >> $file diff --git a/tests/code_layout/test_shellcheck.sh b/tests/code_layout/test_shellcheck.sh index 66b493a47ae..29dcc135794 100755 --- a/tests/code_layout/test_shellcheck.sh +++ b/tests/code_layout/test_shellcheck.sh @@ -5,7 +5,7 @@ DIR=$(git rev-parse --show-toplevel) pushd ${DIR} > /dev/null || exit -result=$(shellcheck -e SC2016,SC2015,SC2086,SC2002,SC1117,SC2154,SC2076,SC2046,SC1090,SC2038,SC2031,SC2030,SC2162,SC2196,SC2044,SC2119,SC1001,SC2120,SC2059,SC2128,SC2005,SC2013,SC2027,SC2090,SC2089,SC2124,SC2001,SC2010,SC1072,SC1073,SC1009,SC2166,SC2045,SC2028,SC1091,SC1083 $(find . -name '*.sh')) +result=$(shellcheck -e SC2016,SC2015,SC2086,SC2002,SC1117,SC2154,SC2076,SC2046,SC1090,SC2038,SC2031,SC2030,SC2162,SC2044,SC2119,SC1001,SC2120,SC2059,SC2128,SC2005,SC2013,SC2027,SC2090,SC2089,SC2124,SC2001,SC2010,SC1072,SC1073,SC1009,SC2166,SC2045,SC2028,SC1091,SC1083 $(find . -name '*.sh')) popd > /dev/null || exit if [[ $result ]]; then