/
lint.nox.py
68 lines (53 loc) · 1.56 KB
/
lint.nox.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
58
59
60
61
62
63
64
65
66
67
68
from pathlib import Path
import nox
from pipelines.utils import setup_env
from pipelines.utils.prisma import generate
@nox.session
def lint(session: nox.Session) -> None:
setup_env(session)
session.install('-r', 'pipelines/requirements/lint.txt')
# TODO: pyright doesn't resolve types correctly if we don't install inplace
session.install('-e', '.')
generate(session)
session.run('blue', '--check', '.')
session.run('pyright')
session.run('pyright', '--ignoreexternal', '--verifytypes', 'prisma')
session.run(
'interrogate',
'-v',
'--omit-covered-files',
'--fail-under',
'100',
'--whitelist-regex',
'test_.*',
'--exclude',
'*/.venv/*',
'tests',
)
session.run('slotscheck', '-m', 'prisma')
@nox.session
def mypy(session: nox.Session) -> None:
setup_env(session)
session.install('-r', 'pipelines/requirements/mypy.txt')
session.install('.')
generate(session)
session.run(
'coverage',
'run',
'-m',
'mypy',
'--show-traceback',
'--namespace-packages',
'--package',
'prisma',
'--package',
'tests',
)
@nox.session
def format(session: nox.Session) -> None:
"""Format Python source code and all Prisma Schema files"""
session.install('-r', 'pipelines/requirements/deps/blue.txt')
session.install('-e', '.')
session.run('blue', '.')
for entry in Path.cwd().glob('**/*.schema.prisma'):
session.run('prisma', 'format', f'--schema={entry}')