From 6b4951e86a269065c55ca50c4c9ee30b1954a9ec Mon Sep 17 00:00:00 2001 From: Evan Baker Date: Tue, 31 Aug 2021 17:13:32 -0500 Subject: [PATCH] lint pre-push hook --- .hooks/pre-push | 3 +++ Makefile | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 .hooks/pre-push diff --git a/.hooks/pre-push b/.hooks/pre-push new file mode 100755 index 0000000000..214306ef78 --- /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 a55619e40b..246b21ab26 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)