-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
166 lines (148 loc) · 3.49 KB
/
.golangci.yml
File metadata and controls
166 lines (148 loc) · 3.49 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
run:
timeout: 5m
issues-exit-code: 1
tests: true
build-tags: []
linters-settings:
errcheck:
check-type-assertions: true
check-blank: true
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/EvalOps/keep
govet:
enable-all: true
revive:
min-confidence: 0.8
rules:
- name: var-naming
- name: package-comments
- name: exported
- name: var-declaration
- name: blank-imports
- name: context-as-argument
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: if-return
- name: increment-decrement
- name: indent-error-flow
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: unused-parameter
- name: unreachable-code
- name: flag-parameter
- name: unnecessary-stmt
- name: struct-tag
- name: atomic
- name: empty-block
- name: superfluous-else
- name: confusing-naming
- name: get-return
- name: modifies-parameter
- name: confusing-results
- name: deep-exit
- name: unused-receiver
- name: add-constant
- name: flag-parameter
- name: unnecessary-stmt
- name: defer
gosec:
excludes:
- G101 # Hardcoded credentials - we handle this via secret management
- G104 # Unhandled errors - covered by errcheck
- G204 # Command injection - intentional for system commands
staticcheck:
checks: ["all"]
gci:
sections:
- standard
- default
- prefix(github.com/EvalOps/keep)
goconst:
min-len: 2
min-occurrences: 2
linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- gofmt
- goimports
- revive
- gosec
- gocyclo
- goconst
- gci
- misspell
- prealloc
- unconvert
- unparam
- whitespace
- gofumpt
- godox
- bodyclose
- gocritic
- goprintffuncname
- nolintlint
issues:
exclude-dirs:
- vendor
exclude-files:
- ".*\\.pb\\.go$"
- ".*_generated\\.go$"
exclude-rules:
# Allow long lines in tests for readability
- path: "_test\\.go"
linters:
- lll
# Allow deep nesting in tests
- path: "_test\\.go"
linters:
- gocyclo
# Allow TODO comments in development
- linters:
- godox
text: "TODO"
# Allow specific patterns
- text: "should have comment or be unexported"
linters:
- revive
path: "_test\\.go"
# Allow unhandled errors in main functions (handled by log.Fatal)
- path: "cmd/.*main\\.go"
linters:
- errcheck
text: "Error return value of.*not checked"
# Allow log.Fatal in CLI command functions
- path: "cmd/.*main\\.go"
linters:
- revive
text: "calls to log.Fatalf only in main"
# Allow higher complexity in server initialization functions
- path: "services/.*/server\\.go"
linters:
- gocyclo
text: "func.*New.*is high"
# Allow higher complexity in server start functions
- path: "services/.*/server\\.go"
linters:
- gocyclo
text: "func.*Start.*is high"
output:
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
severity:
default-severity: error
case-sensitive: false