From 0ab649f8ae75d70ac9127dd2e2c79b11250929ea Mon Sep 17 00:00:00 2001 From: Martin Schmitt Date: Tue, 9 May 2023 11:40:46 +0200 Subject: [PATCH] refactor changes to linter cmd --- linting_orchestrator.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/linting_orchestrator.py b/linting_orchestrator.py index add74c4..119bd46 100644 --- a/linting_orchestrator.py +++ b/linting_orchestrator.py @@ -27,18 +27,22 @@ ] -def main(args: argparse.Namespace) -> None: +def linter_cmd_defaults(python_files: list[str]): if os.path.exists(".pylintrc"): LINTER_TO_CMD["pylint"].append("--rcfile=.pylintrc") else: path = os.path.join(os.environ["GITHUB_ACTION_PATH"], ".pylintrc") LINTER_TO_CMD["pylint"].append(f"--rcfile={path}") - if not args.python_files: + if not python_files: print("No lintable python files. Exiting.") sys.exit(0) else: - LINTER_TO_CMD[args.linter].extend(args.python_files) + LINTER_TO_CMD[args.linter].extend(python_files) + + +def main(args: argparse.Namespace) -> None: + linter_cmd_defaults(args.python_files) linting_process = subprocess.run( LINTER_TO_CMD[args.linter], capture_output=True, check=False