-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (52 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Makefile for linting and formatting
# Variables
PYTHON := poetry run python
FLAKE8 := poetry run flake8
BLACK := poetry run black
ISORT := poetry run isort
PYLINT := poetry run pylint
MYPY := poetry run mypy
BANDIT := poetry run bandit
COVERAGE := poetry run coverage
# Default target
.PHONY: all
all: tree lint fmt check-fmt test coverage
# Linting target
.PHONY: lint
lint:
$(FLAKE8) --verbose .
$(PYLINT) src
# Formatting target
.PHONY: fmt
fmt:
$(BLACK) .
$(ISORT) .
# Type checking target
.PHONY: type-check
type-check:
MYPYPATH=$(pwd)/lib $(MYPY) --explicit-package-bases src
# Check formatting target (for CI)
.PHONY: check-fmt
check-fmt:
$(BLACK) --check .
$(ISORT) --check-only .
# Security linting target
.PHONY: security
security:
$(BANDIT) -r .
# Test target
.PHONY: test
test:
$(PYTHON) -m pytest --maxfail=1 --disable-warnings -q
# Coverage target
.PHONY: coverage
coverage:
$(PYTHON) -m pytest --cov=. --cov-report=term-missing --cov-report=html
# Clean target
.PHONY: clean
clean:
rm -rf *.pyc __pycache__ .pytest_cache .mypy_cache
# Generate project structure in plain text format
.PHONY: tree
tree:
@tree --prune -I "__pycache__|venv|env|.git|dist|build|.mypy_cache|.pytest_cache|*.egg-info|.tox|.vscode|.idea|node_modules|docs/_build" > project_structure.txt