Skip to content

Commit 7fbbd1e

Browse files
authored
lint pre-push hook (#1112)
1 parent 22906eb commit 7fbbd1e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.hooks/pre-push

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
cd $(git rev-parse --show-toplevel)
3+
make lint

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-include setup
2+
13
# Default platform commands
24
SHELL=/bin/bash
35
MKDIR := mkdir -p
@@ -356,7 +358,7 @@ lint-old: $(GOLANGCI_LINT) ## Fast lint including previous issues
356358

357359
FMT_PKG ?= cni cns npm
358360

359-
fmt format: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm")
361+
fmt: $(GOFUMPT) ## run gofumpt on $FMT_PKG (default "cni cns npm")
360362
$(GOFUMPT) -s -w $(FMT_PKG)
361363

362364
COVER_PKG ?= .
@@ -383,6 +385,16 @@ test-cyclonus:
383385
kind:
384386
kind create cluster --config ./test/kind/kind.yaml
385387

388+
##@ Utilities
389+
390+
$(REPO_ROOT)/.git/hooks/pre-push:
391+
@ln -s $(REPO_ROOT)/.hooks/pre-push $(REPO_ROOT)/.git/hooks/
392+
@echo installed pre-push hook
393+
394+
install-hooks: $(REPO_ROOT)/.git/hooks/pre-push ## installs git hooks
395+
396+
setup: install-hooks ## performs common required repo setup
397+
386398
version: ## prints the version
387399
@echo $(VERSION)
388400

0 commit comments

Comments
 (0)