@@ -26,7 +26,7 @@ EXTRAS=
26
26
27
27
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
28
28
# `[[` conditional expressions.
29
- PYSOURCES =$(filter-out $(MODULE ) /parser/cwl_v% ,$(shell find $(MODULE ) -name "* .py") ) $(wildcard tests/* .py) $( wildcard * .py)
29
+ PYSOURCES =$(filter-out $(MODULE ) /parser/cwl_v% ,$(shell find $(MODULE ) -name "* .py") ) $(wildcard tests/* .py) create_cwl_from_objects.py load_cwl_by_path .py setup.py
30
30
DEVPKGS =diff_cover black pylint pep257 pydocstyle flake8 tox tox-pyenv \
31
31
isort wheel autoflake flake8-bugbear pyupgrade bandit \
32
32
-rtest-requirements.txt -rmypy-requirements.txt
@@ -36,76 +36,84 @@ VERSION=v$(shell echo $$(tail -n 1 cwl_utils/__meta__.py | awk '{print $$3}'))
36
36
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
37
37
UNAME_S =$(shell uname -s)
38
38
39
- # # all : default task
39
+ # # all : default task (install cwl-utils in dev mode)
40
40
all : dev
41
41
42
- # # help : print this help message and exit
42
+ # # help : print this help message and exit
43
43
help : Makefile
44
44
@sed -n ' s/^##//p' $<
45
45
46
- # # install-dep : install most of the development dependencies via pip
46
+ # # cleanup : shortcut for "make sort_imports format flake8 diff_pydocstyle_report"
47
+ cleanup : sort_imports format flake8 diff_pydocstyle_report
48
+
49
+ # # install-dep : install most of the development dependencies via pip
47
50
install-dep : install-dependencies
48
51
49
52
install-dependencies :
50
53
pip install --upgrade $(DEVPKGS )
51
54
pip install -r requirements.txt -r mypy-requirements.txt -r docs/requirements.txt
52
55
53
- # # install-deb-dep: install most of the dev dependencies via apt-get
56
+ # # install-deb-dep : install many of the dev dependencies via apt-get
54
57
install-deb-dep :
55
58
sudo apt-get install $(DEBDEVPKGS )
56
59
57
- # # install : install the ${MODULE} module and scripts
60
+ # # install : install the cwl-utils package and the scripts
58
61
install : FORCE
59
62
pip install .$(EXTRAS )
60
63
61
- # # dev : install the ${MODULE} module in dev mode
64
+ # # dev : install the cwl-utils package in dev mode
62
65
dev : install-dep
63
66
pip install -e .$(EXTRAS )
64
67
65
- # # dist : create a module package for distribution
68
+ # # dist : create a module package for distribution
66
69
dist : dist/${MODULE}-$(VERSION ) .tar.gz
67
70
68
71
dist/${MODULE}-$(VERSION ) .tar.gz : $(SOURCES )
69
72
python setup.py sdist bdist_wheel
70
73
71
- # # docs : make the docs
74
+ # # docs : make the docs
72
75
docs : FORCE
73
76
cd docs && $(MAKE ) html
74
77
75
- # # clean : clean up all temporary / machine-generated files
78
+ # # clean : clean up all temporary / machine-generated files
76
79
clean : FORCE
77
80
rm -f ${MODILE} /* .pyc tests/* .pyc
78
81
python setup.py clean --all || true
79
82
rm -Rf .coverage
80
83
rm -f diff-cover.html
81
84
82
85
# Linting and code style related targets
83
- # # sorting imports using isort: https://github.com/timothycrosley/isort
86
+ # # sort_import : sorting imports using isort: https://github.com/timothycrosley/isort
84
87
sort_imports : $(PYSOURCES )
85
88
isort $^
86
89
87
90
remove_unused_imports : $(PYSOURCES )
88
91
autoflake --in-place --remove-all-unused-imports $^
89
92
90
93
pep257 : pydocstyle
91
- # # pydocstyle : check Python code style
94
+ # # pydocstyle : check Python docstring style
92
95
pydocstyle : $(PYSOURCES )
93
96
pydocstyle --add-ignore=D100,D101,D102,D103 $^ || true
94
97
95
98
pydocstyle_report.txt : $(PYSOURCES )
96
99
pydocstyle setup.py $^ > $@ 2>&1 || true
97
100
101
+ # # diff_pydocstyle_report : check Python docstring style for changed files only
98
102
diff_pydocstyle_report : pydocstyle_report.txt
99
103
diff-quality --compare-branch=main --violations=pydocstyle --fail-under=100 $^
100
104
101
- # # format : check/fix all code indentation and formatting (runs black)
105
+ # # codespell : check for common misspellings
106
+ codespell :
107
+ codespell -w $(shell git ls-files | grep -v mypy-stubs)
108
+
109
+ # # format : check/fix all code indentation and formatting (runs black)
102
110
format : $(PYSOURCES )
103
111
black $^
104
112
105
113
format-check : $(PYSOURCES )
106
114
black --diff --check $^
107
115
108
- # # pylint : run static code analysis on Python code
116
+ # # pylint : run static code analysis on Python code
109
117
pylint : $(PYSOURCES )
110
118
pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
111
119
$^ -j0|| true
@@ -115,7 +123,7 @@ pylint_report.txt: $(PYSOURCES)
115
123
$^ -j0> $@ || true
116
124
117
125
diff_pylint_report : pylint_report.txt
118
- diff-quality --violations=pylint pylint_report.txt
126
+ diff-quality --compare-branch=main -- violations=pylint pylint_report.txt
119
127
120
128
.coverage : testcov
121
129
@@ -135,23 +143,23 @@ coverage-report: .coverage
135
143
coverage report
136
144
137
145
diff-cover : coverage.xml
138
- diff-cover $^
146
+ diff-cover --compare-branch=main $^
139
147
140
148
diff-cover.html : coverage.xml
141
- diff-cover $^ --html-report $@
149
+ diff-cover --compare-branch=main $^ --html-report $@
142
150
143
- # # test : run the ${MODULE} test suite
151
+ # # test : run the cwl-utils test suite
144
152
test : $(PYSOURCES )
145
- pytest ${PYTEST_EXTRA}
153
+ python -m pytest -rs ${PYTEST_EXTRA}
146
154
147
- # # testcov : run the ${MODULE} test suite and collect coverage
155
+ # # testcov : run the cwl-utils test suite and collect coverage
148
156
testcov : $(PYSOURCES )
149
157
pytest --cov ${PYTEST_EXTRA}
150
158
151
159
sloccount.sc : $(PYSOURCES ) Makefile
152
160
sloccount --duplicates --wide --details $^ > $@
153
161
154
- # # sloccount : count lines of code
162
+ # # sloccount : count lines of code
155
163
sloccount : $(PYSOURCES ) Makefile
156
164
sloccount $^
157
165
@@ -161,19 +169,16 @@ list-author-emails:
161
169
162
170
mypy3 : mypy
163
171
mypy : $(filter-out setup.py,${PYSOURCES})
164
- if ! test -f $( shell python3 -c ' import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))' ) /py.typed ; \
165
- then \
166
- rm -Rf typeshed/ruamel/yaml ; \
167
- ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__) )' ) \
168
- typeshed/ruamel/ ; \
169
- fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
170
- MYPYPATH=$$ MYPYPATH:typeshed mypy $^
172
+ MYPYPATH=$$ MYPYPATH:mypy-stubs mypy $^
173
+
174
+ shellcheck : FORCE
175
+ shellcheck release-test.sh
171
176
172
177
pyupgrade : $(PYSOURCES )
173
178
pyupgrade --exit-zero-even-if-changed --py36-plus $^
174
179
175
180
release-test : FORCE
176
- git diff-index --quiet HEAD -- || ( echo You have uncommited changes, please commit them and try again; false )
181
+ git diff-index --quiet HEAD -- || ( echo You have uncommitted changes, please commit them and try again; false )
177
182
./release-test.sh
178
183
179
184
release : release-test
0 commit comments