-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yaml
83 lines (80 loc) · 2.02 KB
/
.golangci.yaml
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
linters-settings:
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
govet:
enable:
- shadow
nolintlint:
require-explanation: true
require-specific: true
gocyclo:
min-complexity: 21
gosec:
excludes:
- G115
linters:
disable-all: true
enable:
- gci
- bodyclose
- unused
- dogsled
- dupl
- errcheck
- goconst
- gocritic
- gofmt
- goimports
- gocyclo
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nolintlint
- nakedret
- prealloc # pre-allocate slices with define size if the slice size is known in advance
- predeclared
- revive
- staticcheck
- stylecheck
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- whitespace
- lll
- wsl # While space linter
run:
issues-exit-code: 1
# Test exclusion examples
issues:
exclude-dirs:
- main
exclude-rules:
- text: 'shadow: declaration of "(err|ctx)" shadows declaration at' # Allow idiomatic shadowing of err and ctx
linters:
- govet
- text: 'exported: type name will be used as backup.(BackupStats|BackupHandler|BackupConfig|BackupToDirectoryConfig|BackupToDirectoryStats|BackupToDirectoryHandler) by other packages, and that stutters' # Allow stuttering for backup types
linters:
- revive
- path: '(.+)test\.go'
linters:
- govet # Test code field alignment for sake of space is not a concern
- dupl
- goconst # Many test cases are small and have repeated strings that don't need to be constants
- wsl # Test code should be allowed to cuddle if statements, generated tests do this
- lll # Test data is often long and can make less sense when wrapped
- path: '(.+)test\.go'
text: importShadow
- path: '(.+)test\.go' # Test code doesn't need crypto strength random numbers
text: 'G404: Use of weak random number generator'