@@ -55,81 +55,21 @@ clean: ## Remove build artifacts
5555# CODE QUALITY
5656# ==============================================================================
5757
58- .PHONY : fmt
59- fmt : # # Format Go code
58+ .PHONY : format
59+ format : # # Format all code (Go, Terraform, modules, docs, lint fixes)
6060 go fmt ./...
6161 gofmt -s -w .
62-
63- .PHONY : fmt-check
64- fmt-check : # # Check Go code formatting (fails if not formatted)
65- @if [ -n " $$ (gofmt -l .)" ]; then \
66- echo " The following files are not formatted correctly:" ; \
67- gofmt -l . ; \
68- echo " " ; \
69- echo " Run 'make fmt' to fix." ; \
70- exit 1; \
71- fi
72-
73- .PHONY : fmt-tf
74- fmt-tf : # # Format Terraform example files
7562 terraform fmt -recursive examples/
76-
77- .PHONY : fmt-tf-check
78- fmt-tf-check : # # Check Terraform formatting (fails if not formatted)
79- @if ! terraform fmt -check -recursive examples/; then \
80- echo " " ; \
81- echo " Terraform files in examples/ are not formatted correctly." ; \
82- echo " Run 'make fmt-tf' to fix." ; \
83- exit 1; \
84- fi
85-
86- .PHONY : fmt-all
87- fmt-all : fmt fmt-tf # # Format all code (Go and Terraform)
63+ go mod tidy
64+ @command -v tfplugindocs > /dev/null 2>&1 || { echo " Installing tfplugindocs..." ; go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest; }
65+ tfplugindocs generate --provider-name ory
66+ @command -v golangci-lint > /dev/null 2>&1 || { echo " Installing golangci-lint..." ; go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; }
67+ golangci-lint run --fix ./... || true
8868
8969.PHONY : lint
90- lint : # # Run Go linter
70+ lint : # # Run Go linter (without fixes)
9171 golangci-lint run ./...
9272
93- .PHONY : lint-tf
94- lint-tf : fmt-tf-check # # Check Terraform formatting (alias for fmt-tf-check)
95-
96- .PHONY : vet
97- vet : # # Run go vet
98- go vet ./...
99-
100- .PHONY : generate
101- generate : # # Generate documentation and code
102- go generate ./...
103-
104- .PHONY : docs
105- docs : # # Generate Terraform documentation
106- @command -v tfplugindocs > /dev/null 2>&1 || { echo " Installing tfplugindocs..." ; go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest; }
107- tfplugindocs generate
108-
109- .PHONY : docs-check
110- docs-check : docs # # Check if documentation is up to date
111- @if ! git diff --exit-code docs/; then \
112- echo " Documentation is out of date. Run 'make docs' and commit the changes." ; \
113- exit 1; \
114- fi
115-
116- .PHONY : mod-tidy
117- mod-tidy : # # Tidy go modules
118- go mod tidy
119-
120- .PHONY : mod-check
121- mod-check : mod-tidy # # Check if go.mod/go.sum are up to date
122- @if ! git diff --exit-code go.mod go.sum; then \
123- echo " go.mod or go.sum is out of date. Run 'go mod tidy' and commit the changes." ; \
124- exit 1; \
125- fi
126-
127- .PHONY : check
128- check : fmt-all vet lint # # Format and run all code quality checks
129-
130- .PHONY : ci
131- ci : fmt-check fmt-tf-check lint mod-check docs-check # # Run all CI checks (matches GitHub Actions, fails on issues)
132-
13373# ==============================================================================
13474# TESTING
13575# ==============================================================================
0 commit comments