ansible/test/sanity/code-smell/no-dict-itervalues.sh
Toshio Kuratomi 0b440a9289 Code smell test for iteritems and itervalues ()
* Code smell test for iteritems and itervalues

* Change the keydict object in authorized_keys so it doesn't throw a false postive

keydict is a bad data structure anyway.  We don't use the iteritems and
itervalues methods so just disable them so that the code-smell tests do
not trigger on it.

* Change release templates so they work with py3
2016-12-14 12:16:16 -08:00

21 lines
696 B
Bash
Executable file

#!/bin/sh
ITERVALUES_USERS=$(grep -rI '\.itervalues' . \
--exclude-dir .git \
--exclude-dir .tox \
--exclude-dir docsite \
| grep -v \
-e 'six\.itervalues' \
-e lib/ansible/compat/six/_six.py \
-e lib/ansible/module_utils/six.py \
-e test/sanity/code-smell/no-dict-itervalues.sh \
)
if [ "${ITERVALUES_USERS}" ]; then
echo 'itervalues has been removed in python3. Alternatives:'
echo ' for VALUE in DICT.values():'
echo ' from ansible.module_utils.six import itervalues ; for VALUE in itervalues(DICT):'
echo ' from ansible.compat.six import itervalues ; for VALUE in itervalues(DICT):'
echo "${ITERVALUES_USERS}"
exit 1
fi