@@ -37,39 +37,42 @@ COVBASE=coverage run --append
37
37
VERSION =8.3.$(shell date +% Y% m% d% H% M% S --utc --date=`git log --first-parent \
38
38
--max-count=1 --format=format:% cI`)
39
39
40
- # # all : default task
40
+ # # all : default task (install schema-salad in dev mode)
41
41
all : dev
42
42
43
- # # help : print this help message and exit
43
+ # # help : print this help message and exit
44
44
help : Makefile
45
45
@sed -n ' s/^##//p' $<
46
46
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
48
51
install-dep : install-dependencies
49
52
50
53
install-dependencies : FORCE
51
54
pip install --upgrade $(DEVPKGS )
52
55
pip install -r requirements.txt -r mypy-requirements.txt
53
56
54
- # # install : install the ${MODULE} module and script(s)
57
+ # # install : install the schema-salad package and scripts
55
58
install : FORCE
56
59
pip install .$(EXTRAS )
57
60
58
- # # dev : install the ${MODULE} module in dev mode
61
+ # # dev : install the schema-salad package in dev mode
59
62
dev : install-dep
60
63
pip install -e .$(EXTRAS )
61
64
62
- # # dist : create a module package for distribution
65
+ # # dist : create a module package for distribution
63
66
dist : dist/${MODULE}-$(VERSION ) .tar.gz
64
67
65
68
dist/${MODULE}-$(VERSION ) .tar.gz : $(SOURCES )
66
69
python setup.py sdist bdist_wheel
67
70
68
- # # docs : make the docs
71
+ # # docs : make the docs
69
72
docs : FORCE
70
73
cd docs && $(MAKE ) html
71
74
72
- # # clean : clean up all temporary / machine-generated files
75
+ # # clean : clean up all temporary / machine-generated files
73
76
clean : FORCE
74
77
rm -rf ${MODULE} /__pycache__ ${MODULE} /tests/__pycache__ schema_salad/_version.py
75
78
rm -f * .so ${MODULE} /* .so ${MODULE} /tests/* .so ${MODULE} /avro/* .so
@@ -78,32 +81,37 @@ clean: FORCE
78
81
rm -f diff-cover.html
79
82
80
83
# 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 $^
84
87
85
88
remove_unused_imports : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
86
89
autoflake --in-place --remove-all-unused-imports $^
87
90
88
91
pep257 : pydocstyle
89
- # # pydocstyle : check Python code style
92
+ # # pydocstyle : check Python docstring style
90
93
pydocstyle : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
91
94
pydocstyle --add-ignore=D100,D101,D102,D103 $^ || true
92
95
93
96
pydocstyle_report.txt : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
94
97
pydocstyle setup.py $^ > $@ 2>&1 || true
95
98
99
+ # # diff_pydocstyle_report : check Python docstring style for changed files only
96
100
diff_pydocstyle_report : pydocstyle_report.txt
97
101
diff-quality --compare-branch=main --violations=pydocstyle --fail-under=100 $^
98
102
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)
100
108
format :
101
109
black --exclude metaschema.py --exclude _version.py schema_salad setup.py mypy-stubs
102
110
103
111
format-check :
104
112
black --diff --check --exclude metaschema.py --exclude _version.py schema_salad setup.py mypy-stubs
105
113
106
- # # pylint : run static code analysis on Python code
114
+ # # pylint : run static code analysis on Python code
107
115
pylint : $(PYSOURCES )
108
116
pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
109
117
$^ -j0|| true
@@ -113,7 +121,7 @@ pylint_report.txt: $(PYSOURCES)
113
121
$^ -j0> $@ || true
114
122
115
123
diff_pylint_report : pylint_report.txt
116
- diff-quality --violations=pylint pylint_report.txt
124
+ diff-quality --compare-branch=main -- violations=pylint pylint_report.txt
117
125
118
126
.coverage :
119
127
python setup.py test --addopts " --cov --cov-config=.coveragerc --cov-report= -n auto"
@@ -143,23 +151,23 @@ coverage-report: .coverage
143
151
coverage report
144
152
145
153
diff-cover : coverage.xml
146
- diff-cover $^
154
+ diff-cover --compare-branch=main $^
147
155
148
156
diff-cover.html : coverage.xml
149
- diff-cover $^ --html-report $@
157
+ diff-cover --compare-branch=main $^ --html-report $@
150
158
151
- # # test : run the ${MODULE} test suite
159
+ # # test : run the schema-salad test suite
152
160
test : $(PYSOURCES )
153
- python setup.py test ${PYTEST_EXTRA}
161
+ python -m pytest -rs ${PYTEST_EXTRA}
154
162
155
- # # testcov : run the ${MODULE} test suite and collect coverage
163
+ # # testcov : run the schema-salad test suite and collect coverage
156
164
testcov : $(PYSOURCES )
157
165
python setup.py test --addopts " --cov" ${PYTEST_EXTRA}
158
166
159
167
sloccount.sc : $(PYSOURCES ) Makefile
160
168
sloccount --duplicates --wide --details $^ > $@
161
169
162
- # # sloccount : count lines of code
170
+ # # sloccount : count lines of code
163
171
sloccount : $(PYSOURCES ) Makefile
164
172
sloccount $^
165
173
@@ -174,6 +182,9 @@ mypy: $(filter-out setup.py,$(PYSOURCES))
174
182
mypyc : $(PYSOURCES )
175
183
MYPYPATH=mypy-stubs SCHEMA_SALAD_USE_MYPYC=1 python setup.py test
176
184
185
+ shellcheck : FORCE
186
+ shellcheck build-schema_salad-docker.sh release-test.sh
187
+
177
188
pyupgrade : $(filter-out schema_salad/metaschema.py,$(PYSOURCES ) )
178
189
pyupgrade --exit-zero-even-if-changed --py36-plus $^
179
190
0 commit comments