-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
98 lines (69 loc) · 2.37 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
VERMIN_FILES=vermin vermin.py
TEST_FILES=tests runtests.py
OTHER_FILES=count.py
MODULES=vermin tests
TOP_LEVEL_FILES=${MODULES} vermin.py runtests.py ${OTHER_FILES}
SEMGREP_CMD=semgrep ci --metrics off --timeout 60 --verbose
test-self:
./vermin.py --violations -q -t=3 ${VERMIN_FILES}
test-tests:
./vermin.py --violations -q -t=3.2- ${TEST_FILES}
test: test-self test-tests
./runtests.py
count:
./count.py
@echo "Tests: `grep -ri 'def test_' tests | wc -l | xargs`"
@echo "Vermin SLOC: `sloccount vermin/ vermin.py 2>/dev/null | grep 'python:' | xargs`"
@echo "Tests SLOC: `sloccount tests/ runtests.py 2>/dev/null | grep 'python:' | xargs`"
setup-venv: clean-venv
virtualenv -p python3 .venv
setup-coverage: clean
pip install -r misc/.coverage-requirements.txt
setup-analysis: clean
pip install -r misc/.analysis-requirements.txt
setup: setup-venv setup-analysis
install-deps:
python -m pip install --upgrade pip virtualenv
install-deps-user:
python -m pip install --user --upgrade pip virtualenv
clean:
find . -iname __pycache__ | xargs rm -fr
find . -iname '*.pyc' | xargs rm -f
clean-venv:
rm -fr .venv
clean-pypi:
rm -fr build dist *.egg-info
dist-clean: clean clean-venv clean-pypi
pypi-dist: clean-pypi
python -m pip install --upgrade wheel twine
python setup.py sdist
python setup.py bdist_wheel --universal
update-coverage-requirements: setup-venv setup-coverage
pip freeze > misc/.coverage-requirements.txt
update-analysis-requirements: setup-venv setup-analysis
pip freeze > misc/.analysis-requirements.txt
check-style:
flake8 --count --show-source ${TOP_LEVEL_FILES}
static-analysis:
vulture --min-confidence 70 --sort-by-size ${TOP_LEVEL_FILES}
check-unused:
vulture --sort-by-size ${VERMIN_FILES}
security-check:
bandit -r -s B101 ${MODULES}
semgrep:
${SEMGREP_CMD}
semgrep-dry-run:
${SEMGREP_CMD} --dry-run
lint:
pylint -j 0 --disable=C0103,C0114,C0115,C0116,C0209,C0302,W0201,W0311,W0621,W0703,R0801,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0916,R1702,E1136\
${TOP_LEVEL_FILES}
check-pypi:
pyroma --min=10 .
check: check-style check-pypi static-analysis lint
# NOTE: `check` doesn't check all because bandit doesn't run on py37+ yet.
check-all: check security-check
test-coverage:
coverage run --source=vermin,tests runtests.py
coverage run --append --source=vermin ./vermin.py -v -t=3 vermin.py vermin
coverage-report:
coverage report -m