mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -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
|
@ -1,4 +1,11 @@
|
|||
Sanity Tests » no-basestring
|
||||
============================
|
||||
|
||||
Do not use ``isinstance(s, basestring)``.
|
||||
Do not use ``isinstance(s, basestring)`` as basestring has been removed in
|
||||
Python3. You can import ``string_types``, ``binary_type``, or ``text_type``
|
||||
from ``ansible.module_utils.six`` and then use ``isinstance(s, string_types)``
|
||||
or ``isinstance(s, (binary_type, text_type))`` instead.
|
||||
|
||||
If this is part of code to convert a string to a particular type,
|
||||
``ansible.module_utils._text`` contains several functions that may be even
|
||||
better for you: ``to_text``, ``to_bytes``, and ``to_native``.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue