1
0
Fork 0

Fix recursive check in cli tool

This commit is contained in:
Maurizio Porrato 2023-08-12 17:56:18 +01:00
parent 71d2129cfb
commit da06509790
2 changed files with 10 additions and 8 deletions

View File

@ -60,7 +60,8 @@ def get_checks(
def run_suite(
targets: Iterable[Operator | Bundle], suite_name: str = "operator_repo.checks"
targets: Iterable[Repo | Operator | Bundle],
suite_name: str = "operator_repo.checks",
) -> Iterable[CheckResult]:
checks = get_checks(suite_name)
for target in targets:

View File

@ -95,14 +95,15 @@ def action_check(
repo_path: Path, suite: str, *what: str, recursive: bool = False
) -> None:
repo = Repo(repo_path)
if recursive:
if what:
targets = chain(_walk(parse_target(repo, x)) for x in what)
else:
targets = chain(_walk(x) for x in repo)
if what:
targets = [parse_target(repo, x) for x in what]
else:
targets = [parse_target(repo, x) for x in what] or repo.all_operators()
for result in run_suite(targets, suite_name=suite):
targets = repo.all_operators()
if recursive:
all_targets = chain.from_iterable(_walk(x) for x in targets)
else:
all_targets = targets
for result in run_suite(all_targets, suite_name=suite):
print(result)