mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 12:33:59 -07:00
code-smell test changes
* Create get_exception and wildcard import code-smell tests * Add more detail to boilerplate and no-basestring descriptions * Remove the no-list-cmp test as the pylint undefined-variable test covers it
This commit is contained in:
parent
33e8c83fde
commit
f4d7b9a596
9 changed files with 149 additions and 56 deletions
36
test/sanity/code-smell/no-get-exception.sh
Executable file
36
test/sanity/code-smell/no-get-exception.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
# We're getting rid of get_exception in our code so that we can deprecate it.
|
||||
# get_exception is no longer needed as we no longer support python-2.4 on the controller.
|
||||
|
||||
# We eventually want this list to be empty
|
||||
get_exception=$(find . -path ./test/runner/.tox -prune \
|
||||
-o -path ./lib/ansible/module_utils -prune \
|
||||
-o -path ./lib/ansible/modules/storage/netapp -prune \
|
||||
-o -path ./lib/ansible/modules/packaging/os -prune \
|
||||
-o -path ./lib/ansible/modules/monitoring -prune \
|
||||
-o -path ./lib/ansible/modules/network/panos -prune \
|
||||
-o -path ./lib/ansible/modules/network/nxos -prune \
|
||||
-o -path ./lib/ansible/modules/network/junos -prune \
|
||||
-o -path ./lib/ansible/modules/network/vyos -prune \
|
||||
-o -path ./lib/ansible/modules/network/fortios -prune \
|
||||
-o -path ./lib/ansible/modules/network/f5 -prune \
|
||||
-o -path ./lib/ansible/modules/network/cloudengine -prune \
|
||||
-o -path ./lib/ansible/modules/network/aos -prune \
|
||||
-o -path ./lib/ansible/modules/network/eos -prune \
|
||||
-o -path ./lib/ansible/modules/files -prune \
|
||||
-o -path ./lib/ansible/modules/system -prune \
|
||||
-o -path ./lib/ansible/modules/web_infrastructure -prune \
|
||||
-o -path ./lib/ansible/plugins/action/wait_for_connection.py -prune \
|
||||
-o -name '*.py' -type f -exec grep -H 'get_exception' '{}' '+')
|
||||
|
||||
|
||||
if test -n "$get_exception" ; then
|
||||
printf "\n== Contains get_exception() calls ==\n"
|
||||
printf "%s" "$get_exception"
|
||||
failures=$(printf "%s" "$get_exception"| wc -l)
|
||||
failures=$((failures + 2))
|
||||
exit "$failures"
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue