Skip to content

Commit 8869ee6

Browse files
chore: upgrade golangci/golangci-lint-action from 6.5.2 to 7.0.0
1 parent 88f2a5b commit 8869ee6

File tree

8 files changed

+271
-132
lines changed

8 files changed

+271
-132
lines changed

tools/cli/.golangci.bck.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# TO BE REMOVED IN https://jira.mongodb.org/browse/CLOUDP-308470
2+
3+
linters-settings:
4+
gocritic:
5+
enabled-tags:
6+
- diagnostic
7+
- experimental
8+
- opinionated
9+
- performance
10+
- style
11+
govet:
12+
enable:
13+
- shadow
14+
15+
revive:
16+
# see https://github.com/mgechev/revive#available-rules for details.
17+
ignore-generated-header: true
18+
severity: warning
19+
rules:
20+
- name: blank-imports
21+
- name: context-as-argument
22+
- name: context-keys-type
23+
- name: defer
24+
- name: dot-imports
25+
- name: error-return
26+
- name: error-strings
27+
- name: error-naming
28+
- name: early-return
29+
- name: errorf
30+
- name: exported
31+
- name: import-shadowing
32+
- name: indent-error-flow
33+
- name: if-return
34+
- name: increment-decrement
35+
- name: var-naming
36+
- name: var-declaration
37+
- name: package-comments
38+
- name: range
39+
- name: receiver-naming
40+
- name: time-naming
41+
- name: unexported-return
42+
- name: indent-error-flow
43+
- name: errorf
44+
- name: empty-block
45+
- name: superfluous-else
46+
- name: struct-tag
47+
- name: unused-parameter
48+
- name: unreachable-code
49+
- name: redefines-builtin-id
50+
- name: unused-receiver
51+
- name: constant-logical-expr
52+
- name: confusing-naming
53+
- name: unnecessary-stmt
54+
- name: use-any
55+
- name: imports-blocklist
56+
arguments:
57+
- "github.com/pkg/errors"
58+
misspell:
59+
locale: US
60+
lll:
61+
line-length: 150
62+
nestif:
63+
# minimal complexity of if statements to report, 5 by default
64+
min-complexity: 7
65+
funlen:
66+
lines: 360
67+
statements: 120
68+
gci:
69+
sections:
70+
- standard
71+
- default
72+
linters:
73+
disable-all: true
74+
enable:
75+
- copyloopvar # copyloopvar is a linter detects places where loop variables are copied
76+
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
77+
- errcheck # errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases
78+
- errorlint # Errorlint is a linter that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
79+
- exhaustive # check exhaustiveness of enum switch statements
80+
- copyloopvar # copyloopvar is a linter detects places where loop variables are copied. Replaces exportloopref since Go1.22
81+
- funlen # Tool for detection of long functions
82+
- gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false]
83+
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
84+
- godot # Check if comments end in a period [fast: true, auto-fix: true]
85+
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
86+
- goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode.
87+
- goprintffuncname # Checks that printf-like functions are named with `f` at the end.
88+
- gosec # Inspects source code for security problems
89+
- gosimple # Linter for Go source code that specializes in simplifying code
90+
- govet # Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes.
91+
- ineffassign # Detects when assignments to existing variables are not used
92+
- lll # Reports long lines
93+
- makezero # Finds slice declarations with non-zero initial length
94+
- misspell # Finds commonly misspelled English words
95+
- nakedret # Checks that functions with naked returns are not longer than a maximum size (can be zero).
96+
- noctx # Finds sending http request without context.Context
97+
- nolintlint # Reports ill-formed or insufficient nolint directives
98+
- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative.
99+
- prealloc # Finds slice declarations that could potentially be pre-allocated
100+
- predeclared # find code that shadows one of Go's predeclared identifiers
101+
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
102+
- rowserrcheck # checks whether Rows.Err of rows is checked successfully
103+
- staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.
104+
- stylecheck # Stylecheck is a replacement for golint
105+
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
106+
- testifylint # Checks usage of github.com/stretchr/testify.
107+
- thelper # thelper detects tests helpers which is not start with t.Helper() method.
108+
- unconvert # Remove unnecessary type conversions
109+
- unused # Checks Go code for unused constants, variables, functions and types
110+
- whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc.
111+
112+
# don't enable:
113+
# - deadcode
114+
# - varcheck
115+
# - structcheck
116+
# - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
117+
# - gocyclo # we already have funlen lint
118+
# - dupl # we have a lot of duplicate test cases
119+
# - gochecknoinits # we need the init function for the provider
120+
# - gochecknoglobals # we need some global variables
121+
# - unparam # Forces to create global variables when one variable is repeated in different functions
122+
# - goerr113 # It does not allow you to return an error, you need to save the error in a variable to do it
123+
# - goconst
124+
# - gocognit
125+
126+
run:
127+
timeout: 10m
128+
tests: true
129+
modules-download-mode: readonly

tools/cli/.golangci.yml

Lines changed: 135 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,137 @@
1-
linters-settings:
2-
gocritic:
3-
enabled-tags:
4-
- diagnostic
5-
- experimental
6-
- opinionated
7-
- performance
8-
- style
9-
govet:
10-
enable:
11-
- shadow
12-
13-
revive:
14-
# see https://github.com/mgechev/revive#available-rules for details.
15-
ignore-generated-header: true
16-
severity: warning
17-
rules:
18-
- name: blank-imports
19-
- name: context-as-argument
20-
- name: context-keys-type
21-
- name: defer
22-
- name: dot-imports
23-
- name: error-return
24-
- name: error-strings
25-
- name: error-naming
26-
- name: early-return
27-
- name: errorf
28-
- name: exported
29-
- name: import-shadowing
30-
- name: indent-error-flow
31-
- name: if-return
32-
- name: increment-decrement
33-
- name: var-naming
34-
- name: var-declaration
35-
- name: package-comments
36-
- name: range
37-
- name: receiver-naming
38-
- name: time-naming
39-
- name: unexported-return
40-
- name: indent-error-flow
41-
- name: errorf
42-
- name: empty-block
43-
- name: superfluous-else
44-
- name: struct-tag
45-
- name: unused-parameter
46-
- name: unreachable-code
47-
- name: redefines-builtin-id
48-
- name: unused-receiver
49-
- name: constant-logical-expr
50-
- name: confusing-naming
51-
- name: unnecessary-stmt
52-
- name: use-any
53-
- name: imports-blocklist
54-
arguments:
55-
- "github.com/pkg/errors"
56-
misspell:
57-
locale: US
58-
lll:
59-
line-length: 150
60-
nestif:
61-
# minimal complexity of if statements to report, 5 by default
62-
min-complexity: 7
63-
funlen:
64-
lines: 360
65-
statements: 120
66-
gci:
67-
sections:
68-
- standard
69-
- default
70-
linters:
71-
disable-all: true
72-
enable:
73-
- copyloopvar # copyloopvar is a linter detects places where loop variables are copied
74-
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
75-
- errcheck # errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases
76-
- errorlint # Errorlint is a linter that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
77-
- exhaustive # check exhaustiveness of enum switch statements
78-
- copyloopvar # copyloopvar is a linter detects places where loop variables are copied. Replaces exportloopref since Go1.22
79-
- funlen # Tool for detection of long functions
80-
- gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false]
81-
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
82-
- godot # Check if comments end in a period [fast: true, auto-fix: true]
83-
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
84-
- goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode.
85-
- goprintffuncname # Checks that printf-like functions are named with `f` at the end.
86-
- gosec # Inspects source code for security problems
87-
- gosimple # Linter for Go source code that specializes in simplifying code
88-
- govet # Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes.
89-
- ineffassign # Detects when assignments to existing variables are not used
90-
- lll # Reports long lines
91-
- makezero # Finds slice declarations with non-zero initial length
92-
- misspell # Finds commonly misspelled English words
93-
- nakedret # Checks that functions with naked returns are not longer than a maximum size (can be zero).
94-
- noctx # Finds sending http request without context.Context
95-
- nolintlint # Reports ill-formed or insufficient nolint directives
96-
- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative.
97-
- prealloc # Finds slice declarations that could potentially be pre-allocated
98-
- predeclared # find code that shadows one of Go's predeclared identifiers
99-
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
100-
- rowserrcheck # checks whether Rows.Err of rows is checked successfully
101-
- staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.
102-
- stylecheck # Stylecheck is a replacement for golint
103-
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
104-
- testifylint # Checks usage of github.com/stretchr/testify.
105-
- thelper # thelper detects tests helpers which is not start with t.Helper() method.
106-
- unconvert # Remove unnecessary type conversions
107-
- unused # Checks Go code for unused constants, variables, functions and types
108-
- whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc.
109-
110-
# don't enable:
111-
# - deadcode
112-
# - varcheck
113-
# - structcheck
114-
# - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
115-
# - gocyclo # we already have funlen lint
116-
# - dupl # we have a lot of duplicate test cases
117-
# - gochecknoinits # we need the init function for the provider
118-
# - gochecknoglobals # we need some global variables
119-
# - unparam # Forces to create global variables when one variable is repeated in different functions
120-
# - goerr113 # It does not allow you to return an error, you need to save the error in a variable to do it
121-
# - goconst
122-
# - gocognit
123-
1+
version: "2"
1242
run:
125-
timeout: 10m
126-
tests: true
1273
modules-download-mode: readonly
4+
tests: true
5+
linters:
6+
default: none
7+
enable:
8+
- copyloopvar
9+
- dogsled
10+
- errcheck
11+
- errorlint
12+
- exhaustive
13+
- funlen
14+
- gocritic
15+
- godot
16+
- goprintffuncname
17+
- gosec
18+
- govet
19+
- ineffassign
20+
- lll
21+
- makezero
22+
- misspell
23+
- nakedret
24+
- noctx
25+
- nolintlint
26+
- perfsprint
27+
- prealloc
28+
- predeclared
29+
- revive
30+
- rowserrcheck
31+
- staticcheck
32+
- testifylint
33+
- thelper
34+
- unconvert
35+
- unused
36+
- whitespace
37+
# don't enable:
38+
# - deadcode
39+
# - varcheck
40+
# - structcheck
41+
# - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
42+
# - gocyclo # we already have funlen lint
43+
# - dupl # we have a lot of duplicate test cases
44+
# - gochecknoinits # we need the init function for the provider
45+
# - gochecknoglobals # we need some global variables
46+
# - unparam # Forces to create global variables when one variable is repeated in different functions
47+
# - goerr113 # It does not allow you to return an error, you need to save the error in a variable to do it
48+
# - goconst
49+
# - gocognit
50+
settings:
51+
funlen:
52+
lines: 360
53+
statements: 120
54+
gocritic:
55+
enabled-tags:
56+
- diagnostic
57+
- experimental
58+
- opinionated
59+
- performance
60+
- style
61+
govet:
62+
enable:
63+
- shadow
64+
lll:
65+
line-length: 150
66+
misspell:
67+
locale: US
68+
nestif:
69+
min-complexity: 7
70+
revive:
71+
severity: warning
72+
rules:
73+
- name: blank-imports
74+
- name: context-as-argument
75+
- name: context-keys-type
76+
- name: defer
77+
- name: dot-imports
78+
- name: error-return
79+
- name: error-strings
80+
- name: error-naming
81+
- name: early-return
82+
- name: errorf
83+
- name: exported
84+
- name: import-shadowing
85+
- name: indent-error-flow
86+
- name: if-return
87+
- name: increment-decrement
88+
- name: var-naming
89+
- name: var-declaration
90+
- name: package-comments
91+
- name: range
92+
- name: receiver-naming
93+
- name: time-naming
94+
- name: unexported-return
95+
- name: indent-error-flow
96+
- name: errorf
97+
- name: empty-block
98+
- name: superfluous-else
99+
- name: struct-tag
100+
- name: unused-parameter
101+
- name: unreachable-code
102+
- name: redefines-builtin-id
103+
- name: unused-receiver
104+
- name: constant-logical-expr
105+
- name: confusing-naming
106+
- name: unnecessary-stmt
107+
- name: use-any
108+
- name: imports-blocklist
109+
arguments:
110+
- github.com/pkg/errors
111+
exclusions:
112+
generated: lax
113+
presets:
114+
- comments
115+
- common-false-positives
116+
- legacy
117+
- std-error-handling
118+
paths:
119+
- third_party$
120+
- builtin$
121+
- examples$
122+
formatters:
123+
enable:
124+
- gci
125+
- gofmt
126+
- goimports
127+
settings:
128+
gci:
129+
sections:
130+
- standard
131+
- default
132+
exclusions:
133+
generated: lax
134+
paths:
135+
- third_party$
136+
- builtin$
137+
- examples$

0 commit comments

Comments
 (0)