forked from wormhole-foundation/wormhole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yml
159 lines (159 loc) · 4.79 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
version: "2"
linters:
default: none
enable:
# Malicious unicode characters that change the meaning are not in the source code.
- bidichk
# Ensure that the body is closed on HTTP and websocket conns
- bodyclose
- contextcheck
# Duplicate word usage, such as 'and and' in a comment.
- dupword
- errcheck
# Type assertion and comparison validation on errors. https://github.com/polyfloyd/go-errorlint
- errorlint
# Enum and maps used on switch statements are exhaustive
- exhaustive
- exhaustruct
- forcetypeassert
- gocritic
- gosec
- govet
- ineffassign
- loggercheck
# Check for simple misspellings of words.
- misspell
- noctx
# Require explanations for nolint comments
- nolintlint
- prealloc
# Overwriting predeclared Golang names such as 'len' and 'min'.
- predeclared
# Validate common mistakes in Golang, such as invalid time.Parse format, invalid regular expression, etc.
- staticcheck
- unparam
# Unused constants, variables, functions and types
- unused
settings:
errorlint:
errorf: false
exhaustive:
# Program elements to check for exhaustiveness.
# Default: [ switch ]
check:
- switch
- map
ignore-enum-types: "vaa.ChainID" # This type is used all over and doesn't need to be exhaustive
#default-signifies-exhaustive: true
exhaustruct:
include:
# List of regular expressions to match struct packages and their names.
# Regular expressions must match complete canonical struct package/name/structname.
# If this list is empty, all structs are tested.
# Default: []
- ./+governor.tokenConfigEntry$
- ./_common.MessagePublication$
exclude:
- .+/cobra\.Command$
- .+/http\.Client$
- .+/prometheus.+
gocritic:
disable-all: true
# disabled-checks:
# - exitAfterDefer
# - assignOp
# - ifElseChain
# - elseif
enabled-checks:
- argOrder
- badCall
- badCond
- badLock
- badRegexp
- badSorting
- builtinShadow
- builtinShadowDecl
- caseOrder
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- externalErrorReassign
- importShadow
- mapKey
- newDeref
- offBy1
- regexpPattern
- sloppyReassign
- truncateCmp
- uncheckedInlineErr
- weakCond
# performance lints
- indexAlloc
nolintlint:
# Disable to ensure that all nolint directives actually have an effect.
# Default: false
allow-unused: false
# Exclude following linters from requiring an explanation.
# Default: []
allow-no-explanation: [dupWord]
# Enable to require an explanation of nonzero length after each nolint directive.
# Default: false
require-explanation: true
# Enable to require nolint directives to mention the specific linter being suppressed.
# Default: false
require-specific: true
staticcheck:
checks:
# All of these lints should eventually be added.
# They occurred during the migration to v2 and were disabled to make the upgrade easier.
# https://golangci-lint.run/usage/linters/#staticcheck
["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-SA9003", "-QF1003", "-QF1006", "-QF1008", "-QF1011", "-S1009", "-ST1005", "-ST1008", "-ST1011", "-ST1017", "-ST1018", "-ST1019", "-ST1023"]
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- unused
path: pkg/supervisor/supervisor_testhelpers.go
text: ^func.*supervisor.*(waitSettle|waitSettleError).*$
# This file contains hard-coded Sui core contract addresses that are marked as hardcoded credentials.
- path: pkg/txverifier/sui_test.go
text: 'G101: Potential hardcoded credentials'
- linters:
- dupword
- misspell
path: .*generated_mainnet_tokens\.go$
text: ".*" # This matches any text in the file
- linters:
- godox
path: node/hack/
# Ignore test files for these tools.
- linters:
- contextcheck
- dupWord
- exhaustruct
- nolintlint
path: _test\.go
- linters:
- exhaustruct
path: (?i).*mock.*
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$