-
Notifications
You must be signed in to change notification settings - Fork 95
/
.pre-commit-config.yaml
71 lines (65 loc) · 2.26 KB
/
.pre-commit-config.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
repos:
# First run code formatters
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace # trims trailing whitespace
exclude: "testdata"
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline
exclude_types: ["proto"]
exclude: "testdata"
- id: mixed-line-ending # ensures that a file doesn't contain a mix of LF and CRLF
- id: no-commit-to-branch # Protect specific branches (default: main/master) from direct checkins
- repo: https://github.com/ObolNetwork/go-pre-commit-hooks
rev: v0.0.3
hooks:
- id: check-go-version
args: [ -v=go1.23 ] # Only check minor version locally
pass_filenames: false
additional_dependencies: [ packaging ]
- id: check-licence-header
types: [ file, go ]
exclude: ".pb.go"
- repo: https://github.com/corverroos/fiximports
rev: 886071dd81a69ab030db85d65803fb2048aa0722
hooks:
- id: go-fiximports # format imports for go source files
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-beta.5 # cannot use master as it is a mutable reference and is not supported
hooks:
- id: go-mod-tidy
files: go.mod
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.4.0
hooks:
- id: go-fmt
args: [ -w, -s ] # simplify code and write result to (source) file instead of stdout
# Then run code validators (on the formatted code)
- repo: local
hooks:
- id: golangci-lint
name: golangci-lint
language: script
entry: .pre-commit/run_linter.sh
types: [ file, go ]
- id: run-go-tests
name: run-go-tests
language: script
entry: .pre-commit/run_tests.sh
types: [ file, go ]
- id: run-buf
name: run-buf
language: script
entry: .pre-commit/run_buf.sh
types: [ file, proto ]
- id: run-regexp
name: run-regexp
language: script
entry: .pre-commit/run_regexp.sh
types: [ file, go ]
exclude: "_test.go"
- id: run-testutil
name: run-testutil
language: script
entry: .pre-commit/run_testutil.sh
types: [ file, go ]