-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (67 loc) · 1.89 KB
/
Makefile
File metadata and controls
75 lines (67 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.PHONY: test test-coverage view-coverage fmt fmt-check vet report-check
# Run tests
test:
go test -v ./...
# Run tests with coverage
test-coverage:
go test -coverprofile=coverage.out ./...
@echo "Coverage report generated: coverage.out"
@echo "To view the coverage report, run:"
@echo "make view-coverage"
# View coverage report in browser
view-coverage:
@echo "Opening coverage report in browser..."
@go tool cover -html=coverage.out -o coverage.html
@open coverage.html || xdg-open coverage.html || start coverage.html
fmt:
go fmt ./...
gofmt -s -w .
fmt-check:
@echo "Checking code formatting..."
@if [ "$$(gofmt -s -d . | wc -l)" -eq 0 ]; then \
echo "✓ All files are properly formatted"; \
else \
echo "✗ Some files need formatting:"; \
gofmt -s -d .; \
echo "Run 'make fmt' to fix formatting issues"; \
exit 1; \
fi
# Run go vet
vet:
go vet ./...
# Check for Go Report Card issues
report-check:
@echo "=== Go Report Card Quality Check ==="
@echo ""
@echo "1. Checking gofmt..."
@make fmt-check
@echo ""
@echo "2. Checking go vet..."
@go vet ./...
@echo "✓ go vet passed"
@echo ""
@echo "3. Checking gocyclo (if available)..."
@if command -v gocyclo >/dev/null 2>&1; then \
gocyclo -over 15 .; \
if [ $$? -eq 0 ]; then echo "✓ gocyclo passed"; fi; \
else \
echo "⚠ gocyclo not installed (optional)"; \
fi
@echo ""
@echo "4. Checking ineffassign (if available)..."
@if command -v ineffassign >/dev/null 2>&1; then \
ineffassign .; \
if [ $$? -eq 0 ]; then echo "✓ ineffassign passed"; fi; \
else \
echo "⚠ ineffassign not installed (optional)"; \
fi
@echo ""
@echo "5. Checking misspell (if available)..."
@if command -v misspell >/dev/null 2>&1; then \
misspell -error .; \
if [ $$? -eq 0 ]; then echo "✓ misspell passed"; fi; \
else \
echo "⚠ misspell not installed (optional)"; \
fi
@echo ""
@echo "✓ Go Report Card check completed!"