mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Pass code-smell paths on stdin.
This commit is contained in:
parent
87d6bdaf98
commit
60a24bbdaa
15 changed files with 18 additions and 16 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ ASSERT_RE = re.compile(r'.*(?<![-:a-zA-Z#][ -])\bassert\b(?!:).*')
|
|||
def main():
|
||||
failed = False
|
||||
|
||||
for path in sys.argv[1:]:
|
||||
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
||||
with open(path, 'r') as f:
|
||||
for i, line in enumerate(f.readlines()):
|
||||
matches = ASSERT_RE.findall(line)
|
||||
|
|
|
@ -11,7 +11,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
|
||||
|
||||
|
|
|
@ -11,7 +11,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
|
||||
|
||||
|
|
|
@ -11,7 +11,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
|
||||
|
||||
|
|
|
@ -11,7 +11,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
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ def main():
|
|||
|
||||
basic_allow_once = True
|
||||
|
||||
for path in sys.argv[1:]:
|
||||
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
||||
if path in skip:
|
||||
continue
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ FILTER_RE = re.compile(r'((.+?)\s*(?P<left>[\w \.\'"]+)(\s*)\|(\s*)(?P<filter>\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()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue