-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (50 loc) · 1.63 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
POETRY ?= poetry run
MIN_TEST_COVERAGE ?= 80
#####################
# Build commands #
#####################
check-prereqs:
@echo "=> Checking for pre-requisites"
@if ! poetry --version; then echo "=> Poetry isn't installed" && exit 1; fi
@echo "=> All pre-requisites satisfied"
install: check-prereqs
@echo "=> Installing python dependencies"
poetry install
setup: install lint test-audit
poetry run pre-commit install
##########################
# Formatting and linting #
##########################
format: ## runs code formatting
@echo "=> Running code formatting"
@echo "============================="
$(POETRY) black src tests
$(POETRY) ruff check --fix src tests
@echo "============================="
@echo "=> Code formatting complete"
format-check: ## runs code formatting checks
@echo "=> Running code formatting checks"
@echo "============================="
$(POETRY) black --check src tests
$(POETRY) ruff check --exit-non-zero-on-fix src tests
@echo "============================="
@echo "=> All formatting checks succeeded"
lint: format-check
@echo "============================="
@echo "=> Running linters"
@echo "============================="
$(POETRY) pylint src tests
$(POETRY) mypy src
@echo "============================="
@echo "=> All linters succeeded"
#################
# Test commands #
#################
unit-test:
@echo "=> Running unit tests"
@echo "===================================="
$(POETRY) pytest --cov=src
test-audit: unit-test
@echo "=> Running test coverage report"
@echo "===================================="
$(POETRY) coverage report --show-missing --fail-under=$(MIN_TEST_COVERAGE)