-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (52 loc) · 1.47 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
.PHONY: style types test quality init check
PY_VER=python3.8
PY_VER_SHORT=py$(shell echo $(PY_VER) | sed 's/[^0-9]*//g')
VENV=env
PACKAGE_NAME=dicom_img_anon
CODE_PATHS=$(PACKAGE_NAME) tests setup.py util.py
LINE_LEN=120
PYTHON=$(VENV)/bin/python3
COVERAGE=$(VENV)/bin/coverage
style: $(VENV)
$(PYTHON) -m autoflake -r -i --remove-all-unused-imports --remove-unused-variables $(CODE_PATHS)
$(PYTHON) -m isort $(CODE_PATHS) --line-length $(LINE_LEN)
$(PYTHON) -m autopep8 -a -r -i --max-line-length=$(LINE_LEN) $(CODE_PATHS)
$(PYTHON) -m black --line-length $(LINE_LEN) --target-version $(PY_VER_SHORT) $(CODE_PATHS)
types: node_modules
npx --no-install pyright $(CODE_PATHS) -p pyrightconfig.json
test: $(VENV)
$(COVERAGE) run --source $(PACKAGE_NAME) -m pytest tests $(CIRCLECI_TEST_FLAGS) -s
quality: $(VENV)
$(PYTHON) -m black --check $(CODE_PATHS) --line-length=120
$(PYTHON) -m flake8 $(CODE_PATHS)
$(VENV):
$(MAKE) init
init:
python3 -m virtualenv -p $(PY_VER) $(VENV)
$(VENV)/bin/pip install -e .[dev]
node_modules:
npm install
coverage:
$(MAKE) test
for command in xml html report ; do \
$(COVERAGE) $$command --omit=$(PACKAGE_NAME)/version.py ; \
done
check:
$(MAKE) style
$(MAKE) quality
$(MAKE) types
$(MAKE) coverage
circleci:
circleci local execute --job run_check -e CODECOV_TOKEN=$(CODECOV_TOKEN)
clean:
rm -rf \
node_modules \
env \
*.egg-info \
__pycache__ \
.pytest_cache \
.coverage \
coverage.xml
reset:
$(MAKE) clean
$(MAKE) check