This repository has been archived by the owner on Aug 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
check_all.py
60 lines (51 loc) · 1.59 KB
/
check_all.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
"""Run all checks."""
import subprocess
import black
from mypy import api as mypy
from pylint import lint as pylint
import pytest
# pytest
print("############### pytest #################")
pytest.main(["-vv", "--cov=ethicml", "--cov-fail-under=80", "tests/"])
print("")
# pydocstyle
print("############### pydocstyle #################")
subprocess.call(
[
"pydocstyle",
"--convention=google",
"--add-ignore=D105,D107",
"--ignore-decorators=override|overload",
"--count",
"-e",
"ethicml",
]
)
print("")
# pylint
print("############### pylint #################")
PYLINT_RESULTS = pylint.Run(["./ethicml/"], exit=False)
print("")
# pylint
print("############### pylint tests #################")
PYLINT_RESULTS = pylint.Run(["./tests/"], exit=False)
print("")
# mypy
print("############### mypy #################")
MYPY_RESULTS = mypy.run(["./ethicml/", "--warn-redundant-casts", "--show-error-context"])
print(MYPY_RESULTS[0], end="")
print(MYPY_RESULTS[1], end="")
print(f"Exit code of mypy: {MYPY_RESULTS[2]}")
# mypy
print("############ mypy tests ##############")
MYPY_RESULTS = mypy.run(
["./tests/", "--warn-redundant-casts", "--show-error-context", "--show-error-codes", "--pretty"]
)
print(MYPY_RESULTS[0], end="")
print(MYPY_RESULTS[1], end="")
print(f"Exit code of mypy: {MYPY_RESULTS[2]}")
# black
print("############ black ##############")
black.main(["-l", "100", "-t", "py36", "-S", "./ethicml", "--config", ".black-config.toml"])
black.main(["-l", "100", "-t", "py36", "-S", "./tests", "--config", ".black-config.toml"])
print("")