mirror of https://github.com/ansible/ansible.git
ansible-test - Removed no-basestring sanity test
parent
c349b91af3
commit
6e15fb0ebf
@ -0,0 +1,3 @@
|
|||||||
|
minor_changes:
|
||||||
|
- ansible-test - Removed the ``no-basestring`` sanity test.
|
||||||
|
The test is no longer necessary now that Python 3 is required.
|
||||||
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extensions": [
|
|
||||||
".py"
|
|
||||||
],
|
|
||||||
"ignore_self": true,
|
|
||||||
"output": "path-line-column-message"
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
"""Disallow use of basestring isinstance checks."""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main entry point."""
|
|
||||||
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
|
||||||
with open(path, 'r', encoding='utf-8') as path_fd:
|
|
||||||
for line, text in enumerate(path_fd.readlines()):
|
|
||||||
match = re.search(r'(isinstance.*basestring)', text)
|
|
||||||
|
|
||||||
if match:
|
|
||||||
print('%s:%d:%d: do not use `isinstance(s, basestring)`' % (
|
|
||||||
path, line + 1, match.start(1) + 1))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
Loading…
Reference in New Issue