diff --git a/.hooks/pre-push b/.hooks/pre-push new file mode 100755 index 000000000..214306ef7 --- /dev/null +++ b/.hooks/pre-push @@ -0,0 +1,3 @@ +#!/bin/bash +cd $(git rev-parse --show-toplevel) +make lint diff --git a/Makefile b/Makefile index a55619e40..246b21ab2 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +-include setup + # Default platform commands SHELL=/bin/bash MKDIR := mkdir -p @@ -356,7 +358,7 @@ lint-old: $(GOLANGCI_LINT) ## Fast lint including previous issues FMT_PKG ?= cni cns npm -fmt format: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm") +fmt: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm") $(GOFUMPT) -s -w $(FMT_PKG) COVER_PKG ?= . @@ -383,6 +385,16 @@ test-cyclonus: kind: kind create cluster --config ./test/kind/kind.yaml +##@ Utilities + +$(REPO_ROOT)/.git/hooks/pre-push: + @ln -s $(REPO_ROOT)/.hooks/pre-push $(REPO_ROOT)/.git/hooks/ + @echo installed pre-push hook + +install-hooks: $(REPO_ROOT)/.git/hooks/pre-push ## installs git hooks + +setup: install-hooks ## performs common required repo setup + version: ## prints the version @echo $(VERSION)