Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run pre-commit with make #139

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@ repos:

- repo: local
hooks:
- id: golangci-lint
name: golangci-lint
language: golang
types: [go]
entry: make
args: ["golangci-lint"]
pass_filenames: false
- id: gofmt
name: gofmt
language: system
entry: make
args: ["fmt"]
pass_filenames: false
- id: govet
name: govet
language: system
entry: make
args: ["vet"]
pass_filenames: false
- id: gotidy
name: gotidy
language: system
entry: make
args: ["tidy"]
pass_filenames: false
- id: make-manifests
name: make-manifests
language: system
Expand Down Expand Up @@ -60,4 +85,4 @@ repos:
rev: 2.1.1
hooks:
- id: bashate
entry: bashate --error . --ignore=E006,E040,E043
entry: bashate --error . --ignore=E006,E040,E011,E020,E012
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ vet: gowork ## Run go vet against code.
go vet ./...
go vet ./api/...

.PHONY: tidy
go mod tidy

.PHONY: golangci-lint
golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.2
$(LOCALBIN)/golangci-lint run --fix

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... ./api/... -coverprofile cover.out
Expand Down