11# note: GolangCI-Lint also searches for config files in all directories from the directory of the first analyzed path up to the root.
2+ version : " 2"
23run :
34 build-tags :
45 - utils
2223 # By default, it isn't set.
2324 modules-download-mode : readonly
2425
25- issues :
26- # Enables skipping of directories:
27- # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
28- # Default: true
29- exclude-dirs-use-default : false
30-
31- # note: folders/files can not be excluded from "typecheck" anymore since v1.61.0
32-
33- linters :
34- enable-all : true
35-
3626 # https://golangci-lint.run/usage/linters/#enabled-by-default
3727 # note: typecheck can not be disabled, it is used to check code compilation
28+ linters :
29+ default : all
3830 disable :
39- # deprecated:
40- - tenv # replaced by usetesting
31+ # deprecated: none
4132 # not used for this go version: none
4233 # not used for any reason
4334 - err113 # not used (we allow error creation at return statement)
@@ -51,6 +42,7 @@ linters:
5142 - importas # not needed (there is no alias rule at the moment)
5243 - ireturn # not used (we allow return interfaces)
5344 - loggercheck # not needed (relates to kitlog, klog, logr, zap)
45+ - noinlineerr # this violates best practices in other style guides
5446 - paralleltest # not used
5547 - promlinter # not needed (prometheus metrics naming)
5648 - rowserrcheck # not needed (sql related)
@@ -63,6 +55,7 @@ linters:
6355 - dupl # useful with some tweeks (reduce bugs and lines of code)
6456 - errname # useful for common style
6557 - exhaustruct # useful with some exclusions for existing code (e.g. mavlink/common/common.go)
58+ - funcorder # common style, but too many findings
6659 - funlen # useful with some tweeks (reduce bugs, simplify code, better understandable code)
6760 - gocognit # useful with some tweeks (better understandable code)
6861 - goconst # useful (reduce bugs)
@@ -74,95 +67,115 @@ linters:
7467 - mnd # useful with some exclusions for existing code (e.g. mavlink.go)
7568 - nestif # useful (reduce bugs, simplify code, better understandable code)
7669 - nlreturn # more common style, but could become annoying
77- - stylecheck # useful with some tweaking (e.g. underscores in names should be allowed - we use it for constants retrieved from C/C++)
7870 - tagliatelle # maybe useful with some tweaking or excluding
7971 - varnamelen # maybe useful with some tweaking, but many findings
8072 - whitespace # more common style, but could become annoying
8173 - wsl # more common style, but could become annoying
74+ - wsl_v5 # same as above
75+
76+ exclusions :
77+ generated : lax
78+ presets :
79+ - comments
80+ - common-false-positives
81+ - legacy
82+ - std-error-handling
83+
84+ settings :
85+ depguard :
86+ # Rules to apply.
87+ #
88+ # Variables:
89+ # - File Variables
90+ # you can still use and exclamation mark ! in front of a variable to say not to use it.
91+ # Example !$test will match any file that is not a go test file.
92+ #
93+ # `$all` - matches all go files
94+ # `$test` - matches all go test files
95+ #
96+ # - Package Variables
97+ #
98+ # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
99+ #
100+ # Default: Only allow $gostd in all files.
101+ rules :
102+ main :
103+ # Packages that are not allowed where the value is a suggestion.
104+ deny :
105+ - pkg : github.com/pkg/errors
106+ desc : Should be replaced by standard lib errors package
107+
108+ dupword :
109+ # Keywords for detecting duplicate words.
110+ # If this list is not empty, only the words defined in this list will be detected.
111+ # Default: []
112+ keywords :
113+ - the
114+ - and
115+ - a
116+
117+ errorlint :
118+ # Default: true
119+ # %v should be used by default over %w, see https://github.com/uber-go/guide/blob/master/style.md#error-wrapping
120+ errorf : false
121+ # Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true)
122+ # Default: true
123+ errorf-multi : false
82124
83- linters-settings :
84- depguard :
85- # Rules to apply.
86- #
87- # Variables:
88- # - File Variables
89- # you can still use and exclamation mark ! in front of a variable to say not to use it.
90- # Example !$test will match any file that is not a go test file.
91- #
92- # `$all` - matches all go files
93- # `$test` - matches all go test files
94- #
95- # - Package Variables
96- #
97- # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
98- #
99- # Default: Only allow $gostd in all files.
100- rules :
101- main :
102- # Packages that are not allowed where the value is a suggestion.
103- deny :
104- - pkg : " github.com/pkg/errors"
105- desc : Should be replaced by standard lib errors package
125+ gocritic :
126+ disabled-checks :
127+ - assignOp # very opinionated
128+ - appendAssign # mostly used by intention
106129
107- dupword :
108- # Keywords for detecting duplicate words.
109- # If this list is not empty, only the words defined in this list will be detected.
110- # Default: []
111- keywords :
112- - " the"
113- - " and"
114- - " a"
130+ nolintlint :
131+ # Enable to require an explanation of nonzero length after each nolint directive.
132+ # Default: false
133+ require-explanation : true
134+ # Enable to require nolint directives to mention the specific linter being suppressed.
135+ # Default: false
136+ require-specific : true
115137
116- errorlint :
117- # Default: true
118- # %v should be used by default over %w, see https://github.com/uber-go/guide/blob/master/style.md#error-wrapping
119- errorf : false
120- # Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true)
121- # Default: true
122- errorf-multi : false
138+ perfsprint :
139+ # Optimizes `fmt.Errorf`.
140+ # Default: true
141+ errorf : false
142+ # Optimizes `fmt.Sprintf` with only one argument
143+ # Default: true
144+ sprintf1 : false
123145
124- gci :
125- # Section configuration to compare against.
126- # Section names are case-insensitive and may contain parameters in ().
127- # The default order of sections is `standard > default > custom > blank > dot`,
128- # If `custom-order` is `true`, it follows the order of `sections` option.
129- # Default: ["standard", "default"]
130- sections :
131- - standard # Standard section: captures all standard packages.
132- - default # Default section: contains all imports that could not be matched to another section type.
133- - prefix(gobot.io/x/gobot/) # Custom section: groups all imports with the specified Prefix.
134- # - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
135- # - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
136- # Enable custom order of sections.
137- # If `true`, make the section order the same as the order of `sections`.
138- # Default: false
139- custom-order : true
146+ revive :
147+ rules :
148+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return
149+ # disable this rule, because sometimes it has its justification
150+ - name : unexported-return
151+ severity : warning
152+ disabled : true
140153
141- gocritic :
142- disabled-checks :
143- - assignOp # very opinionated
144- - appendAssign # mostly used by intention
145154
146- nolintlint :
147- # Enable to require an explanation of nonzero length after each nolint directive.
148- # Default: false
149- require-explanation : true
150- # Enable to require nolint directives to mention the specific linter being suppressed.
151- # Default: false
152- require-specific : true
155+ formatters :
156+ enable :
157+ - gci
158+ - gofmt
159+ - gofumpt
160+ - goimports
153161
154- perfsprint :
155- # Optimizes `fmt.Errorf`.
156- # Default: true
157- errorf : false
158- # Optimizes `fmt.Sprintf` with only one argument
159- # Default: true
160- sprintf1 : false
162+ exclusions :
163+ generated : lax
161164
162- revive :
163- rules :
164- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return
165- # disable this rule, because sometimes it has its justification
166- - name : unexported-return
167- severity : warning
168- disabled : true
165+ settings :
166+ gci :
167+ # Section configuration to compare against.
168+ # Section names are case-insensitive and may contain parameters in ().
169+ # The default order of sections is `standard > default > custom > blank > dot`,
170+ # If `custom-order` is `true`, it follows the order of `sections` option.
171+ # Default: ["standard", "default"]
172+ sections :
173+ - standard # Standard section: captures all standard packages.
174+ - default # Default section: contains all imports that could not be matched to another section type.
175+ - prefix(gobot.io/x/gobot/) # Custom section: groups all imports with the specified Prefix.
176+ # - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
177+ # - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
178+ # Enable custom order of sections.
179+ # If `true`, make the section order the same as the order of `sections`.
180+ # Default: false
181+ custom-order : true
0 commit comments