-
Notifications
You must be signed in to change notification settings - Fork 92
/
.golangci.yml
187 lines (185 loc) · 5.16 KB
/
.golangci.yml
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
run:
timeout: 5m
go: "1.23"
linters-settings:
cyclop:
max-complexity: 15
skip-tests: true
dupl:
# tokens count to trigger issue, 150 by default
threshold: 400
depguard:
rules:
main:
deny:
- pkg: "github.com/pkg/errors"
desc: Prefer ./app/errors
- pkg: "github.com/golang/protobuf"
desc: Prefer google.golang.org/protobuf
- pkg: "github.com/gogo/protobuf/proto"
desc: Prefer google.golang.org/protobuf
exhaustive:
default-signifies-exhaustive: true
forbidigo:
forbid:
- 'fmt\.Print.*(# Avoid debug logging)?'
- 'fmt\.Errorf.*(# Prefer app/errors.Wrap)?'
gci:
sections:
- prefix(github.com/obolnetwork/charon)
gocritic:
disabled-checks:
- ifElseChain
govet:
enable-all: true
disable:
- fieldalignment
- shadow
importas:
no-unaliased: true
alias:
- pkg: github.com/attestantio/go-eth2-client/spec/phase0
alias: eth2p0
- pkg: github.com/attestantio/go-eth2-client/api/v1
alias: eth2v1
- pkg: github.com/attestantio/go-eth2-client/api
alias: eth2api
- pkg: github.com/attestantio/go-eth2-client/spec
alias: eth2spec
- pkg: github.com/attestantio/go-eth2-client/http
alias: eth2http
- pkg: github.com/attestantio/go-eth2-client/mock
alias: eth2mock
- pkg: github.com/attestantio/go-eth2-client/api/v1/bellatrix
alias: eth2bellatrix
- pkg: github.com/attestantio/go-eth2-client/api/v1/capella
alias: eth2capella
- pkg: github.com/decred/dcrd/dcrec/secp256k1/v4
alias: k1
- pkg: github.com/obolnetwork/charon/cluster/manifestpb/v1
alias: manifestpb
nlreturn:
block-size: 2
revive:
enable-all-rules: true
severity: warning
rules:
# Disabled revive rules
- name: banned-characters
disabled: true
- name: add-constant
disabled: true
- name: file-header
disabled: true
- name: function-result-limit
disabled: true
- name: cyclomatic
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: argument-limit
disabled: true
- name: function-length
disabled: true
- name: cognitive-complexity
disabled: true
- name: comment-spacings
disabled: true # Doesn't support latest go spec comments
- name: range-val-address
disabled: true # It is not an issue for go versions >=1.22
# Some configured revive rules
- name: unhandled-error
arguments:
- 'fmt.Printf'
- 'fmt.Println'
- name: imports-blacklist
arguments:
- "errors" # Prefer ./app/errors
- "github.com/pkg/errors" # Prefer ./app/errors
- "github.com/golang/protobuf" # Prefer google.golang.org/protobuf
- "github.com/gogo/protobuf/proto" # Prefer google.golang.org/protobuf
- "github.com/prometheus/client_golang/prometheus/promauto" # Prefer ./app/promauto
staticcheck:
checks:
- "all"
- "-SA1019" # Ignoring since github.com/drand/kyber/sign/bls uses Proof Of Possession as does Ethereum.
testpackage:
skip-regexp: internal_test\.go
wrapcheck:
ignoreSigs:
- github.com/obolnetwork/charon/
- github.com/attestantio/go-eth2-client
testifylint:
disable:
- expected-actual
go-require:
ignore-http-handlers: true
gosec:
excludes:
# Flags for potentially-unsafe casting of ints, seems good,
# but currently is really unstable with no clear way to make the linter pass.
# https://github.com/securego/gosec/issues/1187
- G115
issues:
fix: true
max-same-issues: 0
max-issues-per-linter: 0
exclude-rules:
- path: '(.+)_test\.go'
linters:
- bodyclose
- gosec
- noctx
- revive
- path: 'eth2wrap'
linters:
- importas
exclude:
- "error returned from interface method should be wrapped" # Relax wrapcheck
- "defer: prefer not to defer chains of function calls" # Relax revive
- "avoid control coupling" # Relax revive
- "shadows an import name" # Relax revive
- "confusing-naming" # Relax revive
- "nested-structs" # Relax revive
- "0xhex" # Relax revive and staticcheck about our custom struct tag
- "shadow: declaration of \"err\" shadows declaration" # Relax govet
linters:
enable-all: true
disable:
# Keep disabled
- intrange
- containedctx
- contextcheck
- cyclop
- exhaustruct
- exportloopref # It is not an issue for go versions >=1.22
- funlen
- forcetypeassert
- gci
- gochecknoglobals
- gocognit
- gocyclo
- godot
- godox
- gomnd
- gomoddirectives
- inamedparam
- interfacebloat
- ireturn
- lll # Think about adding this (max line length)
- maintidx
- mnd
- musttag
- nestif
- nonamedreturns
- paralleltest
- prealloc
- recvcheck # triggers a lot of false positives
- tagliatelle
- varnamelen
- wsl
# Deprecated
- goerr113
- execinquery