From 51b2fc651058946474459618a8cc741c9037cd67 Mon Sep 17 00:00:00 2001 From: "Wei-Chun, Chang" Date: Wed, 25 Sep 2024 17:45:36 +0800 Subject: [PATCH] Modified run return code based on checks source Signed-off-by: Wei-Chun, Chang --- recce/run.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recce/run.py b/recce/run.py index b78ac936..89806315 100644 --- a/recce/run.py +++ b/recce/run.py @@ -202,7 +202,7 @@ def process_failed_checks(failed_checks: List[dict], error_log=None): if error_log: with open(error_log, 'w') as f: f.write(content) - print('The failed checks are stored at [{}]'.format(error_log)) + print(f"The failed checks are stored at '{error_log}'") else: print(content, file=sys.stderr) @@ -237,6 +237,7 @@ async def cli_run(output_state_file: str, **kwargs): console.rule("Preset checks") rc, failed_checks = await execute_preset_checks(preset_checks) if rc != 0 and failed_checks: + console.print("[[yellow]Warning[/yellow]] Some preset checks failed. Please see the failed reason.") process_failed_checks(failed_checks, error_log) else: state_checks = ctx.state_loader.state.checks @@ -245,8 +246,9 @@ async def cli_run(output_state_file: str, **kwargs): pass else: console.rule("Checks") - rc, failed_checks = await execute_state_checks(state_checks) - if rc != 0 and failed_checks: + _, failed_checks = await execute_state_checks(state_checks) + if failed_checks: + console.print("[[yellow]Warning[/yellow]] Some checks failed. Please see the failed reason.") process_failed_checks(failed_checks, error_log) from recce.event import log_load_state