Skip to content

Commit

Permalink
👷🏻 ci: improve help command with a regex
Browse files Browse the repository at this point in the history
  • Loading branch information
adriamontoto committed Jul 25, 2024
1 parent 343aee8 commit 243bbce
Showing 1 changed file with 19 additions and 29 deletions.
48 changes: 19 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,59 +1,49 @@
.DEFAULT_GOAL := all

full_sources = developing_tools tests
sources = developing_tools
configuration_file = pyproject.toml
configuration_file = pyproject.toml


.PHONY: help
help: # Display this help
@echo "Usage: make [COMMAND] [OPTIONS]..."
@awk 'BEGIN {FS = ":.*#"; printf "\nCommands:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?#/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)


.PHONY: install # Install production dependencies
install:
.PHONY: install
install: # Install production dependencies
@pip install -r requirements.txt


.PHONY: install-dev # Install development dependencies
install-dev:
.PHONY: install-dev
install-dev: # Install development dependencies
@pip install -r requirements_dev.txt


.PHONY: format # Automatically format python code
format:
.PHONY: format
format: # Automatically format python code
@ruff check $(full_sources) --fix-only --config $(configuration_file)
@ruff format $(full_sources) --config $(configuration_file)


.PHONY: lint # Lint python code
lint:
.PHONY: lint
lint: # Lint python code
@set -e; \
mypy $(full_sources) --txt-report . --config-file $(configuration_file) || mypy_exit=$$?; \
bandit $(sources) --recursive --configfile $(configuration_file) || bandit_exit=$$?; \
ruff check $(full_sources) || ruff_exit=$$?; \
exit $$(( mypy_exit || bandit_exit || ruff_exit ))


.PHONY: test # Run all tests
test:
.PHONY: test
test: # Run all tests
@pytest --config-file $(configuration_file)


.PHONY: coverage # Get coverage report
coverage:
.PHONY: coverage
coverage: # Get coverage report
@set -e; \
coverage erase; \
coverage run -m pytest --config-file $(configuration_file) || coverage_exit=$$?; \
coverage combine; \
coverage report; \
exit $$coverage_exit


.PHONY: help # Show this help message
help:
@echo "Usage: make [COMMAND] [OPTIONS]..."
@echo
@echo "Commands:"
@echo " make install Install production dependencies"
@echo " make install-dev Install development dependencies"
@echo " make format Automatically format python code"
@echo " make lint Lint python code"
@echo " make test Run all tests"
@echo " make coverage Get coverage report"
@echo " make help Show this help message"

0 comments on commit 243bbce

Please sign in to comment.