-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
86 lines (64 loc) · 1.87 KB
/
tasks.py
File metadata and controls
86 lines (64 loc) · 1.87 KB
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
# Copyright 2023 Seamus Brady
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from invoke import task
SRC_ROOT = "./src/"
@task
def test(c):
print("Running unit tests...")
c.run("python -m unittest discover -v")
@task
def mypy(c):
print("Running mypy...")
c.run(f"mypy {SRC_ROOT}")
@task
def formatter(c):
print("Running black formatter...")
c.run(f"python -m black --line-length=100 {SRC_ROOT}")
@task
def linter(c):
print("Running flake8...")
# E501 is turned off - ignore long lines and whitespaces
c.run(f"flake8 --extend-ignore=E501,W291,W293,E402 {SRC_ROOT}")
@task
def bandit(c):
print("Running bandit security checks...")
c.run(f"bandit -r {SRC_ROOT}")
@task
def isort(c):
print("Running isort...")
c.run(f"isort --atomic .")
@task
def checks(c):
print("Running all checks...")
isort(c)
mypy(c)
formatter(c)
linter(c)
bandit(c)
test(c)
@task
def types(c):
print("Installing mypy types...")
c.run("mypy --install-types")
@task
def chat_ui(c):
print("Running chat ui...")
c.run("python src/chat_ui/chat_ui.py")
@task
def appserver(c):
print("Running chat server...")
c.run("python src/tallmountain/app_server.py")
@task
def repl(c):
print("Running repl...")
c.run("rlwrap python src/tallmountain/app_repl.py")