@@ -26,7 +26,7 @@ EXTRAS=
2626
2727# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2828# `[[` 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
3030DEVPKGS =diff_cover black pylint pep257 pydocstyle flake8 tox tox-pyenv \
3131 isort wheel autoflake flake8-bugbear pyupgrade bandit \
3232 -rtest-requirements.txt -rmypy-requirements.txt
@@ -36,76 +36,84 @@ VERSION=v$(shell echo $$(tail -n 1 cwl_utils/__meta__.py | awk '{print $$3}'))
3636mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
3737UNAME_S =$(shell uname -s)
3838
39- # # all : default task
39+ # # all : default task (install cwl-utils in dev mode)
4040all : dev
4141
42- # # help : print this help message and exit
42+ # # help : print this help message and exit
4343help : Makefile
4444 @sed -n ' s/^##//p' $<
4545
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
4750install-dep : install-dependencies
4851
4952install-dependencies :
5053 pip install --upgrade $(DEVPKGS )
5154 pip install -r requirements.txt -r mypy-requirements.txt -r docs/requirements.txt
5255
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
5457install-deb-dep :
5558 sudo apt-get install $(DEBDEVPKGS )
5659
57- # # install : install the ${MODULE} module and scripts
60+ # # install : install the cwl-utils package and the scripts
5861install : FORCE
5962 pip install .$(EXTRAS )
6063
61- # # dev : install the ${MODULE} module in dev mode
64+ # # dev : install the cwl-utils package in dev mode
6265dev : install-dep
6366 pip install -e .$(EXTRAS )
6467
65- # # dist : create a module package for distribution
68+ # # dist : create a module package for distribution
6669dist : dist/${MODULE}-$(VERSION ) .tar.gz
6770
6871dist/${MODULE}-$(VERSION ) .tar.gz : $(SOURCES )
6972 python setup.py sdist bdist_wheel
7073
71- # # docs : make the docs
74+ # # docs : make the docs
7275docs : FORCE
7376 cd docs && $(MAKE ) html
7477
75- # # clean : clean up all temporary / machine-generated files
78+ # # clean : clean up all temporary / machine-generated files
7679clean : FORCE
7780 rm -f ${MODILE} /* .pyc tests/* .pyc
7881 python setup.py clean --all || true
7982 rm -Rf .coverage
8083 rm -f diff-cover.html
8184
8285# 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
8487sort_imports : $(PYSOURCES )
8588 isort $^
8689
8790remove_unused_imports : $(PYSOURCES )
8891 autoflake --in-place --remove-all-unused-imports $^
8992
9093pep257 : pydocstyle
91- # # pydocstyle : check Python code style
94+ # # pydocstyle : check Python docstring style
9295pydocstyle : $(PYSOURCES )
9396 pydocstyle --add-ignore=D100,D101,D102,D103 $^ || true
9497
9598pydocstyle_report.txt : $(PYSOURCES )
9699 pydocstyle setup.py $^ > $@ 2>&1 || true
97100
101+ # # diff_pydocstyle_report : check Python docstring style for changed files only
98102diff_pydocstyle_report : pydocstyle_report.txt
99103 diff-quality --compare-branch=main --violations=pydocstyle --fail-under=100 $^
100104
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)
102110format : $(PYSOURCES )
103111 black $^
104112
105113format-check : $(PYSOURCES )
106114 black --diff --check $^
107115
108- # # pylint : run static code analysis on Python code
116+ # # pylint : run static code analysis on Python code
109117pylint : $(PYSOURCES )
110118 pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
111119 $^ -j0|| true
@@ -115,7 +123,7 @@ pylint_report.txt: $(PYSOURCES)
115123 $^ -j0> $@ || true
116124
117125diff_pylint_report : pylint_report.txt
118- diff-quality --violations=pylint pylint_report.txt
126+ diff-quality --compare-branch=main -- violations=pylint pylint_report.txt
119127
120128.coverage : testcov
121129
@@ -135,23 +143,23 @@ coverage-report: .coverage
135143 coverage report
136144
137145diff-cover : coverage.xml
138- diff-cover $^
146+ diff-cover --compare-branch=main $^
139147
140148diff-cover.html : coverage.xml
141- diff-cover $^ --html-report $@
149+ diff-cover --compare-branch=main $^ --html-report $@
142150
143- # # test : run the ${MODULE} test suite
151+ # # test : run the cwl-utils test suite
144152test : $(PYSOURCES )
145- pytest ${PYTEST_EXTRA}
153+ python -m pytest -rs ${PYTEST_EXTRA}
146154
147- # # testcov : run the ${MODULE} test suite and collect coverage
155+ # # testcov : run the cwl-utils test suite and collect coverage
148156testcov : $(PYSOURCES )
149157 pytest --cov ${PYTEST_EXTRA}
150158
151159sloccount.sc : $(PYSOURCES ) Makefile
152160 sloccount --duplicates --wide --details $^ > $@
153161
154- # # sloccount : count lines of code
162+ # # sloccount : count lines of code
155163sloccount : $(PYSOURCES ) Makefile
156164 sloccount $^
157165
@@ -161,19 +169,16 @@ list-author-emails:
161169
162170mypy3 : mypy
163171mypy : $(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
171176
172177pyupgrade : $(PYSOURCES )
173178 pyupgrade --exit-zero-even-if-changed --py36-plus $^
174179
175180release-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 )
177182 ./release-test.sh
178183
179184release : release-test
0 commit comments