-
Notifications
You must be signed in to change notification settings - Fork 3
/
analyse-code.sh
executable file
·84 lines (63 loc) · 1.18 KB
/
analyse-code.sh
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
#!/usr/bin/env bash
PACKAGE="plugin"
entry-point-box() {
:<<DOC
Provides pretty-printer check box
DOC
printf "Start ${1} analysis ...\n"
}
remove-pycache() {
:<<DOC
Removes python cache directories
DOC
( find . -d -name __pycache__ | xargs rm -r )
}
check-black() {
:<<DOC
Runs "black" code analyser
DOC
entry-point-box "black" && ( black --check ${PACKAGE} )
}
check-flake() {
:<<DOC
Runs "flake8" code analyser
DOC
entry-point-box "flake" && ( flake8 ${PACKAGE} )
}
check-pylint() {
:<<DOC
Runs "pylint" code analyser
DOC
entry-point-box "pylint" && ( pylint $(find ./ -iname *.py) )
}
check-mypy() {
:<<DOC
Runs "mypy" code analyser
DOC
entry-point-box "mypy" && ( mypy --package ${PACKAGE} )
}
check-docstrings() {
:<<DOC
Runs "pydocstyle" static documentation code style formatter
DOC
entry-point-box "interrogate" && interrogate -vv ${PACKAGE}
}
check-unittests() {
:<<DOC
Runs unittests using "pytest" framework
DOC
entry-point-box "unitests" && pytest
}
main() {
:<<DOC
Runs "main" code analyser
DOC
remove-pycache
check-black && \
check-mypy && \
check-flake && \
check-pylint && \
check-docstrings && \
check-unittests
}
main