This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
77 lines (56 loc) · 1.8 KB
/
Makefile
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
76
77
.PHONY: help clean build fmt lint vet run test style cyclo
SOURCES:=$(shell find . -name '*.go')
DOCFILES:=$(addprefix docs/packages/, $(addsuffix .html, $(basename ${SOURCES})))
default: build
clean: ## Run go clean
@go clean
build: ## Run go build
@go build
fmt: ## Run go fmt -w for all sources
@echo "Running go formatting"
./gofmt.sh
lint: ## Run golint
@echo "Running go lint"
./golint.sh
vet: ## Run go vet. Report likely mistakes in source code
@echo "Running go vet"
./govet.sh
cyclo: ## Run gocyclo
@echo "Running gocyclo"
./gocyclo.sh
ineffassign: ## Run ineffassign checker
@echo "Running ineffassign checker"
./ineffassign.sh
shellcheck: ## Run shellcheck
shellcheck *.sh
errcheck: ## Run errcheck
@echo "Running errcheck"
./goerrcheck.sh
gosec: ## Run gosec checker
@echo "Running gosec checker"
./gosec.sh
abcgo: ## Run ABC metrics checker
@echo "Run ABC metrics checker"
./abcgo.sh
style: fmt vet lint cyclo shellcheck errcheck gosec ineffassign abcgo ## Run all the formatting related commands (fmt, vet, lint, cyclo)
run: clean build ## Build the project and executes the binary
./insights-operator-controller
test: clean build ## Run the unit tests
@go test -coverprofile coverage.out $(shell go list ./... | grep -v tests)
license:
GO111MODULE=off go get -u github.com/google/addlicense && \
addlicense -c "Red Hat, Inc" -l "apache" -v ./
before_commit: style test integration_tests license
./check_coverage.sh
help: ## Show this help screen
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
@echo 'Available targets are:'
@echo ''
@grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo ''
docs/packages/%.html: %.go
mkdir -p $(dir $@)
docgo -outdir $(dir $@) $^
godoc: ${DOCFILES}