-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyse-source-code.sh
executable file
·101 lines (77 loc) · 1.49 KB
/
analyse-source-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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
PACKAGE="uyaml"
entry-point-box() {
:<<DOC
Provides pretty-printer check box
DOC
echo "Start ${1} analysis ..."
}
remove-pycache() {
:<<DOC
Removes python cache directories
DOC
( find . -depth -name __pycache__ | xargs rm -r )
}
check-black() {
:<<DOC
Runs "black" code analyser
DOC
entry-point-box "black" && ( black --check ${PACKAGE} )
}
check-flake8() {
:<<DOC
Runs "flake8" code analysers
DOC
entry-point-box "flake" && ( flake8 ${PACKAGE} )
}
check-flakehell() {
:<<DOC
Runs "flakehell" code analysers
DOC
entry-point-box "flakehell" && ( flakehell lint )
}
check-flake() {
:<<DOC
Runs "flake8" code analysers
DOC
check-flake8 && check-flakehell
}
check-pylint() {
:<<DOC
Runs "pylint" code analyser
DOC
entry-point-box "pylint" && ( pylint $(find "${PACKAGE}/") )
}
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 "pydocstyle" && ( pydocstyle --explain --count ${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-pylint && \
check-docstrings && \
check-flake8 && \
check-unittests
)
}
main