1515#
16161717
18- # make pycodestyle to check for basic Python code compliance
18+ # make format to fix most python formatting errors
1919# make pylint to check Python code for enhanced compliance including naming
2020# and documentation
2121# make coverage-report to check coverage of the python scripts by the tests
@@ -25,15 +25,16 @@ MODULE=cwlupgrader
2525# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2626# `[[` conditional expressions.
2727PYSOURCES =$(wildcard cwlupgrader/** .py tests/* .py) setup.py
28- DEVPKGS =pycodestyle diff_cover black pylint coverage pydocstyle \
29- flake8-bugbear pytest isort mock flake8
30- DEBDEVPKGS =pylint python-coverage pydocstyle sloccount \
31- python-flake8 python-mock shellcheck
32- VERSION =$(shell git describe --tags --dirty | sed s/v//)
28+ DEVPKGS =diff_cover black pylint coverage pep257 pytest-xdist \
29+ flake8-bugbear pytest isort flake8
30+ DEBDEVPKGS =pylint python3-coverage sloccount \
31+ python3-flake8 shellcheck
32+ VERSION =1.0.$(shell date +% Y% m% d% H% M% S --utc --date=`git log --first-parent \
33+ --max-count=1 --format=format:% cI`)
3334
3435# # all : default task
3536all :
36- ./setup.py develop
37+ pip install -e .
3738
3839# # help : print this help message and exit
3940help : Makefile
@@ -69,39 +70,29 @@ clean: FORCE
6970sort_imports :
7071 isort ${MODULE} /* .py tests/* .py setup.py
7172
72- # # pycodestyle : check Python code style
73- pycodestyle : $(PYSOURCES )
74- pycodestyle --exclude=_version.py --show-source --show-pep8 $^ || true
75-
76- pycodestyle_report.txt : $(PYSOURCES )
77- pycodestyle --exclude=_version.py $^ > $@ || true
78-
79- diff_pycodestyle_report : pycodestyle_report.txt
80- diff-quality --violations=pycodestyle $^
81-
8273pep257 : pydocstyle
8374# # pydocstyle : check Python code style
8475pydocstyle : $(PYSOURCES )
85- pydocstyle --ignore=D100,D101,D102,D103 $^ || true
76+ pydocstyle --add- ignore=D100,D101,D102,D103 $^ || true
8677
8778pydocstyle_report.txt : $(PYSOURCES )
88- pydocstyle setup.py $^ > pydocstyle_report.txt 2>&1 || true
79+ pydocstyle setup.py $^ > $@ 2>&1 || true
8980
9081diff_pydocstyle_report : pydocstyle_report.txt
91- diff-quality --violations=pycodestyle $^
82+ diff-quality --violations=pycodestyle --fail-under=100 $^
9283
9384# # format : check/fix all code indentation and formatting (runs black)
9485format :
95- black --target-version py27 setup.py cwlupgrader
86+ black setup.py cwlupgrader
9687
9788# # pylint : run static code analysis on Python code
9889pylint : $(PYSOURCES )
9990 pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
100- $^ || true
91+ $^ -j0 || true
10192
10293pylint_report.txt : ${PYSOURCES}
10394 pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
104- $^ > $@ || true
95+ $^ -j 0 > $@ || true
10596
10697diff_pylint_report : pylint_report.txt
10798 diff-quality --violations=pylint pylint_report.txt
@@ -148,19 +139,14 @@ list-author-emails:
148139 @echo ' name, E-Mail Address'
149140 @git log --format=' %aN,%aE' | sort -u | grep -v ' root'
150141
151-
152- mypy2 : ${PYSOURCES}
153- rm -Rf typeshed/2and3/ruamel/yaml
154- ln -s $(shell python -c 'from __future__ import print_function; import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__) )' ) \
155- typeshed/2and3/ruamel/yaml
156- MYPYPATH=$$ MYPYPATH:typeshed/2.7:typeshed/2and3 mypy --py2 --disallow-untyped-calls \
157- --warn-redundant-casts \
158- ${MODULE}
159-
160- mypy3 : ${PYSOURCES}
161- rm -Rf typeshed/2and3/ruamel/yaml
162- ln -s $(shell python3 -c 'from __future__ import print_function; import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__) )' ) \
163- typeshed/2and3/ruamel/yaml
142+ mypy3 : mypy
143+ mypy : ${PYSOURCES}
144+ if ! test -f $( shell python3 -c ' import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))' ) /py.typed ; \
145+ then \
146+ rm -Rf typeshed/2and3/ruamel/yaml ; \
147+ ln -s $(shell python3 -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__) )' ) \
148+ typeshed/2and3/ruamel/ ; \
149+ fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
164150 MYPYPATH=$$ MYPYPATH:typeshed/3:typeshed/2and3 mypy --disallow-untyped-calls \
165151 --warn-redundant-casts \
166152 ${MODULE}
0 commit comments