generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.golangci.yml
186 lines (186 loc) · 5.23 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
version: "2"
run:
tests: true
timeout: 5m
output:
formats:
text:
print-issued-lines: false
colors: true
linters:
default: all
disable:
- containedctx
- contextcheck
- cyclop
- dogsled
- dupl
- dupword
- err113
- errchkjson
- exhaustruct
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocyclo
- godot
- godox
- gomoddirectives
- goprintffuncname
- interfacebloat
- ireturn
- lll
- mnd
- musttag
- nestif
- nilerr
- nilnil
- nlreturn
- nolintlint
- nonamedreturns
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- protogetter
- recvcheck
- rowserrcheck
- sqlclosecheck
- tagalign
- tagliatelle
- testpackage
- thelper
- varnamelen
- wastedassign
- whitespace
- wsl
settings:
depguard:
rules:
main:
deny:
- pkg: github.com/pkg/errors
desc: use fmt.Errorf or errors.New
- pkg: github.com/stretchr/testify
desc: use github.com/alecthomas/assert/v2
- pkg: github.com/alecthomas/errors
desc: use fmt.Errorf or errors.New
- pkg: braces.dev/errtrace
desc: use fmt.Errorf or errors.New
- pkg: os/exec
desc: use github.com/block/ftl/internal/exec
- pkg: golang.design/x/reflect
desc: use github.com/block/ftl/common/reflect
- pkg: github.com/reugn/go-quartz/logger
desc: use github.com/block/ftl/internal/log
dupl:
threshold: 100
errcheck:
check-blank: true
exhaustive:
default-signifies-exhaustive: true
forbidigo:
forbid:
- pattern: ^context.WithCancel$
msg: use context.WithCancelCause instead of context.WithCancel
- pattern: ^context.CancelFunc$
msg: use context.WithCancelCause instead of context.WithCancel
- pattern: log.Logger.Infof
msg: Infof should only be used for user-facing messages, use //nolint to suppress
exclude-godoc-examples: true
analyze-types: true
goconst:
min-len: 8
min-occurrences: 3
gocritic:
disabled-checks:
- ifElseChain
gocyclo:
min-complexity: 20
govet:
enable:
- shadow
spancheck:
extra-start-span-signatures:
- github.com/block/ftl/backend/controller/observability.BeginSpan:opentelemetry
# exhaustruct:
# include:
# - '^github.com/block/ftl/common/schema\.Module$'
exclusions:
generated: lax
rules:
- path: (.+)\.go$
text: "^(G104|G204):"
- path: (.+)\.go$
text: Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*Print(f|ln|)|os\.(Un)?Setenv). is not checked
- path: (.+)\.go$
text: "internal error: no range for"
- path: (.+)\.go$
text: exported method `.*\.(MarshalJSON|UnmarshalJSON|URN|Payload|GoString|Close|Provides|Requires|ExcludeFromHash|MarshalText|UnmarshalText|Description|Check|Poll|Severity)` should have comment or be unexported
- path: (.+)\.go$
text: composite literal uses unkeyed fields
- path: (.+)\.go$
text: declaration of "err" shadows declaration
- path: (.+)\.go$
text: by other packages, and that stutters
- path: (.+)\.go$
text: Potential file inclusion via variable
- path: (.+)\.go$
text: at least one file in a package should have a package comment
- path: (.+)\.go$
text: bad syntax for struct tag pair
- path: (.+)\.go$
text: should have comment or be unexported
- path: (.+)\.go$
text: package-comments
- path: (.+)\.go$
text: parameter testing.TB should have name tb
- path: (.+)\.go$
text: blank-imports
- path: (.+)\.go$
text: should have comment \(or a comment on this block\) or be unexported
- path: (.+)\.go$
text: caseOrder
- path: (.+)\.go$
text: unused-parameter
- path: (.+)\.go$
text: "^loopclosure:"
- path: (.+)\.go$
text: 'shadow: declaration of "ctx" shadows declaration at'
- path: (.+)\.go$
text: 'shadow: declaration of "ok" shadows declaration'
- path: (.+)\.go$
text: "^dot-imports:"
- path: (.+)\.go$
text: fmt.Errorf can be replaced with errors.New
- path: (.+)\.go$
text: fmt.Sprintf can be replaced with string concatenation
- path: (.+)\.go$
text: strings.Title has been deprecated
- path: (.+)\.go$
text: error returned from external package is unwrapped.*TranslatePGError
- path: (.+)\.go$
text: struct literal uses unkeyed fields
- path: (.+)\.go$
text: "exported: comment on exported type"
- path: (.+)\.go$
text: result .* \(error\) is always nil
paths:
- cmd/protopkg/main.go
- resources
- old
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$