.PHONY: all
all: format lint type-check test

.PHONY: help
help:
	@echo
	@echo 'Commands:'
	@echo
	@echo '  make test                  run tests'
	@echo '  make lint                  run linter'
	@echo '  make format                run code formatter'
	@echo '  make type-check            run static type checker'
	@echo '  make docs                  build documentation'
	@echo '  make docs-serve            serve documentation locally'
	@echo '  make clean                 remove build artifacts and cache files'
	@echo

.PHONY: test
test:
	python -m pytest

.PHONY: lint
lint:
	flake8 .

.PHONY: format
format:
	isort .
	black .

.PHONY: type-check
type-check:
	mypy

.PHONY: docs
docs:
	mkdocs build

.PHONY: docs-serve
docs-serve:
	mkdocs serve

.PHONY: clean
clean:
	find . -type f -name '*.pyc' -delete
	find . -type d -name '__pycache__' -delete
	find . -type d -name '*.egg-info' -exec rm -rf {} +
	rm -rf build/ dist/ .mypy_cache/ .pytest_cache/ htmlcov/ .coverage coverage.xml
	rm -rf .ruff_cache/ .tox/
