forked from adrianbrad/queue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
190 lines (174 loc) · 6.92 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
# .golangci.yml
run:
modules-download-mode: mod
linters-settings:
staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.19"
# https://staticcheck.io/docs/options#checks
checks: [ "all" ]
tagliatelle:
# Check the struck tag name case.
case:
# Use the struct field name to check the name of the struct tag.
# Default: false
use-field-name: true
rules:
# Any struct tag type can be used.
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
json: snake
dupl:
threshold: 300 # tokens count of duplicate code to trigger issue
goconst:
min-len: 2 # minimal length of string constant
min-occurrences: 2 # minimal occurrences count to trigger
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- whyNoLint
- hugeParam
gocyclo:
min-complexity: 8 # minimal code cyclomatic complexity to report
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: [argument,case,condition,return]
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: true # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
gocognit:
min-complexity: 10 # minimal code cognitive complexity to report
gofumpt:
extra-rules: true
varnamelen:
max-distance: 15
ignore-names:
- tx
- err
- pk
- to
- db
- wg
- id
- DB
ignore-type-assert-ok: true
ignore-map-index-ok: true
ignore-chan-recv-ok: true
ignore-decls:
- t testing.T
- i int
- T any
- i *is.I
- eg *errgroup.Group
revive:
ignore-generated-header: true
enable-all-rules: true
confidence: 0.1
rules:
- name: nested-structs
disabled: true
- name: function-result-limit
arguments: [ 3 ]
- name: function-length
disabled: true
- name: banned-characters
disabled: true
- name: max-public-structs
disabled: true
- name: line-length-limit
arguments: [ 80 ]
- name: argument-limit
disabled: true
- name: cyclomatic
disabled: true
- name: file-header
disabled: true
- name: cognitive-complexity
disabled: true
- name: package-comments
disabled: true
- name: add-constant
disabled: true
- name: unhandled-error
disabled: true
- name: var-naming
arguments: [[], ["WS", "VM"]]
linters:
disable-all: true
enable:
# - asasalint # Check for pass []any as any in variadic func(...any)
- bidichk # Checks for dangerous unicode character sequences
- contextcheck # check the function whether use a non-inherited context
- containedctx # containedctx is a linter that detects struct contained context.Context field
- decorder # check declaration order and count of types, constants, variables and functions
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted.
- grouper # An analyzer to analyze expression groups.
- govet # Vet examines Go source code and reports suspicious constructs, only purpose of this tool is to detect go structs that would take less memory if their fields were sorted
- bodyclose # Detects whether the HTTP response body is closed successfully, not closing the response body could lead to memory leaks
- goconst # Finds repeated strings that could be replaced by a constant
- godot # Check if comments end in a period
- gomnd # An analyzer to detect magic numbers.
- goerr113 # Golang linter to check the errors handling expressions
- gocritic # Provides many diagnostics that check for bugs, performance and style issues.
- exhaustive # Check exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables -- VERY IMPORTANT TO USE
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
- forcetypeassert # finds forced type assertions
- importas # Enforces consistent import aliases
- gci # improves imports
- dupl # Detects code clones
- revive # Makes code style recomandations
- gocyclo # Computes and checks the cyclomatic complexity of functions
- gofumpt # Stricter gofmt
- errcheck # Checks unchecked errors in go programs
- gosimple # Linter for Go source code that specializes in simplifying a code
- ineffassign # Detects when assignments to existing variables are not used
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- tagliatelle # Checks the struct tags.
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
- unused # Checks Go code for unused constants, variables, functions and types
- varnamelen # checks that the length of a variable's name matches its scope style
- gocognit # Computes and checks the cognitive complexity of functions https://github.com/uudashr/gocognit
- gosec # Inspects source code for security problems
- prealloc # Finds slice declarations that could potentially be preallocated
# - nolintlint # Reports ill-formed or insufficient nolint directives
- nilnil # Checks that there is no simultaneous return of nil error and an invalid value.
- wsl # Whitespace Linter - Forces you to use empty lines!
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library.
- interfacebloat # A linter that checks the number of methods inside an interface.
- logrlint # Check logr arguments.
- reassign # Checks that package variables are not reassigned
issues:
exclude-use-default: false
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gocyclo
- errcheck
- gosec
- gocognit
- forcetypeassert
- path: mock
linters:
- gomnd
- revive
- gocyclo
- errcheck
- dupl
- gosec
- forcetypeassert