-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
43 lines (36 loc) · 1.18 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
SETTINGS_PATH ?= ./pyproject.toml
PORT ?= 8000
GIT_ARGS := --name-only --diff-filter=d --cached
ifneq ($(DIFF_SRC),)
GIT_ARGS := --name-only --diff-filter=d $(DIFF_SRC)...HEAD
endif
DIFF_FILES = `git diff $(GIT_ARGS)`
DIFF_PYTHONS = `git diff $(GIT_ARGS) | grep .py$$`
format:
@if [[ ! -z "${DIFF_PYTHONS}" ]]; then \
echo "> autoflake"; \
autoflake --remove-all-unused-imports --ignore-init-module-imports -r -i $(DIFF_FILES); \
echo "> isort"; \
isort -settings_path=$(SETTINGS_PATH) --quiet $(DIFF_PYTHONS); \
echo "> black"; \
black --config $(SETTINGS_PATH) -q $(DIFF_PYTHONS); \
fi
lint:
@if command -v cspell > /dev/null; then \
echo "> cspell"; cspell --gitignore --no-progress --no-summary --no-must-find-files $(DIFF_FILES); \
fi;
@if [[ ! -z "$(DIFF_PYTHONS)" ]]; then \
echo "> pylint"; pylint --rcfile=$(SETTINGS_PATH) -sn $(DIFF_PYTHONS); \
echo "> ruff"; ruff check $(DIFF_PYTHONS); \
echo "> pyright"; pyright $(DIFF_PYTHONS); \
fi
test:
bats --timing ./tests/api_db_test.bats $(filter-out $@,$(MAKECMDGOALS));
up:
uvicorn main:app \
--port $(PORT) \
--app-dir ./src \
--reload
db:
docker compose down --remove-orphans -v
docker compose up dockerize