/
.golangci.yml
206 lines (185 loc) · 6.31 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
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
run:
go: 1.22
timeout: 5m
tests: false
linters:
enable-all: true
disable:
- execinquery # deprecated
- exhaustive
- exhaustruct
- gochecknoglobals
- gomnd # renamed to "mnd"
- nlreturn
- revive # need to turn this on one day...
- stylecheck # need to turn this on way day...
- varnamelen
- wrapcheck
- wsl
linters-settings:
cyclop:
max-complexity: 15 # the default of 10 was unnecessarily strict
depguard:
# Rules to apply.
#
# Variables:
# - File Variables
# you can still use and exclamation mark ! in front of a variable to say not to use it.
# Example !$test will match any file that is not a go test file.
#
# `$all` - matches all go files
# `$test` - matches all go test files
#
# - Package Variables
#
# `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
#
# Default: Only allow $gostd in all files.
rules:
# Name of a rule.
main:
# Used to determine the package matching priority.
# There are three different modes: `original`, `strict`, and `lax`.
# Default: "original"
# Original:
# Is the original way that the package was written to use. It is not recommended to stay with this and is only here for backwards compatibility.
# Strict:
# Is everything is denied unless in allowed.
# Lax:
# Is everything is allowed unless it is denied.
list-mode: strict
# List of file globs that will match this list of settings to compare against.
# Default: $all
files:
- $all
# List of allowed packages.
allow:
- $gostd
- github.com/aws
- github.com/caarlos0/env/v11
- github.com/cultureamp
- github.com/golang-jwt
- github.com/getsentry
- github.com/google
- github.com/golang-jwt
- github.com/go-errors
- github.com/launchdarkly
- github.com/lestrrat-go
- github.com/patrickmn/go-cache
- github.com/rs/zerolog
- github.com/sosodev/duration
- github.com/stoewer/go-strcase
- github.com/IBM/sarama
# these will be retired soon
- github.com/cenkalti/backoff
- github.com/xdg-go/scram
- github.com/segmentio
# Packages that are not allowed where the value is a suggestion.
deny:
- pkg: "github.com/sirupsen/logrus"
desc: not allowed
- pkg: "github.com/pkg/errors"
desc: Should be replaced by github.com/go-errors/errors package errors.Errorf("msg %v", err)
- pkg: "github.com/hashicorp"
desc: not allowed
- pkg: "github.com/kelseyhightower/envconfig"
desc: not allowed, instead use github.com/caarlos0/env/v11 for environment to struct
forbidigo:
# Forbid the following identifiers (list of regexp).
# Default: ["^(fmt\\.Print(|f|ln)|print|println)$"]
forbid:
- ^(fmt\\.Print(|f|ln)|print|println)$
# Exclude godoc examples from forbidigo checks.
# Default: true
exclude-godoc-examples: false
# Instead of matching the literal source code,
# use type information to replace expressions with strings that contain the package name
# and (for methods and fields) the type name.
# This makes it possible to handle import renaming and forbid struct fields and methods.
# Default: false
analyze-types: true
funlen:
lines: 140
statements: 60
tagliatelle:
# Check the struct tag name case.
case:
# Use the struct field name to check the name of the struct tag.
# Default: false
use-field-name: true
rules:
# Any struct tag type can be used.
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`.
#json: snake
#yaml: snake
#xml: snake
#toml: snake
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(gopkg.in) # Custom section: groups all imports with the specified Prefix.
- prefix(github.com)
- prefix(goa.design)
# - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
# - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
# Skip generated files.
# Default: true
#skip-generated: false
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
#custom-order: true
gosec:
# all rules enabled
# see also: https://securego.io/docs/rules/rule-intro.html
config:
global:
# allow #nosec override comments
nosec: enabled
# disable potentially noisy stricter audit mode
audit: enabled
G101: # "Look for hard coded credentials"
mode: strict
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: 140
# Tab width in spaces.
# Default: 1
tab-width: 1
issues:
exclude-dirs:
- kafkatest
exclude-rules:
# exluded rules from standard packages for reasons...
- path: log/logger.go
linters:
- zerologlint
- path: log/legacy_extensions.go
linters:
- lll
- tagliatelle
- path: jwt/decoder.go
linters:
- ireturn
- path: launchdarkly/*
linters:
- err113
- lll
- tagliatelle
- path: jwt/decoder.go
linters:
- ireturn
- path: jwt/decoder_jwks.go
linters:
- ireturn
- path: sentry/*
linters:
- lll