name ?= codecovcli
# Semantic versioning format https://semver.org/
tag_regex := ^v([0-9]{1,}\.){2}[0-9]{1,}([-_]\w+)?$

lint.install:
	echo "Installing ruff..."
	pip install -Iv ruff

# The preferred method (for now) w.r.t. fixable rules is to manually update the makefile
# with --fix and re-run 'make lint.' Since ruff is constantly adding rules this is a slight
# amount of "needed" friction imo.
lint.run:
	ruff check --ignore F401 --exclude languages --exclude samples
	ruff format --exclude languages --exclude samples

lint.check:
	echo "Linting..."
	ruff check --ignore F401 --exclude languages --exclude samples
	echo "Formatting..."
	ruff format --check --exclude languages --exclude samples

lint:
	make lint.install
	make lint.run

command_dump:
	cd prevent-cli && uv run command_dump.py

tag.release:
ifeq ($(shell echo ${version} | egrep "${tag_regex}"),)
	@echo "Version '${version}' is not a valid git tag.\nUsage: make tag.release version=v0.0.0"
else
	@echo "Tagging new release ${version}"
	git tag -a ${version} -m "Autogenerated release tag for codecov-cli"
	git push origin ${version}
endif
