-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
79 lines (64 loc) · 1.72 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
PYTHON_FILES := pantos/client tests
.PHONY: check-version
check-version:
@if [ -z "$(VERSION)" ]; then \
echo "Error: VERSION is not set"; \
exit 1; \
fi
@VERSION_FROM_POETRY=$$(poetry version | awk '{print $$2}') ; \
if test "$$VERSION_FROM_POETRY" != "$(VERSION)"; then \
echo "Version mismatch: expected $(VERSION), got $$VERSION_FROM_POETRY" ; \
exit 1 ; \
else \
echo "Version check passed" ; \
fi
.PHONY: build
build:
poetry build
.PHONY: code
code: check format lint sort bandit test
.PHONY: check
check:
poetry run mypy ${PYTHON_FILES}
.PHONY: format
format:
poetry run yapf --in-place --recursive $(PYTHON_FILES)
.PHONY: format-check
format-check:
poetry run yapf --diff --recursive $(PYTHON_FILES)
.PHONY: lint
lint:
poetry run flake8 $(PYTHON_FILES)
.PHONY: sort
sort:
poetry run isort --force-single-line-imports $(PYTHON_FILES)
.PHONY: sort-check
sort-check:
poetry run isort --force-single-line-imports $(PYTHON_FILES) --check-only
.PHONY: bandit
bandit:
poetry run bandit -r $(PYTHON_FILES) --quiet --configfile=.bandit
.PHONY: bandit-check
bandit-check:
poetry run bandit -r $(PYTHON_FILES) --configfile=.bandit
.PHONY: test
test:
poetry run python3 -m pytest tests
.PHONY: coverage
coverage:
poetry run python3 -m pytest --cov-report term-missing --cov=pantos tests
.PHONY: local-common
local-common:
ifndef DEV_PANTOS_COMMON
$(error Please define DEV_PANTOS_COMMON variable)
endif
$(eval CURRENT_COMMON := $(shell echo .venv/lib/python3.*/site-packages/pantos/common))
@if [ -d "$(CURRENT_COMMON)" ]; then \
rm -rf "$(CURRENT_COMMON)"; \
ln -s "$(DEV_PANTOS_COMMON)" "$(CURRENT_COMMON)"; \
else \
echo "Directory $(CURRENT_COMMON) does not exist"; \
fi
.PHONY: clean
clean:
rm -r -f dist/