mirror of https://github.com/ansible/ansible.git
More code-smell sanity test updates. (#36830)
* Add test for missing Azure requirements. * Improve readability. * Enhance no-unicode-literals code-smell test.pull/36833/head
parent
a031e02ab0
commit
dc71c2197f
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extensions": [
|
||||||
|
".py"
|
||||||
|
],
|
||||||
|
"output": "path-line-column-message"
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
skip = set([
|
||||||
|
'test/sanity/code-smell/%s' % os.path.basename(__file__),
|
||||||
|
])
|
||||||
|
|
||||||
|
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
||||||
|
if path in skip:
|
||||||
|
continue
|
||||||
|
|
||||||
|
with open(path, 'r') as path_fd:
|
||||||
|
for line, text in enumerate(path_fd.readlines()):
|
||||||
|
match = re.search(r'(unicode_literals)', text)
|
||||||
|
|
||||||
|
if match:
|
||||||
|
print('%s:%d:%d: do not use `unicode_literals`' % (
|
||||||
|
path, line + 1, match.start(1) + 1))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
UNICODE_LITERALS_USERS=$(grep -r unicode_literals . \
|
|
||||||
--exclude-dir .git \
|
|
||||||
--exclude-dir .tox \
|
|
||||||
--exclude no-unicode-literals.sh \
|
|
||||||
--exclude no-unicode-literals.rst |
|
|
||||||
grep -v ./test/results | \
|
|
||||||
grep -v ansible.egg-info/SOURCES.txt \
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "${UNICODE_LITERALS_USERS}" ]; then
|
|
||||||
echo "${UNICODE_LITERALS_USERS}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue