-
Notifications
You must be signed in to change notification settings - Fork 409
Expand file tree
/
Copy path.golangci.yaml
More file actions
183 lines (168 loc) · 4.53 KB
/
Copy path.golangci.yaml
File metadata and controls
183 lines (168 loc) · 4.53 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
version: "2"
run:
# Go version to use for running golangci-lint
go: "1.26"
# Build tags to be passed to all linters
build-tags:
- dockerhub
- ghcr
linters:
# Disable default linters to use only explicitly enabled ones
default: none
# List of linters to enable
enable:
- bodyclose
- copyloopvar
- depguard
- errcheck
- forcetypeassert
- goconst
- gosec
- govet
- ineffassign
- lll
- misspell
- nakedret
- revive
- staticcheck
- unconvert
- unparam
- unused
settings:
depguard:
rules:
main:
deny:
# Avoid reintroduction of `github.com/pkg/errors` package
- pkg: github.com/pkg/errors
desc: Should use `errors` package from the standard library
errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`
# Default is false: such cases aren't reported by default
check-type-assertions: false
# Report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`
# Default is false: such cases aren't reported by default
check-blank: false
goconst:
# Minimal length of string constant, 3 by default
min-len: 3
# Minimal occurrences count to trigger, 3 by default
min-occurrences: 3
govet:
enable:
# Report about shadowed variables
- shadow
lll:
# Max line length, lines longer will be reported. Default is 120
line-length: 120
# Tab width in spaces. Default to 2
tab-width: 2
misspell:
# Correct spellings using locale preferences for US or UK
# Default is to use a neutral variety of English
# Setting locale to US will correct the British spelling of 'colour' to 'color'
locale: US
nakedret:
# Make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 30
revive:
# Based on https://github.com/mgechev/revive#recommended-configuration
confidence: 0.8
severity: warning
rules:
# Deny naked return always
- name: bare-return
severity: error
- name: blank-imports
- name: bool-literal-in-expr
- name: context-as-argument
- name: context-keys-type
- name: datarace
- name: defer
- name: early-return
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: exported
- name: if-return
- name: import-shadowing
- name: indent-error-flow
- name: increment-decrement
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: superfluous-else
- name: time-equal
- name: time-naming
- name: var-declaration
- name: unexported-naming
# Handle error always
- name: unhandled-error
# Ignore following functions
arguments:
- fmt.Print
- fmt.Fprintf
- fmt.Fprintln
- fmt.Printf
- fmt.Println
severity: error
- name: unused-parameter
- name: use-any
- name: useless-break
- name: waitgroup-by-value
# Explicitly disabled rules
- name: var-naming
# Disable because it conflicts with protobuf naming convention like "Id"
disabled: true
unparam:
# Inspect exported functions, default is false
# Set to true if no external program/library imports your code
check-exported: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- goconst
- gosec
path: (.+)_test\.go
paths:
- .*/*_types.go
- .*/groupversion_info.go
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(github.com/akuity)
- dot
- blank
custom-order: true
gofmt:
# Simplify code: gofmt with `-s` option
simplify: true
goimports:
# Put imports beginning with prefix after 3rd-party packages
local-prefixes:
- github.com/org/project
exclusions:
generated: lax
paths:
- .*/*_types.go
- .*/groupversion_info.go
- third_party$
- builtin$
- examples$