2
2
timeout : 5m
3
3
tests : true
4
4
skip-dirs :
5
- - cmd/backfill_test
6
- - lib/sfxthrift/datamodelservice
7
5
- src/external_libs
6
+ - gocat
8
7
- genfiles$
9
8
- vendor$
9
+ - ketama
10
10
# which files to skip: they will be analyzed, but issues from them
11
11
# won't be reported. Default value is empty list, but there is
12
12
# no need to include all autogenerated files, we confidently recognize
13
13
# autogenerated files. If it's not please let us know.
14
14
skip-files :
15
15
- " .*\\ .pb\\ .go"
16
16
- " .*\\ .gen\\ .go"
17
- - " .*\\ .java "
17
+ - " .*_easyjson \\ .go "
18
18
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
19
19
# If invoked with -mod=readonly, the go command is disallowed from the implicit
20
20
# automatic updating of go.mod described above. Instead, it fails when any changes
@@ -41,6 +41,8 @@ linters-settings:
41
41
min-confidence : 0.3
42
42
gocyclo :
43
43
min-complexity : 10
44
+ gocognit :
45
+ min-complexity : 30
44
46
maligned :
45
47
suggest-new : true
46
48
gofmt :
@@ -50,10 +52,10 @@ linters-settings:
50
52
settings :
51
53
printf : # analyzer name, run `go tool vet help` to see all analyzers
52
54
funcs : # run `go tool vet help printf` to see available settings for `printf` analyzer
53
- - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
54
- - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
55
- - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
56
- - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
55
+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
56
+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
57
+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
58
+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
57
59
enabled-tags :
58
60
- performance
59
61
gocritic :
@@ -88,25 +90,118 @@ linters-settings:
88
90
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
89
91
# might be left in the code accidentally and should be resolved before merging
90
92
keywords : # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
91
- - OPTIMIZE # marks code that should be optimized before merging
92
- - HACK # marks hack-arounds that should be removed before merging
93
+ - OPTIMIZE # marks code that should be optimized before merging
94
+ - HACK # marks hack-arounds that should be removed before merging
93
95
funlen :
94
96
lines : 500 # TODO: need to set this to 150 statements and work on it
95
97
statements : 150
98
+ ifshort :
99
+ # Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
100
+ # Has higher priority than max-decl-chars.
101
+ max-decl-lines : 1
102
+ # Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
103
+ max-decl-chars : 30
104
+ cyclop :
105
+ # the maximal code complexity to report
106
+ max-complexity : 15
107
+ # should ignore tests (default false)
108
+ skip-tests : false
109
+ gosec :
110
+ # To select a subset of rules to run.
111
+ # Available rules: https://github.com/securego/gosec#available-rules
112
+ includes :
113
+ - G101 # Look for hard coded credentials
114
+ - G102 # Bind to all interfaces
115
+ - G106 # Audit the use of ssh.InsecureIgnoreHostKey
116
+ - G107 # Url provided to HTTP request as taint input
117
+ - G108 # Profiling endpoint automatically exposed on /debug/pprof
118
+ - G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32
119
+ - G110 # Potential DoS vulnerability via decompression bomb
120
+ - G306 # Poor file permissions used when writing to a new file
121
+ - G401 # Detect the usage of DES, RC4, MD5 or SHA1
122
+ - G501 # Import blocklist: crypto/md5
123
+ - G502 # Import blocklist: crypto/des
124
+ - G503 # Import blocklist: crypto/rc4
125
+ - G504 # Import blocklist: net/http/cgi
126
+ - G505 # Import blocklist: crypto/sha1
127
+ - G601 # Implicit memory aliasing of items from a range statement
128
+ # To specify a set of rules to explicitly exclude.
129
+ # Available rules: https://github.com/securego/gosec#available-rules
130
+ excludes :
131
+ - G204 # Audit use of command execution
132
+ # To specify the configuration of rules.
133
+ # The configuration of rules is not fully documented by gosec:
134
+ # https://github.com/securego/gosec#configuration
135
+ # https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102
136
+ config :
137
+ G306 : " 0600"
138
+ G101 :
139
+ pattern : " (?i)pwd|password|private_key|secret"
140
+ ignore_entropy : false
141
+ entropy_threshold : " 80.0"
142
+ per_char_threshold : " 3.0"
143
+ truncate : " 32"
144
+ staticcheck :
145
+ # Select the Go version to target. The default is '1.13'.
146
+ go : " 1.17"
147
+ # https://staticcheck.io/docs/options#checks
148
+ checks :
149
+ - " all"
150
+ - " -SA1029" # disable the check for using string in context value keys
151
+ - " -SA1019" # disable the check for net.Temporary as we use it still
152
+ dupl :
153
+ # tokens count to trigger issue, 150 by default
154
+ threshold : 100
96
155
97
156
linters :
98
- enable-all : true
99
- disable :
100
- - lll
101
- - gochecknoglobals
102
- - errcheck
103
- - unparam
157
+ disable-all : true
158
+ enable : # please use alphabetical order when enabling any linters
159
+ - asciicheck
160
+ - bodyclose
161
+ - cyclop
162
+ - deadcode
163
+ - depguard
164
+ - durationcheck
165
+ - errorlint
166
+ - errname
167
+ - exportloopref
168
+ - forbidigo
169
+ - gci
170
+ - gocognit
171
+ - goconst
172
+ - gocyclo
173
+ - godox
174
+ - gofmt
175
+ - gofumpt
176
+ - goheader
177
+ - goimports
178
+ - gomodguard
179
+ - goprintffuncname
104
180
- gosec
105
- - interfacer
106
- - dupl
107
- # TODO: need to enable this two for better coding guidelines in terms of space between condition
181
+ - gosimple
182
+ - govet
183
+ - ifshort
184
+ - ineffassign
185
+ - makezero
186
+ - megacheck
187
+ - misspell
188
+ - nakedret
189
+ - nilerr
190
+ - noctx
191
+ - prealloc
192
+ - predeclared
193
+ - revive
194
+ - staticcheck
195
+ - structcheck
196
+ - stylecheck
197
+ - testpackage
198
+ - thelper
199
+ - tparallel
200
+ - unconvert
201
+ - unparam
202
+ - unused
203
+ - wastedassign
108
204
- whitespace
109
- - wsl
110
205
fast : true
111
206
112
207
# output configuration options
0 commit comments