-
Notifications
You must be signed in to change notification settings - Fork 2
/
.hookz.yaml
54 lines (54 loc) · 2.08 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.1
sources:
- source: github.com/anchore/syft/cmd/syft@latest
- source: github.com/devops-kung-fu/hinge@latest
- source: github.com/kisielk/errcheck@latest
- source: golang.org/x/lint/golint@latest
- source: github.com/fzipp/gocyclo/cmd/gocyclo@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: "golint: Lint all go files"
exec: golint
args: ["-set_exit_status", "./..."] #to error out, add the arg "-set_exit_status"
- name: "errcheck: Ensure that errors are checked"
exec: errcheck
args: ["-ignoretests", "./..."]
- name: "gocyclo: Check cyclomatic complexities"
exec: gocyclo
args: ["-over", "8", "."]
- 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: "syft: Generate a Software Bill of Materials (SBoM)"
exec: syft
args: [".","-o ","json=sbom/hinge.syft.json","-o", "spdx-json=sbom/hinge.spdx.json", "-o", "cyclonedx-json=sbom/hinge.cyclonedx.json"]
- 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..."]