LINT_PATHS=open_loop/ tests/

pytest:
	python3 -m pytest -v tests/ --cov-report term --cov=. --color=yes

mypy:
	mypy ${LINT_PATHS}

lint:
	# stop the build if there are Python syntax errors or undefined names
	# see https://lintlyci.github.io/Flake8Rules/
	ruff ${LINT_PATHS} --select=E9,F63,F7,F82 --output-format=full
	# exit-zero treats all errors as warnings.
	ruff ${LINT_PATHS} --exit-zero

ruff_fix:
	ruff ${LINT_PATHS} --fix

format:
	# Sort imports
	ruff --select I ${LINT_PATHS} --fix
	# Reformat using black
	black ${LINT_PATHS}

check-codestyle:
	# Sort imports
	ruff --select I ${LINT_PATHS}
	# Reformat using black
	black --check ${LINT_PATHS}

commit-checks: format mypy lint


.PHONY: lint format check-codestyle commit-checks doc
