mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 14:38:00 +00:00
simplify dev lint command with watch flag
This commit is contained in:
parent
9708d526a9
commit
12b9ee317a
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue