-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
142 lines (103 loc) · 3.12 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
PROJECT_NAME = webtraversallibrary
PROJECT_READABLE_NAME = "Web Traversal Library"
PYTHON ?= python3
SOURCE_FOLDER = webtraversallibrary
ENV_NAME = .env-$(PROJECT_NAME)
.PHONY: env-create
env-create:
$(PYTHON) -m venv $(ENV_NAME)
make env-update
#
# Don't forget to activate the environment before proceeding! You can run:
# source $(ENV_NAME)/bin/activate
.PHONY: env-update
env-update:
bash -c "\
. $(ENV_NAME)/bin/activate; \
which python; \
which pip; \
pip install --upgrade -r requirements.txt; \
pip freeze; \
"
.PHONY: env-delete
env-delete:
rm -rf $(ENV_NAME)
.PHONY: update
update:
pip3 install --upgrade -r requirements.txt $(CFLAGS)
.PHONY: build-all
build-all: clean gitinfo radon lint coverage docs build
.PHONY: clean
clean:
rm -rf build dist *.egg-info
find $(SOURCE_FOLDER) -name __pycache__ | xargs rm -rf
find $(SOURCE_FOLDER) -name '*.pyc' -delete
rm -rf reports .coverage
rm -rf docs/_*
rm -rf .*cache
.PHONY: reformat
reformat:
$(PYTHON) -m isort webtraversallibrary examples tests
$(PYTHON) -m black webtraversallibrary examples tests
.PHONY: lint
lint:
$(PYTHON) -m isort --check-only webtraversallibrary examples tests
$(PYTHON) -m black --check webtraversallibrary examples tests
$(PYTHON) -m pylint $(SOURCE_FOLDER)
$(PYTHON) -m pylint --disable=missing-docstring,no-self-use examples/*.py tests/*
./node_modules/jshint/bin/jshint $(SOURCE_FOLDER)
$(PYTHON) -m mypy $(SOURCE_FOLDER)
.PHONY: test tests
test tests:
$(PYTHON) -m pytest tests/ -m 'not system'
.PHONY: test_system
test_system:
$(PYTHON) -m pytest tests/ -m 'system'
.PHONY: coverage
coverage:
$(PYTHON) -m pytest tests/ -m 'not system' \
--junitxml=reports/test-result-all.xml \
--cov=$(SOURCE_FOLDER) \
--cov-report term-missing \
--cov-report html:reports/coverage-all.html \
--cov-report xml:reports/coverage-all.xml
.PHONY: build
build:
python setup.py --quiet sdist bdist_wheel
.PHONY: radon
radon:
radon cc $(SOURCE_FOLDER) --min c
xenon --max-absolute C --max-modules C --max-average A $(SOURCE_FOLDER)/
.PHONY: docs
docs:
$(MAKE) -C docs html
.PHONY: version
version:
@python -c "import $(SOURCE_FOLDER); print($(SOURCE_FOLDER).__version__)"
.PHONY: bump-version-patch
bump-version-patch:
# Note: You should only run this on a clean working copy
# If this operation succeeds, it will create a version-bumping commit
bump2version patch --list
git log --oneline -1
.PHONY: bump-version-minor
bump-version-minor:
# Note: You should only run this on a clean working copy
# If this operation succeeds, it will create a version-bumping commit
bump2version minor --list
git log --oneline -1
.PHONY: bump-version-major
bump-version-major:
# Note: You should only run this on a clean working copy
# If this operation succeeds, it will create a version-bumping commit
bump2version major --list
git log --oneline -1
.PHONY: snyk-auth
snyk-auth:
snyk auth $(SNYK_API_SECRET_KEY)
.PHONY: snyk-test
snyk-test:
snyk test --file=requirements.txt --severity-threshold=high
.PHONY: snyk-monitor
snyk-monitor:
snyk monitor --file=requirements.txt --project-name=$(PROJECT_READABLE_NAME)