-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.golangci.yml
More file actions
173 lines (149 loc) · 3.26 KB
/
.golangci.yml
File metadata and controls
173 lines (149 loc) · 3.26 KB
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
# .golangci.yml
version: "2"
run:
timeout: 5m
tests: true
# Keep it simple: lint the whole module.
# If you need to exclude generated dirs, do it in exclusions.paths.
linters:
default: none
enable:
# correctness / bugs
- errcheck
- errorlint
- govet
- ineffassign
- staticcheck
- unused
- bodyclose
- copyloopvar
- intrange
- unconvert
- unparam
- noctx
# security
- gosec
# maintainability / readability
- revive
- gocritic
- gocyclo
- funlen
- dupl
- goconst
- misspell
- whitespace
- nolintlint
- godox
- lll
- dogsled
- nakedret
- testifylint
# numbers / magic constants (often noisy; keep, but tuned below)
- mnd
settings:
dupl:
threshold: 150
funlen:
# Lines are a poor signal; statements are a decent one.
lines: -1
statements: 50
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- performance
- style
# "opinionated" and "experimental" tend to create churn in most repos.
disabled-tags:
- opinionated
- experimental
disabled-checks:
- dupImport
- ifElseChain
- octalLiteral
- whyNoLint
gocyclo:
min-complexity: 20
godox:
keywords:
- FIXME
mnd:
checks:
- argument
- case
- condition
- return
ignored-numbers:
- "0"
- "1"
- "2"
- "3"
ignored-functions:
- strings.SplitN
- time.Duration
- time.Sleep
govet:
enable:
- nilness
- shadow
# Keep govet defaults + these; avoid repo-specific printf funcs unless needed.
errorlint:
asserts: false
lll:
line-length: 140
tab-width: 1
misspell:
locale: US
nolintlint:
allow-unused: false
require-explanation: true
require-specific: true
revive:
# A small, stable ruleset. Add more only when you actually want them enforced.
rules:
- name: indent-error-flow
- name: empty-lines
- name: unused-parameter
- name: unused-receiver
- name: early-return
- name: exported
disabled: true # too chatty unless your repo is strict about comments
exclusions:
presets:
- comments
- std-error-handling
- common-false-positives
- legacy
# NOTE: exclusions.paths are REGEX (not globs, not plain paths).
# Anchor them so you only exclude those directories.
paths:
- ^pkg/auth
- ^pkg/ethereum
- ^pkg/keys
- ^internal
rules:
- path: (.+)_test\.go$
linters: [dupl, funlen, gocyclo, mnd, lll]
- path: \.gen\.go$
linters: [revive, gocritic, goconst, gocyclo, funlen, lll, dupl, mnd]
formatters:
enable:
- gofmt
- goimports
settings:
gofmt:
rewrite-rules:
- pattern: "interface{}"
replacement: "any"
goimports:
local-prefixes:
- github.com/chainsafe/canton-middleware
exclusions:
# NOTE: these are REGEX patterns (not globs)
paths:
- ^pkg/auth
- ^pkg/ethereum
- ^pkg/keys
- ^internal