Skip to content

Instantly share code, notes, and snippets.

@Ruslan-Skira
Last active August 11, 2026 16:18
Show Gist options
  • Select an option

  • Save Ruslan-Skira/d2ecd9b75217d767174834fc64354178 to your computer and use it in GitHub Desktop.

Select an option

Save Ruslan-Skira/d2ecd9b75217d767174834fc64354178 to your computer and use it in GitHub Desktop.
Makefile template
.PHONY: help lint run-app
.DEFAULT_GOAL := help
# Configuration
BLUE := \033[0;34m
GREEN := \033[0;32m
CYAN := \033[0;36m
NC := \033[0m
DIVIDER := -
MAIN_FOLDER := <folder_to_check>
help: ## Show this help message
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " $(CYAN)%-20s$(NC) %s\n", $$1, $$2}'
define CENTER_LINE
cols=$$(tput cols 2>/dev/null || echo 80); \
len=$${#msg}; \
avail=$$(( cols - len - 2 )); \
left=$$(( avail / 2 )); \
right=$$(( avail - left )); \
left_border=$$(printf '%*s' "$$left" "" | tr ' ' '$(DIVIDER)'); \
right_border=$$(printf '%*s' "$$right" "" | tr ' ' '$(DIVIDER)'); \
printf "$$COLOR%s %s %s$$NC\n" "$$left_border" "$$msg" "$$right_border"
endef
lint: ## Run ruff for linting and formatting across all modules
@echo "$(CYAN)Running ruff checks and formatting...$(NC)"
ruff check . --select I --fix
ruff format .
ruff check . --fix
@COLOR="$(GREEN)"; msg="Ruff finished."; $(CENTER_LINE); \
COLOR="$(BLUE)"; msg="Starting mypy type checks..."; $(CENTER_LINE); \
mypy "$(MAIN_FOLDER)"; \
COLOR="$(GREEN)"; msg="mypy finished."; $(CENTER_LINE)
# Development commands
run-app: ## Run app locally
@echo "$(BLUE)Running the app$(NC)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment