-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy path.golangci.yaml
More file actions
205 lines (196 loc) · 5.54 KB
/
.golangci.yaml
File metadata and controls
205 lines (196 loc) · 5.54 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
version: "2"
linters:
settings:
govet:
enable:
- shadow
- fieldalignment
gocyclo:
min-complexity: 15
cyclop:
max-complexity: 15
package-average: 10.0
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
misspell:
locale: US
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- rangeValCopy
- unnamedResult
- whyNoLint
- wrapperFunc
funlen:
lines: 120
statements: 50
gocognit:
min-complexity: 20
lll:
line-length: 120
varnamelen:
min-name-length: 2
ignore-names:
- err
- i
- j
- k
- v
- id
- ok
- db
nolintlint:
allow-unused: false
require-explanation: false
require-specific: true
exhaustive:
default-signifies-exhaustive: true
depguard:
rules:
main:
files:
- $all
allow:
- $gostd
- spotinfo/internal/spot
- spotinfo/internal
- spotinfo/internal/mcp
- github.com/jedib0t/go-pretty/v6
- github.com/urfave/cli/v2
- github.com/stretchr/testify
- github.com/mark3labs/mcp-go
- github.com/spf13/cast
- github.com/bluele/gcache
- golang.org/x/time
- github.com/aws/aws-sdk-go-v2
- github.com/aws/smithy-go
- github.com/jedib0t/go-pretty/v6/table
- github.com/jedib0t/go-pretty/v6/text
testifylint:
enable-all: true
tagalign:
align: true
sort: true
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
default: none
enable:
# Essential bug-finding linters
- errcheck # Check for unchecked errors
- gosec # Security issues
- govet # Go vet built-in checks
- ineffassign # Ineffective assignments
- staticcheck # Comprehensive static analysis
- unused # Unused code
- errorlint # Error wrapping issues
# Code quality and best practices
- bodyclose # HTTP response body close check
- contextcheck # Context usage patterns
- copyloopvar # Loop variable copying issues
- cyclop # Cyclomatic complexity
- depguard # Import restrictions
- dupl # Code duplication
- exhaustive # Switch statement exhaustiveness
- funlen # Function length
- goconst # Repeated strings that could be constants
- gocritic # Comprehensive go code critic
- gocyclo # Cyclomatic complexity
- makezero # Slice initialization
- nakedret # Naked returns
- nestif # Nested if statements
- nilerr # Nil error returns
- nilnil # Nil error and value returns
# - noctx # HTTP without context - disabled: too verbose for initialization and error handling code
- predeclared # Predeclared identifier shadowing
- rowserrcheck # SQL rows.Err() check
- sqlclosecheck # SQL close checks
- unconvert # Unnecessary conversions
- unparam # Unused parameters
- wastedassign # Wasted assignments
# Performance-related
- prealloc # Slice preallocation
# Additional best practices (keep important ones)
- durationcheck # Duration multiplication
- errname # Error naming conventions
- interfacebloat # Interface size
- maintidx # Maintainability index
- mirror # Wrong mirror patterns
- mnd # Magic numbers
- nilnesserr # Nil check patterns
- nosprintfhostport # Sprintf host:port misuse
- reassign # Package variable reassignment
- forcetypeassert # Type assertion without check
# Explicitly disabled linters with reasons
# - gochecknoglobals # Too restrictive for CLI apps that need global flags/config
# - gocognit # Redundant with cyclop
# - godox # TODO comments are fine during development
# - goheader # Not needed for this project
# - gomoddirectives # Too restrictive for development
# - gosmopolitan # Not needed for this project
# - forbidigo # Too restrictive
# - iface # Too opinionated
# - inamedparam # Too verbose
# - intrange # Go 1.22+ feature not always available
exclusions:
rules:
- path: '(.+)\.go$'
text: Using the variable on range scope `tt` in function literal
- path: '(.+)_test\.go'
linters:
- funlen
- gocyclo
- cyclop
- dupl
- lll
- varnamelen
- exhaustruct
- nolintlint
- testpackage
- wsl
- govet
- errcheck
- goconst
- gocritic
- staticcheck
- unused
- gosec
- path: 'mocks_test\.go'
linters:
- stylecheck
- revive
- golint
- staticcheck
- unused
- deadcode
- typecheck
- path: 'cmd/main\.go'
linters:
- exhaustruct
- linters:
- lll
source: "^//go:generate "
formatters:
enable:
- gci
- gofmt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(spotinfo)
goimports:
local-prefixes:
- spotinfo