-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
123 lines (98 loc) · 3.03 KB
/
Makefile
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#####################
### PACKAGE STUFF ###
#####################
clean-pyc :
echo "######## CLEAN PY CACHE ########"
find . | grep -E "__pycache__" | xargs rm -rf
# dependency management
install_pip_tools :
echo "########## UPDATE PIP ##########"
pip install --upgrade pip pip-tools setuptools wheel
pip3 : install_pip_tools
echo "##### INSTALL REQUIREMENTS #####"
pip3 install -r requirements.txt
pip3-dev : install_pip_tools
echo "##### INSTALL REQUIREMENTS #####"
pip3 install -r requirements.txt -r requirements-dev.txt
update_pip3 : install_pip_tools
echo "##### UPDATE REQUIREMENTS ######"
rm requirements.txt requirements-dev.txt || true
pip-compile --resolver=backtracking --output-file requirements.txt requirements.in
pip-compile --resolver=backtracking --output-file requirements-dev.txt requirements-dev.in
pip-sync requirements.txt requirements-dev.txt
###############
### QUALITY ###
###############
pycodestyle :
echo "########## PYCODESTYLE #########"
pycodestyle --show-source --statistics --count
pylint :
echo "############ PYLINT ############"
pylint -j4 --rcfile .pylintrc service tools
bandit :
echo "############ BANDIT ############"
bandit -r service tools
mypy :
echo "############# MYPY #############"
mypy service tools
flake8 :
echo "############ FLAKE8 ############"
flake8
############################
### TESTING AND COVERAGE ###
############################
unittest :
echo "########### UNITTEST ###########"
unset WS_REAL_WIKI && \
unset WS_REAL_DATA && \
export PYWIKIBOT_NO_USER_CONFIG=1 && \
export PYTHONUNBUFFERED=1 && \
venv/bin/nose2 -v
integrationtest : clean-coverage
echo "######## INTEGRATIONTEST #######"
export WS_REAL_DATA=1 && \
unset WS_REAL_WIKI && \
export PYWIKIBOT_NO_USER_CONFIG=1 && \
export PYTHONUNBUFFERED=1 && \
venv/bin/nose2 -v --with-coverage && \
coverage xml
wikitest : clean-coverage
echo "########### WIKITEST ###########"
export WS_REAL_WIKI=1 && \
unset WS_REAL_DATA && \
export PYTHONUNBUFFERED=1 && \
venv/bin/nose2 -v --with-coverage && \
coverage xml
coverage : clean-coverage
echo "########### COVERAGE ###########"
unset WS_REAL_WIKI && \
unset WS_REAL_DATA && \
export PYWIKIBOT_NO_USER_CONFIG=1 && \
venv/bin/nose2 -v --with-coverage && \
coverage xml
coverage-html : wikitest
echo "######### COVERAGE HTML ########"
coverage html -d .coverage_html
python -c "import webbrowser, os; webbrowser.open('file://' + os.path.realpath('.coverage_html/index.html'))"
clean-coverage :
echo "######## CLEAN COVERAGE ########"
rm -rf .coverage coverage.xml .coverage_html || :
codecov :
echo "########### CODECOV ############"
codecov
#############
### STUFF ###
#############
gource :
echo "############ GOURCE ############"
gource -s 0.1 .
cloc :
echo "########## COUNT LOC ###########"
cloc --exclude-dir=venv,__pycache__ --exclude-ext=xml,json .
#############
### PHONY ###
#############
clean : clean-pyc clean-coverage
pre-commit : update_pip3 quality unittest
quality : flake8 pycodestyle pylint mypy unittest
.PHONY : clean, quality, pre-commit