-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path.golangci.yml
More file actions
205 lines (179 loc) · 6.85 KB
/
.golangci.yml
File metadata and controls
205 lines (179 loc) · 6.85 KB
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
# https://golangci-lint.run/usage/configuration/
# options for analysis running
# https://golangci-lint.run/usage/configuration/#run-configuration
version: "2"
run:
# include test files or not, default is true
tests: true
# Allow multiple parallel golangci-lint instances running. If false,
# golangci-lint acquires file lock on start.
allow-parallel-runners: true
# Number of operating system threads (`GOMAXPROCS`) that can execute
# golangci-lint simultaneously. If it is explicitly set to 0 (i.e. not the
# default) then golangci-lint will automatically set the value to match Linux
# container CPU quota.
concurrency: 2
linters:
# Default set of linters.
# The value can be: `standard`, `all`, `none`, or `fast`.
# Default: standard
default: standard
# Enable specific linters.
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
- govet
- revive
- unused
- errcheck
- staticcheck
- ineffassign
- unconvert
- misspell
- lll
- nakedret
- gocritic
- nolintlint
- gocyclo
- copyloopvar
- usestdlibvars
# all available settings of specific linters
settings:
# https://golangci-lint.run/usage/linters/#lll
lll:
# max line length, lines longer will be reported. Default is 120. '\t' is
# counted as 1 character by default, and can be changed with the tab-width
# option
line-length: 125
# Tab width in spaces.
tab-width: 2
# https://golangci-lint.run/usage/linters/#gocyclo
gocyclo:
# Using a high number for now only to cover the existing codebase. We
# already have a plan to target a lower number. The value was chosen from
# the following command execution:
#
# gocyclo -top 1 -ignore "(_gen\.go$|\.sql\.go$|\.peg\.go$|\.html\.go$)" .
min-complexity: 30
# https://golangci-lint.run/usage/linters/#revive
revive:
# Maximum number of open files at the same time.
max-open-files: 1024
# Run `GL_DEBUG=revive golangci-lint run --enable-only=revive` to see
# default, all available rules, and enabled rules.
rules:
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#constant-logical-expr
- name: constant-logical-expr
severity: warning
disabled: false
exclude:
- ""
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#datarace
- name: datarace
severity: warning
disabled: false
exclude:
- ""
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#exported
- name: exported
arguments:
- disableStutteringCheck
- disableChecksOnTypes
- disableChecksOnVariables
- disableChecksOnConstants
severity: warning
disabled: false
exclude:
- ""
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#if-return
- name: if-return
severity: warning
disabled: false
exclude:
- ""
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#redundant-import-alias
- name: redundant-import-alias
severity: warning
disabled: false
exclude:
- ""
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#superfluous-else
- name: superfluous-else
arguments:
- preserveScope
severity: warning
disabled: false
exclude:
- ""
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unreachable-code
- name: unreachable-code
severity: warning
disabled: false
exclude:
- ""
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
arguments:
- allowRegex: ^_
severity: warning
disabled: false
exclude:
- ""
# https://golangci-lint.run/usage/linters/#unused
unused:
# Mark all struct fields that have been written to as used.
# Setting it to 'false' will report fields with writes but no reads (it might have false positives)
# Default: true
field-writes-are-uses: true
# Mark all exported fields as used.
# default: true
exported-fields-are-used: false
# Mark all local variables as used.
# default: true
local-variables-are-used: false
# Defines a set of rules to ignore issues.
# It does not skip the analysis, and so does not ignore "typecheck" errors.
exclusions:
# Mode of the generated files analysis.
#
# - `strict`: sources are excluded by strictly following the Go generated file convention.
# Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\.$`
# This line must appear before the first non-comment, non-blank text in the file.
# https://go.dev/s/generatedcode
# - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.
# - `disable`: disable the generated files exclusion.
#
# Default: lax
generated: lax
# Log a warning if an exclusion rule is unused.
# Default: false
warn-unused: true
# Excluding configuration per-path, per-linter, per-text and per-source.
rules: []
# Which file paths to exclude: they will be analyzed, but issues from them won't be reported.
# "/" will be replaced by the current OS file path separator to properly work on Windows.
# Default: []
paths: []
issues:
# Maximum count of issues with the same text. Setting this to zero will disable
# any limits, meaning all errors will be reported. This is useful if a linter
# always produces the same error message, or else some errors might be filtered
max-same-issues: 0
formatters:
# Enable specific formatter.
# Default: [] (uses standard Go formatting)
enable:
- goimports
# Defines a set of rules to ignore issues.
# It does not skip the analysis, and so does not ignore "typecheck" errors.
exclusions:
# Mode of the generated files analysis.
#
# - `strict`: sources are excluded by strictly following the Go generated file convention.
# Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\.$`
# This line must appear before the first non-comment, non-blank text in the file.
# https://go.dev/s/generatedcode
# - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.
# - `disable`: disable the generated files exclusion.
#
# Default: lax
generated: lax