Skip to content

Commit 4d395b3

Browse files
author
Markus Schwer
committed
chore(lint): update golangci-lint to v2
1 parent 10eced4 commit 4d395b3

File tree

318 files changed

+6531
-1676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+6531
-1676
lines changed

golang-ci.yaml

Lines changed: 276 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,289 @@
1-
# This file contains all available configuration options
2-
# with their default values.
3-
4-
# options for analysis running
1+
version: "2"
52
run:
6-
# default concurrency is a available CPU number
7-
concurrency: 4
8-
9-
# timeout for analysis, e.g. 30s, 5m, default is 1m
10-
timeout: 5m
11-
linters-settings:
12-
goimports:
13-
# put imports beginning with prefix after 3rd-party packages;
14-
# it's a comma-separated list of prefixes
15-
local-prefixes: github.com/freiheit-com/nmww
16-
depguard:
17-
rules:
18-
main:
19-
list-mode: lax # Everything is allowed unless it is denied
20-
deny:
21-
- pkg: "github.com/stretchr/testify"
22-
desc: Do not use a testing framework
23-
misspell:
24-
# Correct spellings using locale preferences for US or UK.
25-
# Default is to use a neutral variety of English.
26-
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
27-
locale: US
28-
golint:
29-
min-confidence: 0.8
30-
gosec:
31-
excludes:
32-
# Suppressions: (see https://github.com/securego/gosec#available-rules for details)
33-
- G104 # "Audit errors not checked" -> which we don't need and is a badly implemented version of errcheck
34-
- G102 # "Bind to all interfaces" -> since this is normal in k8s
35-
- G304 # "File path provided as taint input" -> too many false positives
36-
- G307 # "Deferring unsafe method "Close" on type "io.ReadCloser" -> false positive when calling defer resp.Body.Close()
37-
nakedret:
38-
max-func-lines: 0
39-
revive:
40-
ignore-generated-header: true
41-
severity: error
42-
# https://github.com/mgechev/revive
43-
rules:
44-
- name: errorf
45-
- name: context-as-argument
46-
- name: error-return
47-
- name: increment-decrement
48-
- name: indent-error-flow
49-
- name: superfluous-else
50-
- name: unused-parameter
51-
- name: unreachable-code
52-
- name: atomic
53-
- name: empty-lines
54-
- name: early-return
55-
gocritic:
56-
enabled-tags:
57-
- performance
58-
- style
59-
- experimental
60-
disabled-checks:
61-
- wrapperFunc
62-
- typeDefFirst
63-
- ifElseChain
64-
- dupImport # https://github.com/go-critic/go-critic/issues/845
3+
build-tags:
4+
- integration
5+
issues-exit-code: 1
6+
tests: true
657
linters:
8+
default: none
669
enable:
67-
# https://golangci-lint.run/usage/linters/
68-
# default linters
69-
- gosimple
70-
- govet
71-
- ineffassign
72-
- staticcheck
73-
- typecheck
74-
- unused
75-
# additional linters
10+
- asciicheck
11+
- bodyclose
12+
- cyclop
13+
- depguard
14+
- dogsled
15+
- dupl
16+
- durationcheck
17+
- err113
18+
- errcheck
7619
- errorlint
20+
- exhaustive
21+
- forbidigo
22+
- forcetypeassert
23+
- funlen
24+
- gochecknoglobals
7725
- gochecknoinits
26+
- gocognit
27+
- goconst
7828
- gocritic
79-
- gofmt
80-
- goimports
29+
- gocyclo
30+
- godot
31+
- gomoddirectives
32+
- gomodguard
33+
- goprintffuncname
8134
- gosec
35+
- govet
36+
- importas
37+
- ineffassign
38+
- lll
39+
- makezero
8240
- misspell
41+
- mnd
8342
- nakedret
43+
- nestif
44+
- nilerr
45+
- nlreturn
46+
- noctx
47+
- nolintlint
48+
- prealloc
49+
- predeclared
50+
- promlinter
8451
- revive
85-
- depguard
86-
- bodyclose
52+
- rowserrcheck
53+
- sloglint
8754
- sqlclosecheck
55+
- staticcheck
56+
- tparallel
57+
- unconvert
58+
- unparam
59+
- unused
8860
- wastedassign
89-
- forcetypeassert
90-
- errcheck
91-
disable:
92-
- noctx # false positive: finds errors with http.NewRequest that dont make sense
93-
- unparam # false positives
61+
- whitespace
62+
- wsl
63+
settings:
64+
cyclop:
65+
max-complexity: 20
66+
package-average: 0
67+
depguard:
68+
rules:
69+
all:
70+
deny:
71+
- pkg: github.com/sirupsen/logrus
72+
desc: logging is done using the log/slog package
73+
- pkg: log$
74+
desc: logging is done using the log/slog package
75+
- pkg: go.uber.org/zap
76+
desc: logging is done using the log/slog package
77+
dogsled:
78+
max-blank-identifiers: 2
79+
dupl:
80+
threshold: 150
81+
errcheck:
82+
check-type-assertions: true
83+
check-blank: true
84+
exhaustive:
85+
default-signifies-exhaustive: true
86+
funlen:
87+
lines: 100
88+
statements: 50
89+
gocognit:
90+
min-complexity: 30
91+
goconst:
92+
min-len: 3
93+
min-occurrences: 2
94+
gocritic:
95+
disabled-checks:
96+
- dupImport
97+
- octalLiteral
98+
- unnamedResult
99+
enabled-tags:
100+
- diagnostic
101+
- experimental
102+
- opinionated
103+
- performance
104+
- style
105+
settings:
106+
hugeParam:
107+
sizeThreshold: 80
108+
gocyclo:
109+
min-complexity: 30
110+
govet:
111+
disable:
112+
- fieldalignment
113+
enable-all: true
114+
lll:
115+
line-length: 140
116+
tab-width: 1
117+
misspell:
118+
locale: US
119+
mnd:
120+
checks:
121+
- argument
122+
- case
123+
- condition
124+
- return
125+
nakedret:
126+
max-func-lines: 5
127+
nlreturn:
128+
block-size: 5
129+
nolintlint:
130+
require-explanation: true
131+
require-specific: true
132+
allow-unused: false
133+
prealloc:
134+
simple: true
135+
range-loops: true
136+
for-loops: true
137+
revive:
138+
rules:
139+
- name: context-keys-type
140+
disabled: false
141+
- name: time-naming
142+
disabled: false
143+
- name: var-declaration
144+
disabled: false
145+
- name: unexported-return
146+
disabled: false
147+
- name: errorf
148+
disabled: false
149+
- name: blank-imports
150+
disabled: false
151+
- name: context-as-argument
152+
disabled: false
153+
- name: dot-imports
154+
disabled: false
155+
- name: error-return
156+
disabled: false
157+
- name: error-strings
158+
disabled: false
159+
- name: error-naming
160+
disabled: false
161+
- name: exported
162+
disabled: false
163+
- name: increment-decrement
164+
disabled: false
165+
- name: var-naming
166+
disabled: false
167+
- name: package-comments
168+
disabled: false
169+
- name: range
170+
disabled: false
171+
- name: receiver-naming
172+
disabled: false
173+
- name: indent-error-flow
174+
disabled: false
175+
sloglint:
176+
no-mixed-args: true
177+
no-global: all
178+
context: scope
179+
static-msg: true
180+
forbidden-keys:
181+
- time
182+
- level
183+
- msg
184+
- source
185+
staticcheck:
186+
initialisms:
187+
- ACL
188+
- API
189+
- ASCII
190+
- CPU
191+
- CSS
192+
- DNS
193+
- EOF
194+
- GUID
195+
- HTML
196+
- HTTP
197+
- HTTPS
198+
- ID
199+
- IP
200+
- JSON
201+
- QPS
202+
- RAM
203+
- RPC
204+
- SLA
205+
- SMTP
206+
- SQL
207+
- SSH
208+
- TCP
209+
- TLS
210+
- TTL
211+
- UDP
212+
- UI
213+
- GID
214+
- UID
215+
- UUID
216+
- URI
217+
- URL
218+
- UTF8
219+
- VM
220+
- XML
221+
- XMPP
222+
- XSRF
223+
- XSS
224+
- SIP
225+
- RTP
226+
- AMQP
227+
- DB
228+
- TS
229+
unparam:
230+
check-exported: false
231+
unused:
232+
exported-fields-are-used: true
233+
whitespace:
234+
multi-if: false
235+
multi-func: false
236+
exclusions:
237+
generated: lax
238+
presets:
239+
- comments
240+
- common-false-positives
241+
- legacy
242+
- std-error-handling
243+
rules:
244+
- linters:
245+
- dogsled
246+
- dupl
247+
- err113
248+
- forcetypeassert
249+
- funlen
250+
- gochecknoglobals
251+
- goconst
252+
- mnd
253+
- noctx
254+
- unparam
255+
path: _test\.go
256+
- linters:
257+
- govet
258+
text: declaration of "err" shadows declaration
259+
paths:
260+
- third_party$
261+
- builtin$
262+
- examples$
94263
issues:
95-
exclude-use-default: false
264+
max-issues-per-linter: 0
265+
max-same-issues: 0
266+
formatters:
267+
enable:
268+
- gci
269+
- gofmt
270+
- gofumpt
271+
- goimports
272+
settings:
273+
gci:
274+
sections:
275+
- standard
276+
- default
277+
- prefix(dev.azure.com/schwarzit)
278+
custom-order: true
279+
gofmt:
280+
simplify: true
281+
goimports:
282+
local-prefixes:
283+
- dev.azure.com/schwarzit
284+
exclusions:
285+
generated: lax
286+
paths:
287+
- third_party$
288+
- builtin$
289+
- examples$

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import (
99
"github.com/stackitcloud/terraform-provider-stackit/stackit"
1010
)
1111

12-
var (
13-
// goreleaser configuration will override this value
14-
version string = "dev"
15-
)
12+
// goreleaser configuration will override this value.
13+
var version string = "dev"
1614

1715
func main() {
1816
var debug bool
17+
1918
flag.BoolVar(&debug, "debug", false, "allows debugging the provider")
2019
flag.Parse()
20+
2121
err := providerserver.Serve(context.Background(), stackit.New(version), providerserver.ServeOpts{
2222
Address: "registry.terraform.io/stackitcloud/stackit",
2323
Debug: debug,

0 commit comments

Comments
 (0)