generated from softwaredevelop/codespace-default
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
88 lines (71 loc) · 1.35 KB
/
noxfile.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Nox configuration file.
"""
import os
import nox
def get_path(*path):
"""
Return the absolute path of the given path.
"""
return os.path.join(NOX_DIR, *path)
NOX_DIR = os.path.abspath(os.path.dirname(__file__))
LINT_DEPENDENCIES = [
"isort",
"black",
"flake8",
]
LINT_PATH = [
get_path("noxfile.py"),
get_path("test"),
]
@nox.session(name="isort")
def isort(session):
"""Run isort code formatter."""
session.install("isort")
session.run(
"isort",
"--profile",
"black",
*LINT_PATH,
)
@nox.session(name="black")
def blacken(session):
"""Run black code formatter."""
session.install(
"black",
)
session.run(
"black",
"--check",
*LINT_PATH,
)
@nox.session(name="flake8")
def flake(session):
"""Run black code formatter."""
session.install("flake8")
session.run(
"flake8",
*LINT_PATH,
)
@nox.session(name="lint")
def lint(session):
"""Run linters."""
session.install(*LINT_DEPENDENCIES)
session.run(
"isort",
"--profile",
"black",
*LINT_PATH,
)
session.run(
"black",
"--check",
"--verbose",
*LINT_PATH,
)
session.run(
"flake8",
*LINT_PATH,
)