Cleanup and fixes for code smell scripts.

- Fix shellcheck issues.
- Add .tox exclusions.
This commit is contained in:
Matt Clay 2016-11-03 23:30:27 -07:00
parent 2d43b20eb9
commit bb3801bafd
6 changed files with 17 additions and 6 deletions

View file

@ -15,4 +15,4 @@
# that violate this.
#
# 23-10-2015: Count was 508 lines
grep -Pri '(?<!self)\._(?!_)' $1|grep -v modules
grep -Pri '(?<!self)\._(?!_)' "$1" | grep -v modules

View file

@ -2,6 +2,8 @@
grep -RIPl '\r' . 2>/dev/null \
--exclude-dir .git \
| grep -v -E \
-e '/.tox/' \
| grep -v -F \
-e './test/integration/targets/win_regmerge/templates/win_line_ending.j2'

View file

@ -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

View file

@ -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

View file

@ -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$' \

View file

@ -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