1
+ # Options for analysis running.
2
+ run :
3
+ # Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
4
+ # 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.
5
+ # Default: the number of logical CPUs in the machine
6
+ concurrency : 4
7
+ # Timeout for analysis, e.g. 30s, 5m.
8
+ # Default: 1m
9
+ timeout : 1m
10
+ # Exit code when at least one issue was found.
11
+ # Default: 1
12
+ issues-exit-code : 1
13
+ # Include test files or not.
14
+ # Default: true
15
+ tests : false
16
+ # List of build tags, all linters use it.
17
+ # Default: []
18
+ build-tags : []
19
+ # If set, we pass it to "go list -mod={option}". From "go help modules":
20
+ # If invoked with -mod=readonly, the go command is disallowed from the implicit
21
+ # automatic updating of go.mod described above. Instead, it fails when any changes
22
+ # to go.mod are needed. This setting is most useful to check that go.mod does
23
+ # not need updates, such as in a continuous integration and testing system.
24
+ # If invoked with -mod=vendor, the go command assumes that the vendor
25
+ # directory holds the correct copies of dependencies and ignores
26
+ # the dependency descriptions in go.mod.
27
+ #
28
+ # Allowed values: readonly|vendor|mod
29
+ # Default: ""
30
+ modules-download-mode : " "
31
+ # Allow multiple parallel golangci-lint instances running.
32
+ # If false, golangci-lint acquires file lock on start.
33
+ # Default: false
34
+ allow-parallel-runners : false
35
+ # Allow multiple golangci-lint instances running, but serialize them around a lock.
36
+ # If false, golangci-lint exits with an error if it fails to acquire file lock on start.
37
+ # Default: false
38
+ allow-serial-runners : false
39
+ # Define the Go version limit.
40
+ # Mainly related to generics support since go1.18.
41
+ # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
42
+ go : ' 1.22'
43
+ # output configuration options
44
+ # output configuration options
45
+ output :
46
+ # The formats used to render issues.
47
+ # Formats:
48
+ # - `colored-line-number`
49
+ # - `line-number`
50
+ # - `json`
51
+ # - `colored-tab`
52
+ # - `tab`
53
+ # - `html`
54
+ # - `checkstyle`
55
+ # - `code-climate`
56
+ # - `junit-xml`
57
+ # - `github-actions`
58
+ # - `teamcity`
59
+ # - `sarif`
60
+ # Output path can be either `stdout`, `stderr` or path to the file to write to.
61
+ #
62
+ # For the CLI flag (`--out-format`), multiple formats can be specified by separating them by comma.
63
+ # The output can be specified for each of them by separating format name and path by colon symbol.
64
+ # Example: "--out-format=checkstyle:report.xml,json:stdout,colored-line-number"
65
+ # The CLI flag (`--out-format`) override the configuration file.
66
+ #
67
+ # Default:
68
+ # formats:
69
+ # - format: colored-line-number
70
+ # path: stdout
71
+ formats :
72
+ - format : colored-line-number
73
+ path : stdout
74
+ # Print lines of code with issue.
75
+ # Default: true
76
+ print-issued-lines : true
77
+ # Print linter name in the end of issue text.
78
+ # Default: true
79
+ print-linter-name : true
80
+ # Make issues output unique by line.
81
+ # Default: true
82
+ uniq-by-line : true
83
+ # Add a prefix to the output file references.
84
+ # Default: ""
85
+ path-prefix : " "
86
+ # Sort results by the order defined in `sort-order`.
87
+ # Default: false
88
+ sort-results : true
89
+ # Order to use when sorting results.
90
+ # Require `sort-results` to `true`.
91
+ # Possible values: `file`, `linter`, and `severity`.
92
+ #
93
+ # If the severity values are inside the following list, they are ordered in this order:
94
+ # 1. error
95
+ # 2. warning
96
+ # 3. high
97
+ # 4. medium
98
+ # 5. low
99
+ # Either they are sorted alphabetically.
100
+ #
101
+ # Default: ["file"]
102
+ sort-order :
103
+ - linter
104
+ - severity
105
+ - file # filepath, line, and column.
106
+ # Show statistics per linter.
107
+ # Default: false
108
+ show-stats : true
109
+ linters :
110
+ # Disable all linters.
111
+ # Default: false
112
+ disable-all : false
113
+ # Enable specific linter
114
+ # https://golangci-lint.run/usage/linters/#enabled-by-default
115
+ enable :
116
+ # Default: false
117
+ enable-all : true
118
+ # Disable specific linter
119
+ # https://golangci-lint.run/usage/linters/#disabled-by-default
120
+ disable :
121
+ - depguard
122
+ - gofumpt
123
+ # Enable presets.
124
+ # https://golangci-lint.run/usage/linters
125
+ # Default: []
126
+ presets : []
127
+ # - bugs
128
+ # - comment
129
+ # - complexity
130
+ # - error
131
+ # - format
132
+ # - import
133
+ # - metalinter
134
+ # - module
135
+ # - performance
136
+ # - sql
137
+ # - style
138
+ # - test
139
+ # - unused
140
+ # Enable only fast linters from enabled linters set (first run won't be fast)
141
+ # Default: false
142
+ fast : true
143
+ issues :
144
+ # List of regexps of issue texts to exclude.
145
+ #
146
+ # But independently of this option we use default exclude patterns,
147
+ # it can be disabled by `exclude-use-default: false`.
148
+ # To list all excluded by default patterns execute `golangci-lint run --help`
149
+ #
150
+ # Default: https://golangci-lint.run/usage/false-positives/#default-exclusions
151
+ exclude :
152
+ - abcdef
153
+ # Excluding configuration per-path, per-linter, per-text and per-source
154
+ exclude-rules :
155
+ # Exclude some linters from running on tests files.
156
+ - path : _test\.go
157
+ linters :
158
+ - gocyclo
159
+ - errcheck
160
+ - dupl
161
+ - gosec
162
+ # Run some linter only for test files by excluding its issues for everything else.
163
+ - path-except : _test\.go
164
+ linters :
165
+ - forbidigo
166
+ # Exclude known linters from partially hard-vendored code,
167
+ # which is impossible to exclude via `nolint` comments.
168
+ # `/` will be replaced by current OS file path separator to properly work on Windows.
169
+ - path : internal/hmac/
170
+ text : " weak cryptographic primitive"
171
+ linters :
172
+ - gosec
173
+ # Exclude some `staticcheck` messages.
174
+ - linters :
175
+ - staticcheck
176
+ text : " SA9003:"
177
+ # Exclude `lll` issues for long lines with `go:generate`.
178
+ - linters :
179
+ - lll
180
+ source : " ^//go:generate "
181
+ # Independently of option `exclude` we use default exclude patterns,
182
+ # it can be disabled by this option.
183
+ # To list all excluded by default patterns execute `golangci-lint run --help`.
184
+ # Default: true
185
+ exclude-use-default : true
186
+ # If set to true, `exclude` and `exclude-rules` regular expressions become case-sensitive.
187
+ # Default: false
188
+ exclude-case-sensitive : false
189
+ # Which dirs to exclude: issues from them won't be reported.
190
+ # Can use regexp here: `generated.*`, regexp is applied on full path,
191
+ # including the path prefix if one is set.
192
+ # Default dirs are skipped independently of this option's value (see exclude-dirs-use-default).
193
+ # "/" will be replaced by current OS file path separator to properly work on Windows.
194
+ # Default: []
195
+ exclude-dirs : []
196
+ # Enables exclude of directories:
197
+ # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
198
+ # Default: true
199
+ exclude-dirs-use-default : true
200
+ # Which files to exclude: they will be analyzed, but issues from them won't be reported.
201
+ # There is no need to include all autogenerated files,
202
+ # we confidently recognize autogenerated files.
203
+ # If it's not, please let us know.
204
+ # "/" will be replaced by current OS file path separator to properly work on Windows.
205
+ # Default: []
206
+ exclude-files : []
207
+ # Mode of the generated files analysis.
208
+ #
209
+ # - `strict`: sources are excluded by following strictly the Go generated file convention.
210
+ # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\.$`
211
+ # This line must appear before the first non-comment, non-blank text in the file.
212
+ # https://go.dev/s/generatedcode
213
+ # - `lax`: sources are excluded if they contain lines `autogenerated file`, `code generated`, `do not edit`, etc.
214
+ # - `disable`: disable the generated files exclusion.
215
+ #
216
+ # Default: lax
217
+ exclude-generated : strict
218
+ # The list of ids of default excludes to include or disable.
219
+ # https://golangci-lint.run/usage/false-positives/#default-exclusions
220
+ # Default: []
221
+ include : []
222
+ # Maximum issues count per one linter.
223
+ # Set to 0 to disable.
224
+ # Default: 50
225
+ max-issues-per-linter : 0
226
+ # Maximum count of issues with the same text.
227
+ # Set to 0 to disable.
228
+ # Default: 3
229
+ max-same-issues : 0
230
+ # Show only new issues: if there are unstaged changes or untracked files,
231
+ # only those changes are analyzed, else only changes in HEAD~ are analyzed.
232
+ # It's a super-useful option for integration of golangci-lint into existing large codebase.
233
+ # It's not practical to fix all existing issues at the moment of integration:
234
+ # much better don't allow issues in new code.
235
+ #
236
+ # Default: false
237
+ new : true
238
+ # Show only new issues created after git revision `REV`.
239
+ # Default: ""
240
+ new-from-rev : HEAD
241
+ # Show only new issues created in git patch with set file path.
242
+ # Default: ""
243
+ new-from-patch : " "
244
+ # Show issues in any part of update files (requires new-from-rev or new-from-patch).
245
+ # Default: false
246
+ whole-files : true
247
+ # Fix found issues (if it's supported by the linter).
248
+ # Default: false
249
+ fix : true
250
+ severity :
251
+ # Set the default severity for issues.
252
+ #
253
+ # If severity rules are defined and the issues do not match or no severity is provided to the rule
254
+ # this will be the default severity applied.
255
+ # Severities should match the supported severity names of the selected out format.
256
+ # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
257
+ # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#SeverityLevel
258
+ # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
259
+ # - TeamCity: https://www.jetbrains.com/help/teamcity/service-messages.html#Inspection+Instance
260
+ #
261
+ # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...)
262
+ #
263
+ # Default: ""
264
+ default-severity : error
265
+ # If set to true `severity-rules` regular expressions become case-sensitive.
266
+ # Default: false
267
+ case-sensitive : false
268
+ # When a list of severity rules are provided, severity information will be added to lint issues.
269
+ # Severity rules have the same filtering capability as exclude rules
270
+ # except you are allowed to specify one matcher per severity rule.
271
+ #
272
+ # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...)
273
+ #
274
+ # Only affects out formats that support setting severity information.
275
+ #
276
+ # Default: []
277
+ rules : []
0 commit comments