diff --git a/test/runner/lib/sanity/__init__.py b/test/runner/lib/sanity/__init__.py index b2f5f813b7..052ff900e6 100644 --- a/test/runner/lib/sanity/__init__.py +++ b/test/runner/lib/sanity/__init__.py @@ -224,6 +224,7 @@ class SanityCodeSmellTest(SanityTest): env = ansible_environment(args, color=False) pattern = None + data = None if self.config: with open(self.config, 'r') as config_fd: @@ -251,10 +252,11 @@ class SanityCodeSmellTest(SanityTest): if not paths: return SanitySkipped(self.name) - cmd += paths + data = '\n'.join(paths) + display.info(data, verbosity=4) try: - stdout, stderr = run_command(args, cmd, env=env, capture=True) + stdout, stderr = run_command(args, cmd, data=data, env=env, capture=True) status = 0 except SubprocessError as ex: stdout = ex.stdout diff --git a/test/sanity/code-smell/boilerplate.py b/test/sanity/code-smell/boilerplate.py index b0e2e430d9..6cd9665b11 100755 --- a/test/sanity/code-smell/boilerplate.py +++ b/test/sanity/code-smell/boilerplate.py @@ -34,7 +34,7 @@ def main(): 'test/' ] - for path in sys.argv[1:]: + for path in sys.argv[1:] or sys.stdin.read().splitlines(): if path in skip: continue diff --git a/test/sanity/code-smell/empty-init.py b/test/sanity/code-smell/empty-init.py index f55817dc67..b0f5c320c3 100755 --- a/test/sanity/code-smell/empty-init.py +++ b/test/sanity/code-smell/empty-init.py @@ -15,7 +15,7 @@ def main(): 'lib/ansible/module_utils/six/__init__.py', ]) - for path in sys.argv[1:]: + for path in sys.argv[1:] or sys.stdin.read().splitlines(): if path in skip: continue diff --git a/test/sanity/code-smell/no-assert.py b/test/sanity/code-smell/no-assert.py index 06c54e14a7..abb663d577 100755 --- a/test/sanity/code-smell/no-assert.py +++ b/test/sanity/code-smell/no-assert.py @@ -10,7 +10,7 @@ ASSERT_RE = re.compile(r'.*(?[\w \.\'"]+)(\s*)\|(\s*)(?P\w def main(): failed = False - for path in sys.argv[1:]: + for path in sys.argv[1:] or sys.stdin.read().splitlines(): with open(path) as f: text = f.read() diff --git a/test/sanity/code-smell/no-underscore-variable.py b/test/sanity/code-smell/no-underscore-variable.py index 5ac713098e..3ec540fe63 100755 --- a/test/sanity/code-smell/no-underscore-variable.py +++ b/test/sanity/code-smell/no-underscore-variable.py @@ -123,7 +123,7 @@ def main(): 'test/units/modules/system/interfaces_file/test_interfaces_file.py', ]) - for path in sys.argv[1:]: + for path in sys.argv[1:] or sys.stdin.read().splitlines(): if path in skip: continue diff --git a/test/sanity/code-smell/replace-urlopen.py b/test/sanity/code-smell/replace-urlopen.py index 91d9175f6b..1e0ba862ba 100755 --- a/test/sanity/code-smell/replace-urlopen.py +++ b/test/sanity/code-smell/replace-urlopen.py @@ -12,7 +12,7 @@ def main(): 'lib/ansible/module_utils/urls.py', ]) - for path in sys.argv[1:]: + for path in sys.argv[1:] or sys.stdin.read().splitlines(): if path in skip: continue diff --git a/test/sanity/code-smell/required-and-default-attributes.py b/test/sanity/code-smell/required-and-default-attributes.py index 5c6f86c5b9..6fa7944da9 100755 --- a/test/sanity/code-smell/required-and-default-attributes.py +++ b/test/sanity/code-smell/required-and-default-attributes.py @@ -10,7 +10,7 @@ def main(): 'test/sanity/code-smell/%s' % os.path.basename(__file__), ]) - for path in sys.argv[1:]: + for path in sys.argv[1:] or sys.stdin.read().splitlines(): if path in skip: continue diff --git a/test/sanity/code-smell/use-argspec-type-path.py b/test/sanity/code-smell/use-argspec-type-path.py index 36871d3f4e..856f168899 100755 --- a/test/sanity/code-smell/use-argspec-type-path.py +++ b/test/sanity/code-smell/use-argspec-type-path.py @@ -27,7 +27,7 @@ def main(): 'lib/ansible/modules/files/find.py', ]) - for path in sys.argv[1:]: + for path in sys.argv[1:] or sys.stdin.read().splitlines(): if path in skip: continue diff --git a/test/sanity/code-smell/use-compat-six.py b/test/sanity/code-smell/use-compat-six.py index a7fe13fb0a..c3da78e849 100755 --- a/test/sanity/code-smell/use-compat-six.py +++ b/test/sanity/code-smell/use-compat-six.py @@ -32,7 +32,7 @@ def main(): 'docs/bin/plugin_formatter.py', ]) - for path in sys.argv[1:]: + for path in sys.argv[1:] or sys.stdin.read().splitlines(): if path in skip: continue