-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
default.mk
47 lines (36 loc) · 1.03 KB
/
default.mk
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
#
# default.mk
#
SRC = src test
default:
@echo 'Available commands:'
@echo
@echo ' make test Run all linting and unit tests'
@echo ' make watch Run all tests, watching for changes'
@echo
# check formatting before lint, since an autoformat might fix linting issues
test-default: check-formatting lint check-typing unittest
.venv: pyproject.toml poetry.lock poetry.toml
poetry install
touch $@
lint-default: .venv
@echo '==> Linting'
.venv/bin/flake8 $(SRC)
check-formatting-default: .venv
@echo '==> Checking formatting'
.venv/bin/black --check $(SRC)
check-typing-default: .venv
@echo '==> Checking types'
PYTHONPATH=. .venv/bin/mypy $(SRC)
unittest-default: .venv
@echo '==> Running unit tests'
@PYTHONPATH=. .venv/bin/pytest
format-default: .venv
@echo '==> Reformatting files'
.venv/bin/black $(SRC)
watch-default: .venv
.venv/bin/watchmedo shell-command -c 'clear; make test' --recursive --drop .
# allow you to override a command, e.g. "watch", but if you do not, then use
# the default
%: %-default
@true