forked from improbable-eng/pre-commit-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-hooks.yaml
141 lines (129 loc) · 3.83 KB
/
.pre-commit-hooks.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
- id: check-proto # yamllint disable-line rule:indentation
name: check-proto
description: Run protolint against proto files, https://github.com/yoheimuta/protolint
entry: script/check-proto-with-protolint.sh
language: script
types:
- file
- text
files: \.proto$
- id: detect-tool-drift
name: detect-tool-drift
description: Detect whether the environment (tools, versions of those) matches what is expected.
entry: script/detect-tool-drift.sh
language: script
# The most likely reason for drift to occur is changes to the steps file which contains the docker images in which CI runs, which is what we're trying to detect drift against.
files: \.buildkite\.*steps\.yaml|tool-drift\.goss\.yaml
- id: dockerfile
name: dockerfile
description: Lints Dockerfiles with hadolint
entry: script/check-dockerfiles-with-hadolint.sh
language: script
types:
- file
- text
# no start/end ^$ because we may do different platforms' docker containers so the naming can vary.
files: Dockerfile
- id: go-format
name: go-format
description: Format golang source code
entry: script/go-format.sh
language: script
types:
- file
- text
files: \.go$
- id: go-generate
name: go-generate
description: Make sure go generate results in no diffs
entry: script/go-generate.sh
language: script
types:
- file
- text
files: \.go$
- id: go-mod-tidy
name: go-mod-tidy
description: Make go.mod/sum files be tidy of dependencies
entry: script/go-mod-tidy.sh
language: script
types:
- file
- text
files: go\.mod|sum$
# We repo-integrate instead of using https://github.com/golangci/golangci-lint/blob/master/.pre-commit-hooks.yaml
# because otherwise we need our pre-commit container to include build tools to support using go get. This would
# significantly increase the size/complexity/bloat of our pre-commit container.
- id: golangci-lint
name: golangci-lint
description: Run golangci-lint across our golang
entry: script/golangci-lint.sh
language: script
types:
- file
- text
pass_filenames: false
files: \.go$
- id: opa-fmt
name: opa/rego format
description: Format Open Policy Agent rego policy files
entry: script/opa-fmt.sh
language: script
types:
- file
- text
files: \.rego$
- id: opa-test
name: opa/rego tests
description: Run Open Policy Agent rego tests
entry: script/opa-test.sh
language: script
types:
- file
- text
pass_filenames: false # because it's really fast, just test the whole tree.
files: \.rego$
args:
- policy
- --explain=full
- --show-failure-line
# We use the prometheus operator, so unlikely to use this until/unless we extract the configuration from the operator to check it.
- id: prometheus_check_config
name: prometheus_check_config
description: Validates prometheus configuration
entry: script/check-prometheus-config.sh
language: script
types:
- file
- text
- yaml
files: prometheus.ya?ml$
- id: prometheus_check_rules
name: prometheus_check_rules
description: Validates prometheus rules
entry: script/check-prometheus-rules.sh
language: script
types:
- file
- text
- yaml
files: \.rules?\.ya?ml$
- id: prometheus_test_rules
name: prometheus_test_rules
description: Runs unit-tests against rules
entry: script/test-prometheus-rules.sh
language: script
types:
- file
- text
- yaml
files: \.rules?\.test\.ya?ml$
- id: dotnet-format
name: dotnet-format
description: Check C# source code
entry: script/check-dotnet-format.sh
language: script
types:
- c#
pass_filenames: false