mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add a code-smell test for iterkeys (#18589)
* Add a code-smell test for iterkeys * Add a message on how to port iterkeys problems and make the grep more robust
This commit is contained in:
parent
f789a20f29
commit
dd46cb7b05
1 changed files with 18 additions and 0 deletions
18
test/sanity/code-smell/no-iterkeys.sh
Executable file
18
test/sanity/code-smell/no-iterkeys.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue