-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.golangci.yml
More file actions
153 lines (136 loc) · 3.84 KB
/
Copy path.golangci.yml
File metadata and controls
153 lines (136 loc) · 3.84 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
version: "2"
run:
timeout: 5m
formatters:
enable:
- gofmt
- goimports
linters:
default: none
enable:
# Bugs
- errcheck
- govet
- staticcheck # includes gosimple and stylecheck
- bodyclose
- durationcheck
- nilerr
- noctx
- rowserrcheck
- sqlclosecheck
- gosec
- errorlint
- makezero
- nosprintfhostport
- reassign
# Performance
- ineffassign
- unconvert
- copyloopvar
- intrange
# Unused code
- unused
# Style & consistency
- revive
- gocritic
- misspell
- dupword
- godot
- goprintffuncname
- errname
- predeclared
- asciicheck
- bidichk
- usestdlibvars
- whitespace
# Maintainability
- dupl
- funlen
- cyclop
- gocyclo
- gocognit
# Additional quality checks (zero issues currently)
- unparam # Reports unused function parameters
- forcetypeassert # Finds forced type assertions
- nakedret # Checks naked returns in long functions
- recvcheck # Checks receiver type consistency
- wastedassign # Finds wasted assignments
- thelper # Checks t.Helper() in test helpers
- perfsprint # Suggests faster fmt alternatives
- testableexamples # Checks examples have expected output
- nolintlint # Reports ill-formed nolint directives
- dogsled # Checks for too many blank identifiers
- gocheckcompilerdirectives # Validates //go: directives
- usetesting # Reports deprecated testing funcs
- mirror # Checks bytes/strings usage patterns
- nilnil # Checks for nil error + nil value returns
- modernize # Suggests modern Go idioms (slices, maps, max/min)
- goconst # Finds repeated strings to make constants
- prealloc # Suggests pre-allocating slices
- exhaustive # Checks switch statement exhaustiveness
- nestif # Reports deeply nested if statements
settings:
funlen:
lines: 80
statements: 50
cyclop:
# Inflection rules have many branches; 25 is reasonable for this domain
max-complexity: 25
gocyclo:
# Inflection rules have many branches; 25 is reasonable for this domain
min-complexity: 25
gocognit:
# Inflection rules are inherently complex with many branches
min-complexity: 40
dupl:
threshold: 150
gocritic:
enabled-tags:
- diagnostic
- style
- performance
disabled-checks:
- hugeParam # Not relevant for this library
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
staticcheck:
checks:
- all
- -ST1000 # Package comments not required
- -ST1003 # Underscore in package name OK
exclusions:
# Test files can have longer functions and more complexity
rules:
- path: _test\.go
linters:
- funlen
- cyclop
- gocyclo
- gocognit
- dupl
- dupword # Test data legitimately contains repeated words
- goconst # Test data legitimately contains repeated strings