@@ -37,39 +37,42 @@ COVBASE=coverage run --append
3737VERSION =8.3.$(shell date +% Y% m% d% H% M% S --utc --date=`git log --first-parent \
3838 --max-count=1 --format=format:% cI`)
3939
40- # # all : default task
40+ # # all : default task (install schema-salad in dev mode)
4141all : dev
4242
43- # # help : print this help message and exit
43+ # # help : print this help message and exit
4444help : Makefile
4545 @sed -n ' s/^##//p' $<
4646
47- # # install-dep : install most of the development dependencies via pip
47+ # # cleanup : shortcut for "make sort_imports format flake8 diff_pydocstyle_report"
48+ cleanup : sort_imports format flake8 diff_pydocstyle_report
49+
50+ # # install-dep : install most of the development dependencies via pip
4851install-dep : install-dependencies
4952
5053install-dependencies : FORCE
5154 pip install --upgrade $(DEVPKGS )
5255 pip install -r requirements.txt -r mypy-requirements.txt
5356
54- # # install : install the ${MODULE} module and script(s)
57+ # # install : install the schema-salad package and scripts
5558install : FORCE
5659 pip install .$(EXTRAS )
5760
58- # # dev : install the ${MODULE} module in dev mode
61+ # # dev : install the schema-salad package in dev mode
5962dev : install-dep
6063 pip install -e .$(EXTRAS )
6164
62- # # dist : create a module package for distribution
65+ # # dist : create a module package for distribution
6366dist : dist/${MODULE}-$(VERSION ) .tar.gz
6467
6568dist/${MODULE}-$(VERSION ) .tar.gz : $(SOURCES )
6669 python setup.py sdist bdist_wheel
6770
68- # # docs : make the docs
71+ # # docs : make the docs
6972docs : FORCE
7073 cd docs && $(MAKE ) html
7174
72- # # clean : clean up all temporary / machine-generated files
75+ # # clean : clean up all temporary / machine-generated files
7376clean : FORCE
7477 rm -rf ${MODULE} /__pycache__ ${MODULE} /tests/__pycache__ schema_salad/_version.py
7578 rm -f * .so ${MODULE} /* .so ${MODULE} /tests/* .so ${MODULE} /avro/* .so
@@ -78,32 +81,37 @@ clean: FORCE
7881 rm -f diff-cover.html
7982
8083# Linting and code style related targets
81- # # sorting imports using isort: https://github.com/timothycrosley/isort
82- sort_imports : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
83- isort $^ mypy-stubs
84+ # # sort_import : sorting imports using isort: https://github.com/timothycrosley/isort
85+ sort_imports : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) ) mypy-stubs
86+ isort $^
8487
8588remove_unused_imports : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
8689 autoflake --in-place --remove-all-unused-imports $^
8790
8891pep257 : pydocstyle
89- # # pydocstyle : check Python code style
92+ # # pydocstyle : check Python docstring style
9093pydocstyle : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
9194 pydocstyle --add-ignore=D100,D101,D102,D103 $^ || true
9295
9396pydocstyle_report.txt : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
9497 pydocstyle setup.py $^ > $@ 2>&1 || true
9598
99+ # # diff_pydocstyle_report : check Python docstring style for changed files only
96100diff_pydocstyle_report : pydocstyle_report.txt
97101 diff-quality --compare-branch=main --violations=pydocstyle --fail-under=100 $^
98102
99- # # format : check/fix all code indentation and formatting (runs black)
103+ # # codespell : check for common misspellings
104+ codespell :
105+ codespell -w $(shell git ls-files | grep -v mypy-stubs | grep -v gitignore | grep -v EDAM.owl | grep -v pre.yml)
106+
107+ # # format : check/fix all code indentation and formatting (runs black)
100108format :
101109 black --exclude metaschema.py --exclude _version.py schema_salad setup.py mypy-stubs
102110
103111format-check :
104112 black --diff --check --exclude metaschema.py --exclude _version.py schema_salad setup.py mypy-stubs
105113
106- # # pylint : run static code analysis on Python code
114+ # # pylint : run static code analysis on Python code
107115pylint : $(PYSOURCES )
108116 pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
109117 $^ -j0|| true
@@ -113,7 +121,7 @@ pylint_report.txt: $(PYSOURCES)
113121 $^ -j0> $@ || true
114122
115123diff_pylint_report : pylint_report.txt
116- diff-quality --violations=pylint pylint_report.txt
124+ diff-quality --compare-branch=main -- violations=pylint pylint_report.txt
117125
118126.coverage :
119127 python setup.py test --addopts " --cov --cov-config=.coveragerc --cov-report= -n auto"
@@ -143,23 +151,23 @@ coverage-report: .coverage
143151 coverage report
144152
145153diff-cover : coverage.xml
146- diff-cover $^
154+ diff-cover --compare-branch=main $^
147155
148156diff-cover.html : coverage.xml
149- diff-cover $^ --html-report $@
157+ diff-cover --compare-branch=main $^ --html-report $@
150158
151- # # test : run the ${MODULE} test suite
159+ # # test : run the schema-salad test suite
152160test : $(PYSOURCES )
153- python setup.py test ${PYTEST_EXTRA}
161+ python -m pytest -rs ${PYTEST_EXTRA}
154162
155- # # testcov : run the ${MODULE} test suite and collect coverage
163+ # # testcov : run the schema-salad test suite and collect coverage
156164testcov : $(PYSOURCES )
157165 python setup.py test --addopts " --cov" ${PYTEST_EXTRA}
158166
159167sloccount.sc : $(PYSOURCES ) Makefile
160168 sloccount --duplicates --wide --details $^ > $@
161169
162- # # sloccount : count lines of code
170+ # # sloccount : count lines of code
163171sloccount : $(PYSOURCES ) Makefile
164172 sloccount $^
165173
@@ -174,6 +182,9 @@ mypy: $(filter-out setup.py,$(PYSOURCES))
174182mypyc : $(PYSOURCES )
175183 MYPYPATH=mypy-stubs SCHEMA_SALAD_USE_MYPYC=1 python setup.py test
176184
185+ shellcheck : FORCE
186+ shellcheck build-schema_salad-docker.sh release-test.sh
187+
177188pyupgrade : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
178189 pyupgrade --exit-zero-even-if-changed --py36-plus $^
179190
0 commit comments