-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (51 loc) · 1.72 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
71
MAX_LINE_LENGTH := 120
CHECK ?= 0
format_dirs := deduce/ tests/
lint_dirs := deduce/
black_args := --line-length $(MAX_LINE_LENGTH)
isort_args := --profile black
docformatter_args := --recursive --wrap-summaries $(MAX_LINE_LENGTH) --wrap-descriptions $(MAX_LINE_LENGTH) --pre-summary-newline
typehints_args := --select ANN001,ANN2,ANN3 --max-line-length $(MAX_LINE_LENGTH)
doclint_args := --disable=all --enable C0112,C0115,C0116
pylint_args := --disable=C0112,C0114,C0115,C0116 --max-line-length=$(MAX_LINE_LENGTH)
ifeq ($(CHECK), 1)
black_args += --check
isort_args += -c
docformatter_args := --check $(docformatter_args)
doclint_args += --fail-under 10.0
pylint_args += --fail-under 9.0
else
docformatter_args := --in-place $(docformatter_args)
typehints_args += --exit-zero
doclint_args += --exit-zero
pylint_args += --exit-zero
endif
format: black isort docformat
lint: typehints doclint pylint
black:
python -m black $(black_args) $(format_dirs)
isort:
python -m isort $(isort_args) $(format_dirs)
docformat:
python -m docformatter $(docformatter_args) $(format_dirs)
typehints:
python -m flake8 $(typehints_args) $(lint_dirs)
doclint:
python -m pylint $(doclint_args) $(lint_dirs)
pylint:
python -m pylint $(pylint_args) $(lint_dirs)
test:
python -m pytest --cov-report html --cov-report lcov --cov=deduce --cov-fail-under=80 tests/
build-docs:
sphinx-apidoc --module-first --force --templatedir=docs/templates -o docs/source/api deduce
sphinx-build docs/source docs/_build/html -c docs/
clean:
rm -rf .coverage
rm -rf htmlcov
rm -rf coverage.lcov
rm -rf .pytest_cache
rm -rf dist
clean-docs:
rm -rf docs/_build
rm -rf docs/source/api
.PHONY: format lint black isort docformat typehints doclint pylint test clean