-
Notifications
You must be signed in to change notification settings - Fork 22
/
tasks.py
57 lines (44 loc) · 884 Bytes
/
tasks.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# type: ignore
from invoke import call, task
SOURCES = "tbump"
@task
def black(c, check=False):
print("Running black")
cmd = f"black {SOURCES}"
if check:
cmd += " --check"
c.run(cmd)
@task
def isort(c, check=False):
print("Running isort")
cmd = f"isort {SOURCES}"
if check:
cmd += " --check"
c.run(cmd)
@task
def flake8(c):
print("Running flake8")
c.run(f"flake8 {SOURCES}")
@task
def mypy(c, machine_readable=False):
print("Running mypy")
cmd = "mypy"
if machine_readable:
cmd += " --no-pretty"
else:
cmd += " --color-output --pretty"
c.run(cmd)
@task
def test(c):
print("Running pytest")
c.run("pytest", pty=True)
@task(
pre=[
call(black, check=True),
call(isort, check=True),
call(flake8),
call(mypy),
]
)
def lint(c):
pass