Skip to content

Commit

Permalink
refactor changes to linter cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
mnschmit committed May 9, 2023
1 parent 323661d commit 0ab649f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions linting_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0ab649f

Please sign in to comment.