-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy path.golangci.yml
More file actions
307 lines (264 loc) · 11 KB
/
Copy path.golangci.yml
File metadata and controls
307 lines (264 loc) · 11 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# GolangCI-Lint v2 Configuration for gogpu/gg - Pure Go 2D Graphics Library
# Documentation: https://golangci-lint.run/docs/configuration/
version: "2"
run:
timeout: 5m
tests: true
linters:
enable:
# Code quality and complexity
- gocyclo # Check cyclomatic complexity
- gocognit # Check cognitive complexity
- funlen # Check function length
- maintidx # Maintainability index
- cyclop # Check cyclomatic complexity (alternative)
- nestif # Reports deeply nested if statements
# Bug detection
- govet # Standard Go vet
- staticcheck # Comprehensive static analysis
- errcheck # Check that errors are handled
- errorlint # Check error wrapping
# gosec disabled: v2.23.0 panics on float constants (securego/gosec#1502)
# Re-enable after golangci-lint ships gosec ≥2.23.1
# - gosec
- nilnil # Check that functions don't return nil both ways
- nilerr # Check nil error returns
- ineffassign # Detect ineffectual assignments
# Code style and consistency
- misspell # Check for misspelled words
- whitespace # Check for trailing whitespace
- unconvert # Remove unnecessary type conversions
- unparam # Detect unused function parameters
# Naming conventions
- errname # Check error naming conventions
- revive # Fast, configurable, extensible linter
# Performance
- prealloc # Find slice declarations that could be preallocated
- makezero # Find slice declarations with non-zero initial length
# Code practices
- goconst # Find repeated strings that could be constants
- gocritic # Comprehensive code checker
- goprintffuncname # Check printf-like function names
- nolintlint # Check nolint directives are used correctly
- nakedret # Checks for naked returns
# Additional quality checkers
- dupl # Detect duplicate code
- dogsled # Check for assignments with too many blank identifiers
- durationcheck # Check for two durations multiplied together
settings:
govet:
enable:
- copylocks
disable:
- fieldalignment
gocyclo:
min-complexity: 20
cyclop:
max-complexity: 20
funlen:
lines: 120
statements: 60
gocognit:
min-complexity: 30
misspell:
locale: US
nestif:
min-complexity: 4
goconst:
min-occurrences: 10 # enum String() methods share common names ("Auto", "None", "Size") across files
ignore-string-values:
- "Unknown"
revive:
rules:
- name: var-naming
- name: error-return
- name: error-naming
- name: if-return
- name: increment-decrement
- name: var-declaration
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unreachable-code
- name: redefines-builtin-id
gocritic:
enabled-tags:
- diagnostic
- style
- performance
disabled-checks:
- commentFormatting
- whyNoLint
- unnamedResult
- commentedOutCode
- octalLiteral
- paramTypeCombine
settings:
hugeParam:
sizeThreshold: 256
exclusions:
paths:
- tmp
rules:
# Test files - allow more flexibility
- path: _test\.go
linters:
- gocyclo
- cyclop
- funlen
- maintidx
- errcheck
- gosec
- goconst
- dupl
- gocognit
# Internal font handling
- path: internal/fontkit/.*\.go
linters:
- funlen # Font parsing is verbose
- gocyclo # Font handling can be complex
# Internal image processing (v0.3.0)
- path: internal/image/.*\.go
linters:
- gocyclo # Interpolation algorithms are complex
- funlen # Image processing is verbose
- cyclop # Complex branching in sampling
- gocognit # Bilinear/bicubic inherently complex
- gosec # Integer conversions are intentional in image processing
# Internal clipping (v0.3.0)
- path: internal/clip/.*\.go
linters:
- gocyclo # Cohen-Sutherland, curve clipping
- funlen # Clipping algorithms are verbose
- cyclop # Complex edge cases
- gocognit # Geometric algorithms
# Internal blend modes (v0.3.0)
- path: internal/blend/.*\.go
linters:
- gocyclo # Many blend modes = many branches
- cyclop # Porter-Duff has many cases
- funlen # GetBlendFunc is a large switch statement
# Internal filter effects (TASK-099b)
- path: internal/filter/.*\.go
linters:
- gocyclo # Blur convolution loops are complex
- funlen # Filter algorithms are verbose
- cyclop # Complex bounds checking
- gocognit # Separable blur inherently complex
- gosec # Integer conversions are intentional in filter processing
# Text script detection (TEXT-004)
- path: text/script\.go
linters:
- gocyclo # Unicode script detection requires many branches
- cyclop # Many Unicode ranges to check
- gocognit # Inherently complex due to Unicode
# Emoji detection and sequence handling (TASK-050i)
- path: text/emoji/.*\.go
linters:
- gocyclo # Emoji Unicode ranges require many branches
- cyclop # Many emoji ranges to check
- gocognit # Inherently complex due to Unicode spec
- funlen # Emoji range functions are necessarily verbose
- maintidx # Unicode lookups inherently complex
# Scene package blend mode mapping (TASK-099)
- path: scene/encoding\.go
linters:
- gocyclo # String() for 28 blend modes is a large switch
- cyclop # Same reason - mode classification methods
- funlen # String() is necessarily large with 28 cases
- path: scene/blend_integration\.go
linters:
- gocyclo # Mode mapping switch statements are necessarily large
- cyclop # Same reason
- funlen # Conversion functions map all 28+ modes
# Internal packages that intentionally shadow stdlib names.
# These are INTERNAL packages — renaming would be a massive refactor
# for no benefit. The names match their domain (color, image, path).
- path: internal/color/.*\.go
linters:
- revive # var-naming: package name shadows stdlib color
- path: internal/image/.*\.go
linters:
- revive # var-naming: package name shadows stdlib image
- path: internal/path/.*\.go
linters:
- revive # var-naming: package name shadows stdlib path
# TrueType bytecode interpreter - skrifa port (1:1 translation from Rust)
# Algorithmic complexity is inherent to virtual machine instruction dispatch
- path: text/tt_.*\.go
linters:
- gocognit # Outline ops (MDRP/MIRP) are algorithmically complex
- gocyclo # Error enum switch and dispatch are large
- cyclop # Same — faithful port of skrifa round/error functions
- nestif # Deep nesting inherent to point movement with fallbacks
- funlen # Skrifa port functions are inherently long (1:1 translation)
- errname # tt-prefixed error names match subsystem convention
- maintidx # Opcode dispatch has inherently low maintainability index
# CPU rasterization CORE - Skia AAA port (1:1 translation from C++)
# Algorithmic complexity is inherent to edge-walk rasterization algorithms
- path: internal/raster/.*\.go
linters:
- gocognit # Skia trapezoid walker and convex walker are complex algorithms
- gocyclo # Same — ported Skia edge-walk algorithms
- cyclop # Same — complex control flow in rasterization
- nestif # Deep nesting inherent to multi-path edge walker (rect/general)
- funlen # Skia port functions are inherently long (1:1 translation)
- maintidx # Skia port has low maintainability index by design
# Vello compute pipeline port - 1:1 translation from Rust/WGSL (v0.30.0)
# Algorithmic complexity is inherent to GPU compute pipeline stages
- path: internal/gpu/tilecompute/.*\.go
linters:
- gocognit # GPU pipeline stages are algorithmically complex
- gocyclo # Same — ported GPU algorithms
- cyclop # Same — complex control flow in GPU stages
- nestif # Deep nesting inherent to tile walk algorithms
- funlen # GPU stages are verbose
- maintidx # GPU pipeline stages have inherently low maintainability index
- gocritic # Ported patterns (ifElseChain, badCond for degenerate checks)
- nolintlint # Stale directives from porting
# Vello GPU accelerator and compute dispatcher (v0.30.0)
# Complex diagnostic logging and buffer management for 9-stage pipeline
- path: internal/gpu/vello_accelerator\.go
linters:
- gocognit # Diagnostic logging inspects all 9 pipeline stages
- gocyclo # Same — complex diagnostic function
- cyclop # Same — complex cyclomatic complexity
- funlen # logPipelineDiagnostics inspects all pipeline buffers
- maintidx # Same — diagnostic function has many branches
- nestif # Buffer readback error handling requires deep nesting
- unparam # numPaths reserved for future per-path diagnostics
# GPU render pipelines - structurally similar WebGPU pipeline descriptors
# Each pipeline (SDF, convex, stencil, text, glyph mask, LCD) has its own
# CreateRenderPipeline call with unique labels, shaders, and vertex layouts.
# The boilerplate structure is identical but the content differs per tier.
- path: internal/gpu/.*\.go
linters:
- dupl # Pipeline creation boilerplate is not real duplication
# Example code - demonstration purposes
- path: examples?/.*\.go
linters:
- errcheck
- errorlint
- funlen
- gocyclo
- cyclop
- gocognit
- godot
- revive
- gosec
- gocritic
# Demo command
- path: cmd/.*\.go
linters:
- errcheck
- funlen
- gocyclo
issues:
max-issues-per-linter: 0
max-same-issues: 0
new: false