-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path.golangci.yml
More file actions
237 lines (235 loc) · 7.02 KB
/
.golangci.yml
File metadata and controls
237 lines (235 loc) · 7.02 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: "2"
linters:
enable:
- containedctx
- contextcheck
- depguard
- dupl
- errname
- errorlint
- fatcontext
- forcetypeassert
- ginkgolinter
- gocognit
- goconst
- gocritic
- godot
- gosec
- intrange
- ireturn
- lll
- maintidx
- mirror
- misspell
- nilerr
- nilnesserr
- nolintlint
- paralleltest
- prealloc
- promlinter
- revive
- rowserrcheck
- sqlclosecheck
- testifylint
- thelper
- unconvert
- unparam
- usetesting
- wastedassign
- whitespace
- goheader
# wrapcheck is not working as expected. It is categorizing internal packages as external.
#- wrapcheck
settings:
depguard:
rules:
main:
deny:
- pkg: github.com/pkg/errors
desc: github.com/pkg/errors is no longer maintained
staticcheck:
checks:
- all
- "-ST1000" # Disable ST1000: "should have a package comment"
errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
# Such cases aren't reported by default.
# Default: false
check-type-assertions: true
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors.
# See the https://github.com/polyfloyd/go-errorlint for caveats.
# Default: true
errorf: true
# Check for plain type assertions and type switches.
# Default: true
asserts: false
# Check for plain error comparisons.
# Default: true
comparison: true
fatcontext:
check-struct-pointers: true
gocognit:
min-complexity: 15
gosec:
excludes:
- G204
- G404
- G306
govet:
disable:
- fieldalignment
# Enable all analyzers.
# Default: false
enable-all: true
iface:
enable:
- identical # Identifies interfaces in the same package that have identical method sets.
- unused # Identifies interfaces that are not used anywhere in the same package where the interface is defined.
- opaque # Identifies functions that return interfaces, but the actual returned value is always a single concrete implementation.
ireturn:
# By default, it allows using errors, empty interfaces, anonymous interfaces,
# and interfaces provided by the standard library.
allow:
- error
- empty
- anon
- stdlib
- generic
- (or|er)$
- T
lll:
# Max line length, lines longer will be reported.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option.
# Default: 120.
line-length: 120
maintidx:
under: 20
nolintlint:
require-specific: true
revive:
enable-all-rules: true
rules:
- name: argument-limit
arguments:
- 4
- name: line-length-limit
arguments:
- 120
- name: file-header
disabled: true
- name: package-comments
disabled: true
- name: max-public-structs
disabled: true
- name: banned-characters
disabled: true
- name: cognitive-complexity
disabled: true
- name: cyclomatic
disabled: true
- name: function-length
disabled: true
- name: function-result-limit
arguments:
- 3
- name: add-constant
disabled: true
- name: unhandled-error
arguments:
- fmt.Printf
- fmt.Println
- strings.Builder.WriteString
- strings.Builder.WriteByte
- strings.Builder.Write
- name: confusing-naming
disabled: true
- name: comment-spacings
arguments:
- "nolint:"
rowserrcheck:
packages:
- github.com/jackc/pgx/v5
- github.com/jackc/pgx/v4
wrapcheck:
# An array of strings specifying additional substrings of signatures to ignore.
# Unlike 'ignoreSigs', this option extends the default set (or the set specified in 'ignoreSigs') without replacing it entirely.
# This allows you to add specific signatures to the ignore list
# while retaining the defaults or any items in 'ignoreSigs'.
# Default: []
extra-ignore-sigs:
- .CustomError(
- .SpecificWrap(
# An array of strings that specify substrings of signatures to ignore.
# If this set, it will override the default set of ignored signatures.
# See https://github.com/tomarrell/wrapcheck#configuration for more information.
# Default: [".Errorf(", "errors.New(", "errors.Unwrap(", "errors.Join(", ".Wrap(", ".Wrapf(", ".WithMessage(", ".WithMessagef(", ".WithStack("]
ignore-sigs:
- errors.New(
- errors.Newf(
- errors.Unwrap(
- errors.Join(
- .Wrap(
- .Wrapf(
- status.Error(
- .Wait() # The error reported by errorgroup.Wait() (external) actually
# originates from the internal code.
# An array of strings that specify regular expressions of signatures to ignore.
# Default: []
ignore-sig-regexps:
- \.New.*Error\(
# An array of strings that specify globs of packages to ignore.
# Default: []
ignore-package-globs: []
# An array of strings that specify regular expressions of interfaces to ignore.
# Default: []
# ignoreInterfaceRegexps:
# - ^(?i)c(?-i)ach(ing|e)
goheader:
template: |-
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
exclusions:
paths:
- protolator
# Mode of the generated files analysis.
#
# - `strict`: sources are excluded by strictly following the Go generated file convention.
# Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\.$`
# This line must appear before the first non-comment, non-blank text in the file.
# https://go.dev/s/generatedcode
# - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.
# - `disable`: disable the generated files exclusion.
#
# Default: lax
generated: strict
# Log a warning if an exclusion rule is unused.
# Default: false
warn-unused: true
# Predefined exclusion rules.
# Default: []
presets:
- common-false-positives
formatters:
enable:
- gofumpt
- goimports
settings:
gofumpt:
extra-rules: true
goimports:
# A comma-separated list of prefixes, which, if set, checks import paths
# with the given prefixes are grouped after 3rd-party packages.
# Default: ""
local-prefixes:
- github.com/hyperledger/fabric-x-common
exclusions:
generated: lax
sort-order:
- file # filepath, line, and column.
- severity
- linter