.PHONY: clean test upgrade quality requirements
# Generates a help message. Borrowed from https://github.com/pydanny/cookiecutter-djangopackage.
help: ## display this help message
	@echo "Please use \`make <target>\` where <target> is one of"
	@perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m  %-25s\033[0m %s\n", $$1, $$2}'

clean: ## delete generated byte code and coverage reports
	find . -name '*.pyc' -delete
	find . -name '__pycache__' -type d -exec rm -rf {} ';' || true
	rm -rf assets
	rm -rf pii_report

upgrade: ## update uv.lock with the latest packages satisfying pyproject.toml constraints
	uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
	uv lock --upgrade

requirements: ## install development environment requirements
	uv sync --group dev

quality: ## check coding style with pycodestyle and pylint
	tox -e quality

test-python: clean ## run tests using pytest and generate coverage report
	pytest

test: test-python ## run tests
