-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (46 loc) · 1.85 KB
/
Copy pathMakefile
File metadata and controls
60 lines (46 loc) · 1.85 KB
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
.PHONY: clean-pyc develop lint-server lint-client lint-docs lint format-server format-client format test coverage openapi-snapshot
help:
@echo "clean-pyc - remove Python file artifacts"
@echo "develop - install development dependencies"
@echo "lint - check style with ruff, sort python with ruff, indent html, and lint frontend css/js"
@echo "format - enforce a consistent code style across the codebase, sort python files with ruff and fix frontend css/js"
@echo "test - run tests"
@echo "coverage - check code coverage"
@echo "openapi-snapshot - regenerate the v3 API OpenAPI snapshot for CI"
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
develop: clean-pyc
pip install -e .[testing,docs] --config-settings editable-mode=strict
npm install --no-save && npm run build
lint-server:
ruff format --check .
ruff check .
ty check
curlylint --parse-only wagtail
git ls-files '*.html' | xargs djhtml --check
semgrep --config .semgrep.yml --error .
lint-client:
npm run lint --loglevel silent
lint-docs:
doc8 docs
lint: lint-server lint-client lint-docs
format-server:
ruff check . --fix
ruff format .
git ls-files '*.html' | xargs djhtml
format-client:
npm run format
npm run fix:js
format: format-server format-client
test:
python runtests.py
OPENAPI_SNAPSHOT := wagtail/api/v3/tests/snapshots/openapi.json
openapi-snapshot:
DJANGO_SETTINGS_MODULE=wagtail.test.settings python -c 'import json, django; django.setup(); from wagtail.api.v3.api import api; from ninja.responses import NinjaJSONEncoder; f = open("$(OPENAPI_SNAPSHOT)", "w"); json.dump(api.get_openapi_schema(), f, cls=NinjaJSONEncoder, indent=2, sort_keys=True); f.write("\n"); f.close()'
coverage:
coverage run --source wagtail runtests.py
coverage report -m
coverage html
open coverage_html_report/index.html