-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (57 loc) · 1.49 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
SRC_DIRS = clean_actions
TEST_DIRS = tests
flit = flit
##@ bootup
.PHONY: install setup
install: ## installs all your dependencies
install: python-install
setup: install
.PHONY: python-install
python-install: ## Installs your python dependencies
$(flit) install --pth-file
##@ Code Checks
.PHONY: test
test: ## Runs all the tests
test:
python -m pytest $(TEST_DIRS)
.PHONY: fixlint autofix
fixlint: autofix
autofix: ## Attempts to rectify any linting issues
autofix:
autoflake --in-place --remove-unused-variables --recursive $(SRC_DIRS) $(TEST_DIRS)
isort --recursive $(SRC_DIRS) $(TEST_DIRS)
black $(SRC_DIRS) $(TEST_DIRS)
.PHONY: lint
lint: ## Checks the code for any style violations
lint:
autoflake --check --remove-unused-variables --recursive $(SRC_DIRS) $(TEST_DIRS)
isort --check-only --recursive $(SRC_DIRS) $(TEST_DIRS)
black --check $(SRC_DIRS) $(TEST_DIRS)
##@ Helpers
ifndef NO_COLOUR
cyan = \033[36m
bold = \033[1m
reset = \033[0m
target_style ?= $(cyan)
header_style ?= $(bold)
endif
.DEFAULT_GOAL:=help
.PHONY: help
help: ## Display this help
@awk 'BEGIN { \
FS = ":.*##"; \
printf "\n"; \
printf "$(header_style)Usage:$(reset)"; \
printf "\n"; \
printf " make $(target_style)<target>$(reset)"; \
printf "\n"; \
}; \
/^[a-zA-Z_-]+:.*?##/ { \
printf " $(target_style)%-15s$(reset) %s", $$1, $$2; \
printf "\n" \
}; \
/^##@/ { \
printf "\n"; \
printf "$(header_style)%s$(reset)", substr($$0, 5); \
printf "\n"; \
};' $(MAKEFILE_LIST)