-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
62 lines (50 loc) · 2.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Phony targets in this file:
#
# test: Runs the python and js tests.
#
# pytest: Runs all preprocessing script tests using pytest.
#
# jstest: Instruments the JS files for code coverage and runs JS tests using
# mocha-headless-chrome.
#
# stylecheck: Checks to make sure that the Python and JavaScript codebases are
# properly formatted. Requires that a few extra packages are installed.
#
# style: Auto-formats code to make it (mostly) compliant with stylecheck.
# Requires that a few extra packages are installed.
#
# Many of these directives were based on Qurro's Makefile (which was kind of
# based on the initial version of this Makefile, anyway, so it's a silly
# chicken-and-egg thing).
.PHONY: pytest jstest test pystylecheck jsstylecheck stylecheck pystyle jsstyle style demo
PYTEST_COMMAND = python3 -B -m pytest metagenomescope/tests/ --cov-report xml --cov-report term --cov metagenomescope
PYLOCS = metagenomescope/ setup.py
JSLOCS = metagenomescope/support_files/js/*.js metagenomescope/tests/js_tests/*.js docs/js/extra_functionality.js .jshintrc
HTMLCSSLOCS = metagenomescope/support_files/index.html metagenomescope/tests/js_tests/*.html metagenomescope/support_files/css/viewer_style.css docs/404.html docs/index.html docs/css/mgsc_docs_style.css
# -B: don't create __pycache__/ directories
pytest:
$(PYTEST_COMMAND)
rm -f metagenomescope/tests/output/*
jstest:
nyc instrument metagenomescope/support_files/js/ metagenomescope/tests/js_tests/instrumented_js/
mocha-headless-chrome -f metagenomescope/tests/js_tests/index.html -c js_coverage.json
test: pytest jstest
pystylecheck:
flake8 --ignore=E203,W503,E266,E501 $(PYLOCS)
black --check -l 79 $(PYLOCS)
jsstylecheck:
jshint $(JSLOCS)
prettier --check --tab-width 4 $(JSLOCS) $(HTMLCSSLOCS)
stylecheck: pystylecheck jsstylecheck
pystyle:
black -l 79 $(PYLOCS)
jsstyle:
@# Shorthand, for when I'm developing JS code and don't want to waste time
@# with python/HTML stuff
prettier --write --tab-width 4 $(JSLOCS)
style: pystyle jsstyle
demo:
@# makes a simple demo with a tiny graph that lets us test out the viewer
@# interface
rm -rf mg2
mgsc -i metagenomescope/tests/input/sample1.gfa -o mg2