-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
181 lines (163 loc) · 4.89 KB
/
Copy path.golangci.yml
File metadata and controls
181 lines (163 loc) · 4.89 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
version: "2"
run:
issues-exit-code: 1
tests: true
timeout: 5m
modules-download-mode: readonly # Add: faster CI
output:
formats:
text:
path: stdout
colors: true
linters:
default: all
enable:
- gomodguard_v2 # replaces deprecated gomodguard
disable:
# Deprecated
- wsl
- gomodguard # superseded by gomodguard_v2
# Too noisy / impractical
- exhaustruct
- varnamelen
- funlen
- testpackage
- gochecknoglobals
- err113
- paralleltest # Too noisy for existing tests
- nestif # Nested if complexity - address gradually
- mnd # Magic number detector - too noisy
- lll # Line length - too strict
- goconst # Repeated strings - too noisy
- funcorder # Function order - style preference
- godoclint # Doc comments - address gradually
- nonamedreturns # Named returns are fine
- rowserrcheck # False positive on wrapped rows
- spancheck # False positive on span helper functions
- dupl # Duplicate code detection - too aggressive
- usetesting # t.Setenv instead of os.Setenv - low priority
- prealloc # Slice preallocation - micro-optimization
- maintidx # Maintainability index - address gradually
- forbidigo # Forbid patterns - needs config
- gosmopolitan # Internationalization - not needed
- inamedparam # Interface param names - style preference
- recvcheck # Receiver name check - style preference
- noinlineerr # Inline errors - style preference
- exhaustive # Exhaustive switches - too noisy
- nilnil # nil,nil returns - sometimes valid
- nilerr # nil error returns - sometimes valid
- errchkjson # JSON error checks - too noisy
- contextcheck # Context propagation - too strict
- gocheckcompilerdirectives # go:fix is valid in Go 1.26+
# Style preferences
- nlreturn
- wrapcheck
- ireturn
- depguard
- tagliatelle
- godox # Consider: allows TODO/FIXME
settings:
gocyclo:
min-complexity: 40 # Default is 30, raised for complex but unavoidable functions
cyclop:
max-complexity: 40 # Default is 10, raised for complex but unavoidable functions
gocognit:
min-complexity: 80 # Default is 30, raised to only catch worst offenders
errcheck:
check-blank: false
check-type-assertions: false
exclude-functions:
# Common Close operations
- (io.Closer).Close
- (*os.File).Close
- (*database/sql.DB).Close
- (*database/sql.Rows).Close
- (*database/sql.Tx).Rollback
- (*database/sql.Stmt).Close
# Print functions
- (net/http.ResponseWriter).Write
- fmt.Fprintf
- fmt.Printf
- fmt.Println
- (*text/tabwriter.Writer).Flush
# JSON encode/decode
- (*encoding/json.Encoder).Encode
- (*encoding/json.Decoder).Decode
# File operations
- os.RemoveAll
- os.Remove
- filepath.WalkDir
gocritic:
disabled-checks:
- unlambda
- ifElseChain # Style preference
- assignOp # Style preference
- exitAfterDefer # False positive in main functions
- deprecatedComment # Style preference
misspell:
locale: US
ignore-rules:
- noteable
revive:
rules:
- name: exported
disabled: true
- name: unexported-return
disabled: true
gosec:
excludes:
- G304 # File path provided as taint input
- G204 # Subprocess launched with variable
- G602 # Slice bounds - too many false positives
- G109 # Int overflow in atoi - rarely an issue
- G115 # Int overflow conversion - rarely an issue for these sizes
- G104 # Unhandled errors - already covered by errcheck
- G301 # Dir perms 0755 is fine for data dirs
- G306 # File perms 0644 is fine for config
- G202 # SQL concatenation - these are safe table names
- G703 # Path traversal - paths are already sanitized or internal
- G706 # Log injection - using %q format
- G118 # Context cancel - called via defer in goroutine
govet:
enable-all: true
disable:
- fieldalignment
- shadow # Too many false positives
- unusedwrite # Too noisy in tests
lll:
line-length: 80
exclusions:
generated: lax
paths:
- web
- website
rules:
- path: _test\.go
linters:
- goconst
- mnd
- dupl
- errcheck
- gosec
- forcetypeassert
- gocritic
- unparam
- noctx
- modernize
- path: main\.go|cmd/
linters:
- gochecknoinits
- errcheck
formatters:
enable:
- gci
- gofmt
- gofumpt
settings:
gci:
sections:
- standard
- default
- localmodule # Add: groups your module's imports
exclusions:
generated: lax