-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
44 lines (32 loc) · 927 Bytes
/
tasks.py
File metadata and controls
44 lines (32 loc) · 927 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
35
36
37
38
39
40
41
42
43
44
from typing import List
from invoke import Result, UnexpectedExit, task
PACKAGE = 'temapi'
def check_all(results: List[Result]):
try:
result = next(result for result in results if result.exited != 0)
except StopIteration:
pass
else:
raise UnexpectedExit(result)
@task
def format(c):
c.run(f'black -q {PACKAGE}')
c.run(f'black -q tasks.py')
c.run(f'isort -rc -y -q {PACKAGE}')
c.run(f'isort -rc -y -q tasks.py')
@task
def flake8(c):
c.run(f'flake8 {PACKAGE}', warn=True),
@task
def lint(c):
c.run(f'pylint --rcfile=pylintrc {PACKAGE}', warn=True),
@task
def format_check(c):
check_all(
[
c.run(f'black --check -q {PACKAGE}', warn=True),
c.run(f'black --check -q tasks.py', warn=True),
c.run(f'isort -rc -c -q {PACKAGE}', warn=True),
c.run(f'isort -rc -c -q tasks.py', warn=True),
]
)