Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,45 @@ TEST_COUNT ?= 1
# - docs/makefile-cheat-sheet.md
# - docs/continuous-integration.md

# VARIABLE REFERENCE:
# Service-specific variables (interchangeable for user convenience):
# PKG=<service> - Service name (e.g., ses, lambda, s3) - traditional usage
# K=<service> - Service name (e.g., ses, lambda, s3) - shorter alias
#
# Test-specific variables:
# T=<pattern> - Test name pattern (e.g., TestAccLambda) - preferred
# TESTS=<pattern> - Test name pattern - legacy alias for T
#
# Derived variables (set automatically based on above):
# PKG_NAME - Full package path (e.g., internal/service/ses)
# SVC_DIR - Service directory path (e.g., ./internal/service/ses)
# TEST - Test path pattern (e.g., ./internal/service/ses/...)
#
# Examples:
# make quick-fix PKG=ses # Fix code in SES service
# make quick-fix K=lambda # Same as above, but shorter (both work)
# make t T=TestAccRole PKG=iam # Run specific test in IAM service

# Variable consolidation for backward compatibility and user convenience:
# - PKG and K both refer to service names (e.g., 'ses', 'lambda')
# - If one is provided, automatically set the other for consistency
# - This allows 'make quick-fix PKG=ses' and 'make quick-fix K=ses' to work identically
ifneq ($(origin PKG), undefined)
PKG_NAME = internal/service/$(PKG)
SVC_DIR = ./internal/service/$(PKG)
TEST = ./$(PKG_NAME)/...
# Auto-set K for compatibility
K = $(PKG)
endif

ifneq ($(origin K), undefined)
PKG_NAME = internal/service/$(K)
SVC_DIR = ./internal/service/$(PKG)
SVC_DIR = ./internal/service/$(K)
TEST = ./$(PKG_NAME)/...
# Auto-set PKG for compatibility (only if not already set)
ifeq ($(origin PKG), undefined)
PKG = $(K)
endif
endif

ifneq ($(origin TESTS), undefined)
Expand Down Expand Up @@ -383,9 +412,11 @@ provider-lint: ## [CI] ProviderLint Checks / providerlint
-XS002=false \
$(SVC_DIR)/... ./internal/provider/...

quick-fix: fmt testacc-lint-fix fix-imports modern-fix semgrep-fix ## Some quick fixes
quick-fix-heading: ## Just a heading for quick-fix
@echo "make: Quick fixes..."

quick-fix: quick-fix-heading fmt testacc-lint-fix fix-imports modern-fix semgrep-fix website-terrafmt-fix ## Some quick fixes

provider-markdown-lint: ## [CI] Provider Check / markdown-lint
@echo "make: Provider Check / markdown-lint..."
@docker run --rm \
Expand Down Expand Up @@ -838,6 +869,15 @@ website-terrafmt: ## [CI] Website Checks / terrafmt
@echo "make: Website Checks / terrafmt..."
@terrafmt diff ./website --check --pattern '*.markdown'

website-terrafmt-fix: ## [CI] Fix Website / terrafmt
@echo "make: Fix Website / terrafmt..."
@echo "make: Fixing website/docs root files with terrafmt..."
@find ./website/docs -maxdepth 1 -type f -name '*.markdown' -exec terrafmt fmt {} \;
@for dir in $$(find ./website/docs -maxdepth 1 -type d ! -name docs ! -name cdktf | sort); do \
echo "make: Fixing $$dir with terrafmt..."; \
terrafmt fmt $$dir --pattern '*.markdown'; \
done

website-tflint: tflint-init ## [CI] Website Checks / tflint
@echo "make: Website Checks / tflint..."
@exit_code=0 ; \
Expand Down Expand Up @@ -941,6 +981,7 @@ yamllint: ## [CI] YAML Linting / yamllint
provider-lint \
provider-markdown-lint \
quick-fix \
quick-fix-heading \
sane \
sanity \
semgrep \
Expand Down Expand Up @@ -989,5 +1030,6 @@ yamllint: ## [CI] YAML Linting / yamllint
website-markdown-lint \
website-misspell \
website-terrafmt \
website-terrafmt-fix \
website-tflint \
yamllint
Loading