simplify dev lint command with watch flag

This commit is contained in:
Izalia Mae 2024-04-01 13:05:32 -04:00
parent 9708d526a9
commit 12b9ee317a

View file

@ -53,16 +53,17 @@ def cli_install():
help = 'Automatically, re-run the linters on source change') help = 'Automatically, re-run the linters on source change')
def cli_lint(path: Path, strict: bool, watch: bool) -> None: def cli_lint(path: Path, strict: bool, watch: bool) -> None:
path = path.expanduser().resolve() path = path.expanduser().resolve()
if watch:
handle_run_watcher([sys.executable, "-m", "relay.dev", "lint", str(path)], wait = True)
return
flake8 = [sys.executable, '-m', 'flake8', str(path)] flake8 = [sys.executable, '-m', 'flake8', str(path)]
mypy = [sys.executable, '-m', 'mypy', str(path)] mypy = [sys.executable, '-m', 'mypy', str(path)]
if strict: if strict:
mypy.append('--strict') mypy.append('--strict')
if watch:
handle_run_watcher(mypy, flake8, wait = True)
return
click.echo('----- flake8 -----') click.echo('----- flake8 -----')
subprocess.run(flake8) subprocess.run(flake8)