Skip to content

Commit

Permalink
Add a code-smell test for iterkeys (ansible#18589)
Browse files Browse the repository at this point in the history
* Add a code-smell test for iterkeys
* Add a message on how to port iterkeys problems and make the grep more robust
  • Loading branch information
abadger authored and mattclay committed Dec 14, 2016
1 parent f789a20 commit dd46cb7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/sanity/code-smell/no-iterkeys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

ITERKEYS_USERS=$(grep -r -I iterkeys . \
--exclude-dir .git \
--exclude-dir .tox \
--exclude-dir docsite \
| grep -v \
-e lib/ansible/compat/six/_six.py \
-e lib/ansible/module_utils/six.py \
-e test/sanity/code-smell/no-iterkeys.sh \
-e '^[^:]*:#'
)

if [ "${ITERKEYS_USERS}" ]; then
echo 'iterkeys has been removed in python3. Use "for KEY in DICT:" instead'
echo "${ITERKEYS_USERS}"
exit 1
fi

0 comments on commit dd46cb7

Please sign in to comment.