-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtasks.py
More file actions
34 lines (25 loc) · 681 Bytes
/
tasks.py
File metadata and controls
34 lines (25 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import invoke
@invoke.task
def sort(ctx, path=".", check=False):
"""Sort module imports."""
print(" sorting imports ...")
args = ["isort", path, "--profile", "black"]
if check:
args.append("--check-only")
ctx.run(" ".join(args))
@invoke.task
def fmt(ctx, path=".", sort_=True, check=False):
"""Run code formatter."""
print(" formatting ...")
args = ["black", path]
if check:
args.append("--check")
ctx.run(" ".join(args))
if sort_:
sort(ctx, path, check)
@invoke.task
def lint(ctx, path="csv2http"):
ctx.run(f"pylint {path}")
@invoke.task
def type_check(ctx, path="."):
ctx.run(f"mypy {path}")