forked from lightningnetwork/lnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
171 lines (149 loc) · 3.65 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
run:
# timeout for analysis
deadline: 10m
# Skip autogenerated files for mobile and gRPC.
skip-files:
- "mobile\\/.*generated\\.go"
- "\\.pb\\.go$"
- "\\.pb\\.gw\\.go$"
skip-dirs:
- channeldb/migration_01_to_11
- channeldb/migration/lnwire21
build-tags:
- autopilotrpc
- chainrpc
- dev
- invoicesrpc
- neutrinorpc
- peersrpc
- signrpc
- walletrpc
- watchtowerrpc
- kvdb_etcd
- kvdb_postgres
linters-settings:
govet:
# Don't report about shadowed variables
check-shadowing: false
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
tagliatelle:
case:
rules:
json: snake
whitespace:
multi-func: true
multi-if: true
gosec:
excludes:
- G402 # Look for bad TLS connection settings.
- G306 # Poor file permissions used when writing to a new file.
staticcheck:
go: "1.18"
checks: ["-SA1019"]
linters:
enable-all: true
disable:
# Global variables are used in many places throughout the code base.
- gochecknoglobals
# Some lines are over 80 characters on purpose and we don't want to make them
# even longer by marking them as 'nolint'.
- lll
# We want to allow short variable names.
- varnamelen
# We want to allow TODOs.
- godox
# We have long functions, especially in tests. Moving or renaming those would
# trigger funlen problems that we may not want to solve at that time.
- funlen
# Disable for now as we haven't yet tuned the sensitivity to our codebase
# yet. Enabling by default for example, would also force new contributors to
# potentially extensively refactor code, when they want to smaller change to
# land.
- gocyclo
- gocognit
- cyclop
# Instances of table driven tests that don't pre-allocate shouldn't trigger
# the linter.
- prealloc
# Init functions are used by loggers throughout the codebase.
- gochecknoinits
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
- errorlint
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
- interfacer
- golint
- maligned
- scopelint
# New linters that need a code adjustment first.
- wrapcheck
- nolintlint
- paralleltest
- tparallel
- testpackage
- gofumpt
- gomoddirectives
- ireturn
- maintidx
- nlreturn
- dogsled
- gci
- containedctx
- contextcheck
- errname
- exhaustivestruct
- goerr113
- gomnd
- ifshort
- noctx
- nestif
- wsl
- exhaustive
- forcetypeassert
- nilerr
- nilnil
- stylecheck
- thelper
issues:
# Only show newly introduced problems.
new-from-rev: 01f696afce2f9c0d4ed854edefa3846891d01d8a
exclude-rules:
# Exclude gosec from running for tests so that tests with weak randomness
# (math/rand) will pass the linter.
- path: _test\.go
linters:
- gosec
- path: test*
linters:
- gosec
# Allow duplicated code and fmt.Printf() in DB migrations.
- path: channeldb/migration*
linters:
- dupl
- forbidigo
- godot
# Allow duplicated code and fmt.Printf() in DB migration tests.
- path: channeldb/migtest
linters:
- dupl
- forbidigo
- godot
# Allow fmt.Printf() in lncli.
- path: cmd/lncli/*
linters:
- forbidigo
# Allow fmt.Printf() in config parsing.
- path: config\.go
linters:
- forbidigo
- path: lnd\.go
linters:
- forbidigo
# Fix false positives because of build flags in itest directory.
- path: lntest/itest/.*
linters:
- unused
- deadcode
- unparam
- govet