-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
41 lines (31 loc) · 1.28 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
PYTHON_VERSION ?= 3.10.4
CMD := poetry run
SRC_DIR := hooks
TESTS_DIR := tests
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: help
format: ## rewrites code with black and isort
$(CMD) black $(SRC_DIR) $(TESTS_DIR)
$(CMD) isort $(SRC_DIR) $(TESTS_DIR)
.PHONY: format
lint-black: ## checks src and tests with mypy
$(CMD) black --check --fast $(SRC_DIR) $(TESTS_DIR)
.PHONY: lint-black
lint-flake: ## checks src and tests with mypy
$(CMD) flakeheaven lint $(SRC_DIR) $(TESTS_DIR)
.PHONY: lint-flake
lint-mypy: ## checks type annotation
$(CMD) mypy $(SRC_DIR)
.PHONY: lint-mypy
lint: lint-black lint-flake lint-mypy ## runs all static analysis tools
.PHONY: lint
test: ## runs tests
$(CMD) pytest $(TESTS_DIR)
.PHONY: test
safety: ## tests third part packages against a database of known compromised ones
poetry export --with dev --format=requirements.txt --without-hashes | poetry run safety check --stdin
qa: lint test safety ## for CI/CD. Runs all code quality tools
.PHONY: qa
qa-local: format qa ## for local development (before checking in). Formats code and runs qa
.PHONY: qa-local