-
Notifications
You must be signed in to change notification settings - Fork 368
/
code-check.sh
executable file
·58 lines (49 loc) · 1012 Bytes
/
code-check.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
#!/bin/bash
#
#
#
function usage() {
echo
echo " Seahub project code checker."
echo
echo " It runs pylint on the code and prints the result."
echo
echo " To check a file:"
echo
echo " ./code-check.sh seahub.views.file"
echo
echo " To check a module:"
echo
echo " ./code-check.sh seahub.views"
echo
}
if [[ $# == 0 ]]; then
usage;
exit 1
fi
if [[ $# == 1 ]]; then
if [[ $1 == "-h" || $1 == "--help" ]]; then
usage;
exit 1
fi
fi
SCRIPT=$(readlink -f "$0")
PROJECT_DIR=$(dirname "${SCRIPT}")
cd ${PROJECT_DIR}
if ! which pylint 2>/dev/null 1>&2; then
echo
echo "Pylint not found. Please install it first by:"
echo
echo " sudo pip install pylint"
echo
exit 1
fi
pylintrc=${PROJECT_DIR}/pylintrc
if ! [[ -f ${pylintrc} ]]; then
echo "${pylintrc} not found"
echo
echo "mv pylintrc.template pylintrc"
echo
exit 1
fi
pylint --rcfile=${pylintrc} -E $@