diff --git a/test/sanity/code-smell/inappropriately-private.sh b/test/sanity/code-smell/inappropriately-private.sh index a50949632f..9ee3342179 100755 --- a/test/sanity/code-smell/inappropriately-private.sh +++ b/test/sanity/code-smell/inappropriately-private.sh @@ -15,4 +15,4 @@ # that violate this. # # 23-10-2015: Count was 508 lines -grep -Pri '(?/dev/null \ --exclude-dir .git \ + | grep -v -E \ + -e '/.tox/' \ | grep -v -F \ -e './test/integration/targets/win_regmerge/templates/win_line_ending.j2' diff --git a/test/sanity/code-smell/no-basestring.sh b/test/sanity/code-smell/no-basestring.sh index ee5a58343e..59a6c9bf55 100755 --- a/test/sanity/code-smell/no-basestring.sh +++ b/test/sanity/code-smell/no-basestring.sh @@ -6,10 +6,18 @@ BASEDIR=${1-"."} # * basestring is still present and harmless in comments # * basestring is also currently present in modules. Porting of modules is more # of an Ansible 2.3 or greater goal. -BASESTRING_USERS=$(grep -r basestring $BASEDIR |grep isinstance| grep -v lib/ansible/compat/six/_six.py|grep -v lib/ansible/module_utils/six.py|grep -v lib/ansible/modules/core|grep -v lib/ansible/modules/extras) +BASESTRING_USERS=$(grep -r basestring "${BASEDIR}" \ + | grep isinstance \ + | grep -v \ + -e lib/ansible/compat/six/_six.py \ + -e lib/ansible/module_utils/six.py \ + -e lib/ansible/modules/core \ + -e lib/ansible/modules/extras \ + -e '/.tox/' \ + ) -if test -n "$BASESTRING_USERS" ; then - printf "$BASESTRING_USERS" +if test -n "${BASESTRING_USERS}"; then + printf "%s" "${BASESTRING_USERS}" exit 1 else exit 0 diff --git a/test/sanity/code-smell/replace-urlopen.sh b/test/sanity/code-smell/replace-urlopen.sh index 3973ca64b1..5bef3bc21e 100755 --- a/test/sanity/code-smell/replace-urlopen.sh +++ b/test/sanity/code-smell/replace-urlopen.sh @@ -6,7 +6,7 @@ URLLIB_USERS=$(find "$BASEDIR" -name '*.py' -exec grep -H urlopen \{\} \;) URLLIB_USERS=$(echo "$URLLIB_USERS" | sed '/\(\n\|lib\/ansible\/module_utils\/urls.py\|lib\/ansible\/module_utils\/six.py\|lib\/ansible\/compat\/six\/_six.py\|.tox\)/d') URLLIB_USERS=$(echo "$URLLIB_USERS" | sed '/^[^:]\+:#/d') if test -n "$URLLIB_USERS" ; then - printf "$URLLIB_USERS" + printf "%s" "$URLLIB_USERS" exit 1 else exit 0 diff --git a/test/sanity/code-smell/shebang.sh b/test/sanity/code-smell/shebang.sh index 15c0c31781..9e9943db6b 100755 --- a/test/sanity/code-smell/shebang.sh +++ b/test/sanity/code-smell/shebang.sh @@ -1,6 +1,7 @@ #!/bin/sh grep '^#!' -RIn . 2>/dev/null | grep ':1:' | sed 's/:1:/:/' | grep -v -E \ + -e '/.tox/' \ -e '^\./lib/ansible/modules/' \ -e '^\./test/integration/targets/[^/]*/library/[^/]*:#!powershell$' \ -e ':#!/bin/sh$' \ diff --git a/test/sanity/code-smell/use-compat-six.sh b/test/sanity/code-smell/use-compat-six.sh index d1d9961eef..cdce0ec0e3 100755 --- a/test/sanity/code-smell/use-compat-six.sh +++ b/test/sanity/code-smell/use-compat-six.sh @@ -10,7 +10,7 @@ WHITELIST='(lib/ansible/modules/core/cloud/digital_ocean/digital_ocean.py)' SIX_USERS=$(find "$BASEDIR" -name '*.py' -exec grep -wH six \{\} \;|grep import |grep -v ansible.compat| grep -v ansible.module_utils.six| egrep -v "^$WHITELIST:") if test -n "$SIX_USERS" ; then - printf "$SIX_USERS" + printf "%s" "$SIX_USERS" exit 1 else exit 0