-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
40 lines (31 loc) · 1.16 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
SHELL = /bin/bash
PACKAGE_FOLDER = pytest_anki
TESTS_FOLDER = tests
MONITORED_FOLDERS = $(PACKAGE_FOLDER) $(TESTS_FOLDER)
TEST_FLAGS ?= -n4
# Set up project
install:
poetry install
# Run tests
test:
python -m pytest $(TEST_FLAGS) tests/
# Run type checkers
check:
python -m mypy $(MONITORED_FOLDERS)
# Run code linters
lint:
python -m flake8 $(MONITORED_FOLDERS)
python -m black --check $(MONITORED_FOLDERS)
# Run code formatters
format:
python -m isort $(MONITORED_FOLDERS)
python -m autoflake --recursive --in-place --remove-all-unused-imports $(MONITORED_FOLDERS)
python -m black $(MONITORED_FOLDERS)
# Build project
build:
poetry build
# Show help message
help:
@echo "$$(tput bold)Available targets:$$(tput sgr0)";echo;sed -ne"/^# /{h;s/.*//;:d" -e"H;n;s/^# //;td" -e"s/:.*//;G;s/\\n# /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|LC_ALL='C' sort -f|awk -F --- -v n=$$(tput cols) -v i=19 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'
.DEFAULT_GOAL: help
.PHONY: install test build check lint format