Skip to content

Commit 71c9fbf

Browse files
committed
golangci-lint migrate + cleanup
1 parent d27e172 commit 71c9fbf

File tree

1 file changed

+67
-76
lines changed

1 file changed

+67
-76
lines changed

.golangci.yml

Lines changed: 67 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# v1.64.6
1+
# v2.1.6
22
# Please don't remove the first line. It uses in CI to determine the golangci version
3+
version: "2"
34
linters:
4-
disable-all: true
5+
default: none
56
enable:
67
- asasalint
78
- asciicheck
@@ -27,13 +28,9 @@ linters:
2728
- gocognit
2829
- goconst
2930
- gocritic
30-
- gofmt
31-
- gofumpt
32-
- goimports
3331
- gomoddirectives
3432
- goprintffuncname
3533
- gosec
36-
- gosimple
3734
- govet
3835
- importas
3936
- ineffassign
@@ -52,88 +49,82 @@ linters:
5249
- prealloc
5350
- predeclared
5451
- promlinter
55-
- revive
5652
- reassign
53+
- revive
5754
- rowserrcheck
5855
- sqlclosecheck
5956
- staticcheck
60-
- stylecheck
6157
- tparallel
62-
- typecheck
6358
- unconvert
6459
- unparam
6560
- unused
6661
- usestdlibvars
6762
- usetesting
6863
- wastedassign
6964
- whitespace
70-
fast: false
71-
72-
run:
73-
timeout: 5m
74-
65+
settings:
66+
cyclop:
67+
max-complexity: 25
68+
dupl:
69+
threshold: 150
70+
exhaustive:
71+
default-signifies-exhaustive: true
72+
forbidigo:
73+
forbid:
74+
- pattern: ^(fmt\\.Print(|f|ln)|print|println)$
75+
- pattern: ^os\.(.*)$(# Using anything except Signal and SyscallError from the os package is forbidden )?
76+
- pattern: ^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?
77+
- pattern: ^logrus\.Logger$
78+
funlen:
79+
lines: 80
80+
statements: 60
81+
goconst:
82+
min-len: 10
83+
min-occurrences: 4
84+
usetesting:
85+
os-setenv: true
86+
exclusions:
87+
generated: lax
88+
rules:
89+
- linters:
90+
- canonicalheader
91+
- cyclop
92+
- dupl
93+
- forcetypeassert
94+
- funlen
95+
- gocognit
96+
- lll
97+
path: _(test|gen)\.go
98+
- linters:
99+
- contextcheck
100+
- revive
101+
path: js\/modules\/k6\/browser\/.*\.go
102+
- linters:
103+
- revive
104+
path: js\/modules\/k6\/html\/.*\.go
105+
text: 'exported: exported '
106+
- linters:
107+
- paralleltest
108+
- tparallel
109+
path: js\/modules\/k6\/http\/.*_test\.go
110+
- linters:
111+
- forbidigo
112+
text: use of `os\.(SyscallError|Signal|Interrupt)` forbidden
113+
paths:
114+
- third_party$
115+
- builtin$
116+
- examples$
75117
issues:
76-
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
77118
max-issues-per-linter: 0
78-
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
79119
max-same-issues: 0
80-
81-
# We want to try and improve the comments in the k6 codebase, so individual
82-
# non-golint items from the default exclusion list will gradually be added
83-
# to the exclude-rules below
84-
exclude-use-default: false
85-
86-
exclude-rules:
87-
# Exclude duplicate code and function length and complexity checking in test
88-
# files (due to common repeats and long functions in test code)
89-
- path: _(test|gen)\.go
90-
linters:
91-
- canonicalheader
92-
- cyclop
93-
- dupl
94-
- gocognit
95-
- funlen
96-
- lll
97-
- forcetypeassert
98-
- path: js\/modules\/k6\/browser\/.*\.go
99-
linters:
100-
- revive
101-
- contextcheck
102-
- path: js\/modules\/k6\/html\/.*\.go
103-
text: "exported: exported "
104-
linters:
105-
- revive
106-
- path: js\/modules\/k6\/http\/.*_test\.go
107-
linters:
108-
# k6/http module's tests are quite complex because they often have several nested levels.
109-
# The module is in maintenance mode, so we don't intend to port the tests to a parallel version.
110-
- paralleltest
111-
- tparallel
112-
- linters:
113-
- forbidigo
114-
text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden'
115-
116-
linters-settings:
117-
exhaustive:
118-
default-signifies-exhaustive: true
119-
cyclop:
120-
max-complexity: 25
121-
dupl:
122-
threshold: 150
123-
goconst:
124-
min-len: 10
125-
min-occurrences: 4
126-
funlen:
127-
lines: 80
128-
statements: 60
129-
forbidigo:
130-
forbid:
131-
- '^(fmt\\.Print(|f|ln)|print|println)$'
132-
# Forbid everything in os, except os.Signal and os.SyscalError
133-
- '^os\.(.*)$(# Using anything except Signal and SyscallError from the os package is forbidden )?'
134-
# Forbid everything in syscall except the uppercase constants
135-
- '^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?'
136-
- '^logrus\.Logger$'
137-
usetesting:
138-
os-setenv: true
139-
120+
formatters:
121+
enable:
122+
- gofmt
123+
- gofumpt
124+
- goimports
125+
exclusions:
126+
generated: lax
127+
paths:
128+
- third_party$
129+
- builtin$
130+
- examples$

0 commit comments

Comments
 (0)