mirror of https://github.com/ansible/ansible.git
Code smell test for iteritems and itervalues (#19292)
* 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 py3pull/19358/head
parent
f550b4541f
commit
0b440a9289
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
ITERITEMS_USERS=$(grep -rI '\.iteritems' . \
|
||||
--exclude-dir .git \
|
||||
--exclude-dir .tox \
|
||||
--exclude-dir docsite \
|
||||
| grep -v \
|
||||
-e 'six\.iteritems' \
|
||||
-e lib/ansible/compat/six/_six.py \
|
||||
-e lib/ansible/module_utils/six.py \
|
||||
-e test/sanity/code-smell/no-dict-iteritems.sh \
|
||||
)
|
||||
|
||||
if [ "${ITERITEMS_USERS}" ]; then
|
||||
echo 'iteritems has been removed in python3. Alternatives:'
|
||||
echo ' for KEY, VALUE in DICT.items():'
|
||||
echo ' from ansible.module_utils.six import iteritems ; for KEY, VALUE in iteritems(DICT):'
|
||||
echo ' from ansible.compat.six import iteritems ; for KEY, VALUE in iteritems(DICT):'
|
||||
echo "${ITERITEMS_USERS}"
|
||||
exit 1
|
||||
fi
|
@ -0,0 +1,21 @@
|
||||
#!/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
|
Loading…
Reference in New Issue