ifeq ($(PYTHONPATH),)
	PYTHONPATH := .
else
	PYTHONPATH := .:$(PYTHONPATH)
endif
export PYTHONPATH


.PHONY: all formal
all: format lint test
formal: format lint

.PHONY: help
help:
	@echo
	@echo 'Commands:'
	@echo
	@echo '  make format                run code formatter'
	@echo '  make lint                  run linter'
	@echo '  make check                 run static type checker'
	@echo '  make test                  run test'
	@echo '  make all                   all of the above'
	@echo '  make docs                  build the html documentation'
	@echo

.PHONY: format
format:
	ruff format src/ligo_fir test
	ruff check --fix src/ligo_fir test

.PHONY: lint
lint:
	ruff format --diff src/ligo_fir test
	ruff check src/ligo_fir test

.PHONY: check
check:
	mypy src/ligo_fir

.PHONY: test
test:
	pytest -v --cov=src/ligo_fir --cov-report=term-missing test

# not part of `all`, since the docs are built by their own CI job
.PHONY: docs
docs:
	$(MAKE) -C docs html
