-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yml
152 lines (123 loc) · 3.95 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
linters:
enable-all: true
disable:
- decorder # Don't care about this
- dupl # Basically every table driven test ever triggers this
- dupword # Messes with test cases more often than not
- err113 # Out of date
- exhaustruct # No
- forbidigo # Nothing to forbid
- funlen # Bad metric for complexity
- gci # gofmt/goimports is fine
- ginkgolinter # I don't use whatever this is
- gochecknoglobals # Globals are fine sometimes, use common sense
- gocyclo # cyclop does this instead
- godox # "todo" and "fixme" comments are allowed
- goheader # No need
- gosmopolitan # No need
- grouper # Imports take care of themselves, rest is common sense
- ireturn # This is just not necessary or practical in a real codebase
- lll # Auto formatters do this and what they can't do I don't care about
- maintidx # This is just the inverse of complexity... which is cyclop
- nestif # cyclop does this
- nlreturn # Similar to wsl, I think best left to judgement
- nonamedreturns # Named returns are often helpful, it's naked returns that are the issue
- paralleltest # I've never had Go tests take longer than a few seconds, it's fine
- tenv # Replaced by usetesting
- varnamelen # Lots of false positives of things that are fine
- wrapcheck # Not every error must be wrapped
- wsl # Very aggressive, some of this I like but tend to do anyway
issues:
exclude-rules:
- path: _test\.go
linters:
- prealloc # These kinds of optimisations will make no difference to test code
- gosec # Tests don't need security stuff
linters-settings:
cyclop:
max-complexity: 20
depguard:
rules:
main:
deny:
- pkg: io/ioutil
desc: io/ioutil is deprecated, use io instead
- pkg: "math/rand$"
desc: use math/rand/v2 instead
errcheck:
check-type-assertions: true
check-blank: true
exhaustive:
check:
- switch
- map
default-signifies-exhaustive: true
staticcheck:
checks:
- all
gosimple:
checks:
- all
govet:
enable-all: true
gofumpt:
extra-rules: true
nakedret:
max-func-lines: 0 # Disallow any naked returns
nolintlint:
allow-unused: false
require-explanation: true
require-specific: true
usetesting:
context-background: true
context-todo: true
os-chdir: true
os-mkdir-temp: true
os-setenv: true
os-create-temp: true
os-temp-dir: true
revive:
max-open-files: 256
ignore-generated-header: true
enable-all-rules: true
rules:
- name: add-constant
disabled: true # goconst does this
- name: argument-limit
arguments:
- 5
- name: cognitive-complexity
disabled: true # gocognit does this
- name: comment-spacings
arguments:
- "nolint:"
- name: cyclomatic
disabled: true # cyclop does this
- name: exported
arguments:
- checkPrivateReceivers
- checkPublicInterface
- name: function-length
disabled: true # Bad proxy for complexity
- name: function-result-limit
arguments:
- 3
- name: import-shadowing
disabled: true # predeclared does this
- name: line-length-limit
disabled: true # gofmt/golines handles this well enough
- name: max-public-structs
disabled: true # This is a silly rule
- name: redefines-builtin-id
disabled: true # predeclared does this
- name: unhandled-error
arguments:
- fmt\.(Fp|P)rint(ln|f)?
- strings.Builder.Write(String|Byte)?
- bytes.Buffer.Write(String|Byte)?
- name: flag-parameter
disabled: true # As far as I can work out this just doesn't like bools
- name: unused-parameter
disabled: true # The gopls unused analyzer covers this better
- name: unused-receiver
disabled: true # As above