forked from pantos-io/common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (54 loc) · 1.43 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
PYTHON_FILES := pantos/common scripts 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 --namespace-packages --explicit-package-bases ${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: clean
clean:
rm -r -f build/
rm -r -f dist/
rm -r -f pantos_common.egg-info/