-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.golangci.yml
More file actions
102 lines (102 loc) · 3.1 KB
/
.golangci.yml
File metadata and controls
102 lines (102 loc) · 3.1 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
version: "2"
run:
tests: true
linters:
enable:
- goconst
- gocritic
- gocyclo
- misspell
- revive
- unconvert
- unparam
settings:
errcheck:
check-type-assertions: false # Type is verified before assertion in our code patterns
check-blank: false # We use _ intentionally for delete operations that may fail
goconst:
min-len: 3
min-occurrences: 3
gocyclo:
min-complexity: 15
govet:
enable-all: true
disable:
- shadow # Variable shadowing with err is common Go pattern, not a bug
exclusions:
generated: strict
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- errcheck
- goconst
- gocyclo
path: _test\.go
# Ignore stuttering warnings for type aliases from generated API client
- linters:
- revive
text: "stutters"
path: internal/(alerts|datasets|ingestion|warnings|rules|datasources|orgs|users)/client\.go
# Ignore errcheck for cobra flag getters - these only fail if flag name doesn't exist
# which is a programming error caught at startup, not a runtime error
- linters:
- errcheck
text: "GetString|GetBool|GetInt|GetFloat|Set"
path: internal/(commands|output)/
# Ignore errcheck in test utilities - test failures surface issues
- linters:
- errcheck
path: internal/testutil/
# Ignore unused parameters in test files - mock handlers legitimately ignore params
- linters:
- revive
text: "unused-parameter"
path: _test\.go
# Ignore unused parameters in command files - cobra handlers often don't use cmd/args
- linters:
- revive
text: "unused-parameter"
path: internal/commands/
# Ignore field alignment in test files - not critical for test code
- linters:
- govet
text: "fieldalignment"
path: _test\.go
# Ignore remaining field alignment warnings - micro-optimization with diminishing returns
# These structs are short-lived request parameters, not worth further optimization
- linters:
- govet
text: "fieldalignment"
path: internal/(apierror|cloud_sources|datasets|ingestion|output|stored_items)/
# Ignore package naming with underscores - matches backend entity names
- linters:
- revive
text: "don't use an underscore in package name"
path: internal/(cloud_sources|stored_items|rule_versions)/
# Ignore errors package name warning - internal packages can use common names
- linters:
- revive
text: "avoid package names that conflict with Go standard library"
path: internal/errors/
paths:
- third_party$
- builtin$
- examples$
- internal/api/client\.gen\.go$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$