-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yml
682 lines (602 loc) · 31.8 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
run:
tests: false # include test files or not, default is true.
go: '1.22'
linters:
disable-all: true
enable:
- asasalint # Check for pass []any as any in variadic func(...any).
- asciicheck # Checks that your code does not contain non-ASCII identifiers.
- bodyclose # Checks whether HTTP response body is closed successfully.
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()).
- errcheck # Checks for unchecked errors in go programs.
- errorlint # Finds code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- copyloopvar # Checks for loop variables that are copied in the loop body.
- gosimple # Linter for Go source code that specializes in simplifying code.
- gosec # Inspects source code for security problems.
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.
- godot # Check if comments end in a period.
- gofmt # Gofmt checks whether code was gofmt-ed.
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
- ineffassign # Detects when assignments to existing variables are not used.
- noctx # Finds sending http request without context.Context.
- nolintlint # Reports ill-formed or insufficient nolint directives.
- prealloc # Finds slice declarations that could potentially be pre-allocated.
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
- staticcheck # It's a set of rules from staticcheck.
- stylecheck # Stylecheck is a replacement for golint.
- unconvert # Remove unnecessary type conversions.
- unparam # Reports unused function parameters.
- unused # Checks Go code for unused constants, variables, functions and types.
linters-settings:
dogsled:
# Checks assignments with too many blank identifiers.
max-blank-identifiers: 2
errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
check-type-assertions: true
# Report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
check-blank: true
# To disable the errcheck built-in exclude list.
disable-default-exclusions: true
# List of functions to exclude from checking, where each entry is a single function to exclude.
# See https://github.com./kisielk/errcheck#excluding-functions for details.
exclude-functions:
- io/ioutil.ReadFile
- io.Copy(*bytes.Buffer)
- io.Copy(os.Stdout)
- (*strings.Builder).WriteString
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors.
errorf: false
# Check for plain type assertions and type switches.
asserts: true
# Check for plain error comparisons.
comparison: true
godot:
# Comments to be checked: `declarations`, `toplevel`, or `all`.
scope: all
# List of regexps for excluding particular comment lines from check.
exclude:
# Exclude todo and fixme comments.
- "^fixme:"
- "^todo:"
# Check that each sentence ends with a period.
period: true
# Check that each sentence starts with a capital letter.
capital: false
gocritic:
# Which checks should be enabled; can't be combined with 'disabled-checks'.
# See https://go-critic.github.io/overview#checks-overview.
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`.
enabled-checks: [ ]
# Which checks should be disabled; can't be combined with 'enabled-checks'.
disabled-checks: [ "whyNoLint" ]
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
# See https://github.com./go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- diagnostic
- style
disabled-tags: [ ]
# Settings passed to gocritic.
# The settings key is the name of a supported gocritic checker.
# The list of supported checkers can be find in https://go-critic.github.io/overview.
settings:
# Must be valid enabled check name.
captLocal:
# Whether to restrict checker to params only.
# Default: true
paramsOnly: false
elseif:
# Whether to skip balanced if-else pairs.
# Default: true
skipBalanced: false
nestingReduce:
# Min number of statements inside a branch to trigger a warning.
# Default: 5
bodyWidth: 4
tooManyResultsChecker:
# Maximum number of results.
# Default: 5
maxResults: 10
truncateCmp:
# Whether to skip int/uint/uintptr types.
# Default: true
skipArchDependent: false
underef:
# Whether to skip (*x).method() calls where x is a pointer receiver.
# Default: true
skipRecvDeref: false
unnamedResult:
# Whether to check exported functions.
# Default: false
checkExported: false
gosec:
excludes:
- "G404" # Use of weak random number generator (math/rand instead of crypto/rand)
revive:
# Maximum number of open files at the same time.
# See https://github.com./mgechev/revive#command-line-flags
# Defaults to unlimited.
max-open-files: 0
# When set to false, ignores files with "GENERATED" header, similar to golint.
# See https://github.com./mgechev/revive#available-rules for details.
# Default: false
ignore-generated-header: true
# Sets the default severity.
# See https://github.com./mgechev/revive#configuration
# Default: warning
severity: warning
# Enable all available rules.
# Default: false
enable-all-rules: true
# Sets the default failure confidence.
# This means that linting errors with less than 0.8 confidence will be ignored.
# Default: 0.8
confidence: 0.1
rules:
# Suggests using constant for magic numbers and string literals.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#add-constant
# TODO: try rule later. Looks like it is broken in 1.50.0. Use gomnd instead
- name: add-constant
severity: warning
disabled: false
arguments:
- maxLitCount: '5'
allowStrs: '""'
allowInts: '0,1,2,3,4,5,6,7,8,9,10,24,30,31,64,128'
allowFloats: '0.0,0.,1.0,1.,2.0,2.'
# Warns when a function receives more parameters than the maximum set by the rule's configuration.
# Enforcing a maximum number of parameters helps to keep the code readable and maintainable.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#argument-limit
- name: argument-limit
severity: warning
disabled: false
arguments: [ 4 ]
# Check for commonly mistaken usages of the sync/atomic package
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#atomic
- name: atomic
severity: warning
disabled: false
# Warns on bare (a.k.a. naked) returns
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#banned-characters
- name: banned-characters
severity: warning
disabled: false
arguments: [ "Ω", "Σ", "σ", "7" ]
# Checks given banned characters in identifiers(func, var, const). Comments are not checked.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bare-return
- name: bare-return
severity: warning
disabled: false
# Blank import should be only in a main or test package, or have a comment justifying it.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports
- name: blank-imports
severity: warning
disabled: false
# Using Boolean literals (true, false) in logic expressions may make the code less readable.
# This rule suggests removing Boolean literals from logic expressions.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
- name: bool-literal-in-expr
severity: warning
disabled: false
# Explicitly invoking the garbage collector is, except for specific uses in benchmarking, very dubious.
# The garbage collector can be configured through environment variables as described here: https://pkg.go.dev/runtime
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#call-to-gc
- name: call-to-gc
severity: warning
disabled: false
# Description: Cognitive complexity is a measure of how hard code is to understand.
# While cyclomatic complexity is good to measure "testability" of the code, cognitive complexity
# aims to provide a more precise measure of the difficulty of understanding the code.
# Enforcing a maximum complexity per function helps to keep code readable and maintainable.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cognitive-complexity
- name: cognitive-complexity
severity: warning
disabled: false
arguments: [ 50 ]
# Methods or fields of struct that have names different only by capitalization could be confusing.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming
- name: confusing-naming
severity: warning
disabled: false
# Function or methods that return multiple, no named, values of the same type could induce error.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-results
- name: confusing-results
severity: warning
disabled: false
# The rule spots logical expressions that evaluate always to the same value.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#constant-logical-expr
- name: constant-logical-expr
severity: warning
disabled: false
# By convention, context.Context should be the first parameter of a function.
# https://github.com./golang/go/wiki/CodeReviewComments#contexts
# This rule spots function declarations that do not follow the convention.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument
- name: context-as-argument
severity: warning
disabled: false
arguments: [ { allowTypesBefore = "*testing.T" } ]
# Basic types should not be used as a key in context.WithValue.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type
- name: context-keys-type
severity: warning
disabled: false
# Cyclomatic complexity is a measure of code complexity.
# Enforcing a maximum complexity per function helps to keep code readable and maintainable.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cyclomatic
- name: cyclomatic
severity: warning
disabled: false
arguments: [ 15 ]
# Spots comments without whitespace between slashes and words: //pragma.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comment-spacings
- name: comment-spacings
severity: warning
disabled: false
arguments: [ "nolint" ]
# This rule spots potential dataraces caused by go-routines capturing (by-reference) particular
# identifiers of the function from which go-routines are created.
# The rule is able to spot two of such cases: go-routines capturing named return values,
# and capturing for-range values.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#datarace
- name: datarace
severity: warning
disabled: false
# Packages exposing functions that can stop program execution by exiting are hard to reuse.
# This rule looks for program exits in functions other than main() or init().
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit
- name: deep-exit
severity: warning
disabled: false
# This rule warns on some common mistakes when using defer statement.
# It currently alerts on the following situations:
# - [ call-chain ] - even if deferring call-chains of the form foo()() is valid,
# it does not help code understanding (only the last call is deferred)
# - [ loop ] - deferring inside loops can be misleading (deferred functions are not executed at the end
# of the loop iteration but of the current function) and it could lead to exhausting the execution stack
# - [ method-call ] - deferring a call to a method can lead to subtle bugs if the method does not have a pointer receiver
# - [ recover ] - calling recover outside a deferred function has no effect
# - [ immediate-recover ] - calling recover at the time a defer is registered, rather than as part of the deferred callback.
# e.g. defer recover() or equivalent.
# - [ return ] - returning values form a deferred function has no effect.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#defer
- name: defer
severity: warning
disabled: false
arguments:
- [ "call-chain", "loop", "method-call", "recover", "immediate-recover", "return" ]
# Importing with . makes the programs much harder to understand because it is unclear
# whether names belong to the current package or to an imported package.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports
- name: dot-imports
severity: warning
disabled: false
# It is possible to unintentionally import the same package twice.
# This rule looks for packages that are imported two or more times.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports
- name: duplicated-imports
severity: warning
disabled: false
# In GO it is idiomatic to minimize nesting statements, a typical example is to avoid if-then-else constructions.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return
- name: early-return
severity: warning
disabled: false
# Empty blocks make code less readable and could be a symptom of a bug or unfinished refactoring.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block
- name: empty-block
severity: warning
disabled: false
# Sometimes gofmt is not enough to enforce a common formatting of a code-base.
# This rule warns when there are heading or trailing newlines in code blocks.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
- name: empty-lines
severity: warning
disabled: false
# By convention, for the sake of readability, variables of type error must be named with the prefix err.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming
- name: error-naming
severity: warning
disabled: false
# By convention, for the sake of readability, the errors should be last in the list of returned values by a function.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-return
- name: error-return
severity: warning
disabled: false
# By convention, for better readability, error messages should not be capitalized or end with punctuation or a newline.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-strings
- name: error-strings
severity: warning
disabled: false
# It is possible to get a simpler program by replacing errors.New(fmt.Sprintf()) with fmt.Errorf().
# This rule spots that kind of simplification opportunities.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#errorf
- name: errorf
severity: warning
disabled: false
# Exported function and methods should have comments.
# This warns on undocumented exported functions and methods.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported
- name: exported
severity: warning
disabled: false
arguments: [ ]
# This rule helps to enforce a common header for all source files in a project by spotting those files
# that do not have the specified header.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#file-header
- name: file-header
severity: warning
disabled: true
arguments: [ "" ]
# If a function controls the flow of another by passing it information on what to do, both functions are said to be control-coupled.
# Coupling among functions must be minimized for better maintainability of the code.
# This rule warns on boolean parameters that create a control coupling.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter
- name: flag-parameter
severity: warning
disabled: false
# Functions returning too many results can be hard to understand/use.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-result-limit
- name: function-result-limit
severity: warning
disabled: false
arguments: [ 2 ]
# Functions too long (with many statements and/or lines) can be hard to understand.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-length
- name: function-length
severity: warning
disabled: false
# (int,int) the maximum allowed statements and lines.
# Must be non-negative integers. Set to 0 to disable the check
arguments: [ 50, 0 ]
# Typically, functions with names prefixed with Get are supposed to return a value.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return
- name: get-return
severity: warning
disabled: false
# An if-then-else conditional with identical implementations in both branches is an error.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#identical-branches
- name: identical-branches
severity: warning
disabled: false
# Checking if an error is nil to just after return the error or nil is redundant.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#if-return
- name: if-return
severity: warning
disabled: false
# By convention, for better readability, incrementing an integer variable by 1 is recommended
# to be done using the ++ operator.
# This rule spots expressions like i += 1 and i -= 1 and proposes to change them into i++ and i--.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#increment-decrement
- name: increment-decrement
severity: warning
disabled: false
# To improve the readability of code, it is recommended to reduce the indentation as much as possible.
# This rule highlights redundant else-blocks that can be eliminated from the code.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#indent-error-flow
- name: indent-error-flow
severity: warning
disabled: false
# Warns when importing black-listed packages.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#imports-blocklist
- name: imports-blocklist
severity: warning
disabled: false
arguments:
- "crypto/md5"
- "crypto/sha1"
# In GO it is possible to declare identifiers (packages, structs, interfaces, parameters,
# receivers, variables, constants...) that conflict with the name of an imported package.
# This rule spots identifiers that shadow an import.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing
- name: import-shadowing
severity: warning
disabled: false
# Warns in the presence of code lines longer than a configured maximum.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#line-length-limit
- name: line-length-limit
severity: warning
disabled: false
arguments: [ 150 ]
# Packages declaring too many public structs can be hard to understand/use,
# and could be a symptom of bad design.
# This rule warns on files declaring more than a configured, maximum number of public structs.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#max-public-structs
- name: max-public-structs
severity: warning
disabled: true
arguments: [ 3 ]
# A function that modifies its parameters can be hard to understand.
# It can also be misleading if the arguments are passed by value by the caller.
# This rule warns when a function modifies one or more of its parameters.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-parameter
- name: modifies-parameter
severity: warning
disabled: false
# A method that modifies its receiver value can have undesired behavior.
# The modification can be also the root of a bug because the actual value receiver could be a copy of that used at the calling site.
# This rule warns when a method modifies its receiver.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-value-receiver
- name: modifies-value-receiver
severity: warning
disabled: false
# Packages declaring structs that contain other inline struct definitions can be hard to understand/read for other developers.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#nested-structs
- name: nested-structs
severity: warning
disabled: false
# conditional expressions can be written to take advantage of short circuit evaluation and speed up
# its average evaluation time by forcing the evaluation of less time-consuming terms before more costly ones.
# This rule spots logical expressions where the order of evaluation of terms seems non-optimal.
# Please notice that confidence of this rule is low and is up to the user to decide if the suggested
# rewrite of the expression keeps the semantics of the original one.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#optimize-operands-order
- name: optimize-operands-order
severity: warning
disabled: false
# Packages should have comments. This rule warns on undocumented packages and when packages comments are detached to the package keyword.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments
- name: package-comments
severity: warning
disabled: false
# This rule suggests a shorter way of writing ranges that do not use the second value.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range
- name: range
severity: warning
disabled: false
# Range variables in a loop are reused at each iteration; therefore a goroutine created
# in a loop will point to the range variable with from the upper scope.
# This way, the goroutine could use the variable with an undesired value.
# This rule warns when a range value (or index) is used inside a closure.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-in-closure
- name: range-val-in-closure
severity: warning
disabled: false
# Range variables in a loop are reused at each iteration. This rule warns when assigning the address of the variable,
# passing the address to append() or using it in a map.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-address
- name: range-val-address
severity: warning
disabled: false
# By convention, receiver names in a method should reflect their identity.
# For example, if the receiver is of type Parts, p is an adequate name for it.
# Contrary to other languages, it is not idiomatic to name receivers as this or self.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#receiver-naming
- name: receiver-naming
severity: warning
disabled: false
# Constant names like false, true, nil, function names like append, make, and basic type names like bool,
# and byte are not reserved words of the language; therefore the can be redefined.
# Even if possible, redefining these built in names can lead to bugs very difficult to detect.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id
- name: redefines-builtin-id
severity: warning
disabled: false
# explicit type conversion string(i) where i has an integer type other than
# rune might behave not as expected by the developer (e.g. string(42) is not "42").
# This rule spot that kind of suspicious conversions.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-of-int
- name: string-of-int
severity: warning
disabled: false
# This rule allows you to configure a list of regular expressions that string literals
# in certain function calls are checked against. This is geared towards user facing applications
# where string literals are often used for messages that will be presented to users,
# so it may be desirable to enforce consistent formatting.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format
- name: string-format
severity: warning
disabled: true
arguments: [ ]
# Struct tags are not checked at compile time.
# This rule, checks and warns if it finds errors in common struct tags types like:
# asn1, default, json, protobuf, xml, yaml.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
- name: struct-tag
severity: warning
disabled: false
# To improve the readability of code, it is recommended to reduce the indentation as much as possible.
# This rule highlights redundant else-blocks that can be eliminated from the code.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else
- name: superfluous-else
severity: warning
disabled: false
# This rule warns when using == and != for equality check time.Time and suggest to time.time.Equal method,
# for about information follow this link: https://pkg.go.dev/time#Time
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-equal
- name: time-equal
severity: warning
disabled: false
# Using unit-specific suffix like "Secs", "Mins", ... when naming variables of type time.Duration
# can be misleading, this rule highlights those cases.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-naming
- name: time-naming
severity: warning
disabled: false
# This rule warns when initialism, variable or package naming conventions are not followed.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming
- name: var-naming
severity: warning
disabled: false
arguments:
- [ ] # AllowList
- [ "ID", "VM" ] # DenyList
# This rule proposes simplifications of variable declarations.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-declaration
- name: var-declaration
severity: warning
disabled: false
# Unconditional recursive calls will produce infinite recursion, thus program stack overflow.
# This rule detects and warns about unconditional (direct) recursive calls.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unconditional-recursion
- name: unconditional-recursion
severity: warning
disabled: false
# This rule warns on wrongly named un-exported symbols, i.e. un-exported symbols whose name
# start with a capital letter.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming
- name: unexported-naming
severity: warning
disabled: false
# This rule warns when an exported function or method returns a value of an un-exported type.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return
- name: unexported-return
severity: warning
disabled: false
# This rule warns when errors returned by a function are not explicitly handled on the caller side.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
- name: unhandled-error
severity: warning
# Use errcheck instead.
disabled: true
arguments:
- "fmt.Println"
- "fmt.Printf"
# This rule suggests to remove redundant statements like a break at the end of a case block,
# for improving the code's readability.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt
- name: unnecessary-stmt
severity: warning
disabled: false
# This rule spots and proposes to remove unreachable code.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unreachable-code
- name: unreachable-code
severity: warning
disabled: false
# This rule warns on unused parameters. Functions or methods with unused parameters can be a symptom of an unfinished refactoring or a bug.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: false
# This rule warns on unused method receivers.
# Methods with unused receivers can be a symptom of an unfinished refactoring or a bug.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
- name: unused-receiver
severity: warning
disabled: false
# This rule warns on useless break statements in case clauses of switch and select statements.
# GO, unlike other programming languages like C, only executes statements of the selected case
# while ignoring the subsequent case clauses.
# Therefore, inserting a break at the end of a case clause has no effect.
# Because break statements are rarely used in case clauses, when switch or select statements
# are inside a for-loop, the programmer might wrongly assume that a break in a case clause will
# take the control out of the loop. The rule emits a specific warning for such cases.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
- name: useless-break
severity: warning
disabled: false
# Function parameters that are passed by value, are in fact a copy of the original argument.
# Passing a copy of a sync.WaitGroup is usually not what the developer wants to do.
# This rule warns when a sync.WaitGroup expected as a by-value parameter in a function or method.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value
- name: waitgroup-by-value
severity: warning
disabled: false
# This rule warns on redundant import aliases. This happens when the alias used on the import
# statement matches the imported package name.
# https://github.com./mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redundant-import-alias
- name: redundant-import-alias
severity: warning
disabled: true