-
Notifications
You must be signed in to change notification settings - Fork 1
/
.hookz.yaml
54 lines (54 loc) · 2.01 KB
/
.hookz.yaml
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
version: 2.4.4
sources:
- source: github.com/devops-kung-fu/hinge@latest
- source: github.com/kisielk/errcheck@latest
- source: honnef.co/go/tools/cmd/staticcheck@latest
- source: github.com/fzipp/gocyclo/cmd/gocyclo@latest
- source: golang.org/x/vuln/cmd/govulncheck@latest
hooks:
- type: pre-commit
actions:
- name: "git: Pull (Ensure there are no upstream changes that are not local)"
exec: git
args: ["pull"]
- name: "go: Tidy mod file"
exec: go
args: ["mod", "tidy"]
- name: "go: Update all dependencies to latest"
exec: go
args: ["get", "-u", "./..."]
- name: "gofmt: Run gofmt to format the code"
exec: gofmt
args: ["-s", "-w", "**/*.go"]
# - name: "staticcheck: Lint all go files"
# exec: staticcheck
# args: ["-f", "stylish", "-checks", "all", "./..."] #to error out, add the arg "-set_exit_status"
- name: "errcheck: Ensure that errors are checked"
exec: errcheck
args: ["-ignoretests", "./..."]
- name: "govulncheck: Check for vulnerabilities"
exec: govulncheck
args: ["./..."]
- name: "gocyclo: Check cyclomatic complexities"
exec: gocyclo
args: ["-over", "9", "."]
- name: Hinge
exec: hinge
args: ["."]
- name: "go: Build (Ensure pulled modules do not break the build)"
exec: go
args: ["build", "-v", "./..."]
- name: "go: Run all tests"
exec: go
args: ["test", "-v", "-coverprofile=coverage.out", "./..."]
- name: "go: Test coverage"
exec: go
args: ["tool", "cover", "-func=coverage.out"]
- name: "git: Add all changed files during the pre-commit stage"
exec: git
args: ["add", "."]
- type: pre-push
actions:
- name: "hookz: example pre-push hook"
exec: /bin/echo
args: ["Pushing changes..."]