|
|
|
@ -673,22 +673,13 @@ def collect_code_smell_tests():
|
|
|
|
|
skip_tests = skip_fd.read().splitlines()
|
|
|
|
|
|
|
|
|
|
paths = glob.glob('test/sanity/code-smell/*')
|
|
|
|
|
paths = sorted(p for p in paths
|
|
|
|
|
if os.access(p, os.X_OK)
|
|
|
|
|
and os.path.isfile(p)
|
|
|
|
|
and os.path.basename(p) not in skip_tests)
|
|
|
|
|
paths = sorted(p for p in paths if os.access(p, os.X_OK) and os.path.isfile(p) and os.path.basename(p) not in skip_tests)
|
|
|
|
|
|
|
|
|
|
tests = tuple(SanityFunc(os.path.splitext(os.path.basename(p))[0], command_sanity_code_smell, script=p, intercept=False) for p in paths)
|
|
|
|
|
|
|
|
|
|
return tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sanity_init():
|
|
|
|
|
"""Initialize full sanity test list (includes code-smell scripts determined at runtime)."""
|
|
|
|
|
global SANITY_TESTS # pylint: disable=locally-disabled, global-statement
|
|
|
|
|
SANITY_TESTS = tuple(sorted(SANITY_TESTS + collect_code_smell_tests(), key=lambda k: k.name))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sanity_get_tests():
|
|
|
|
|
"""
|
|
|
|
|
:rtype: tuple(SanityFunc)
|
|
|
|
@ -730,17 +721,7 @@ class SanityFailure(TestFailure):
|
|
|
|
|
|
|
|
|
|
class SanityMessage(TestMessage):
|
|
|
|
|
"""Single sanity test message for one file."""
|
|
|
|
|
def __init__(self, message, path, line=0, column=0, level='error', code=None, confidence=None):
|
|
|
|
|
"""
|
|
|
|
|
:type message: str
|
|
|
|
|
:type path: str
|
|
|
|
|
:type line: int
|
|
|
|
|
:type column: int
|
|
|
|
|
:type level: str
|
|
|
|
|
:type code: str | None
|
|
|
|
|
:type confidence: int | None
|
|
|
|
|
"""
|
|
|
|
|
super(SanityMessage, self).__init__(message, path, line, column, level, code, confidence)
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SanityTargets(object):
|
|
|
|
@ -788,3 +769,9 @@ SANITY_TESTS = (
|
|
|
|
|
SanityFunc('validate-modules', command_sanity_validate_modules, intercept=False),
|
|
|
|
|
SanityFunc('ansible-doc', command_sanity_ansible_doc),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sanity_init():
|
|
|
|
|
"""Initialize full sanity test list (includes code-smell scripts determined at runtime)."""
|
|
|
|
|
global SANITY_TESTS # pylint: disable=locally-disabled, global-statement
|
|
|
|
|
SANITY_TESTS = tuple(sorted(SANITY_TESTS + collect_code_smell_tests(), key=lambda k: k.name))
|
|
|
|
|