Debian Codegraph @

.golangci.yaml

raw symbols SCIP
1 ---
2 # Options for analysis running.
3 run:
4 # Timeout for analysis, e.g. 30s, 5m.
5 # Default: 1m
6 timeout: 3m
7
8 issues:
9 # Maximum issues count per one linter.
10 # Set to 0 to disable.
11 # Default: 50
12 max-issues-per-linter: 0
13 # Maximum count of issues with the same text.
14 # Set to 0 to disable.
15 # Default: 3
16 max-same-issues: 0
17
18 linters:
19 enable:
20 # check when errors are compared without errors.Is
21 - errorlint
22
23 # check imports order and makes it always deterministic.
24 - gci
25
26 # linter to detect errors invalid key values count
27 - loggercheck
28
29 # Very Basic spell error checker
30 - misspell
31
32 # Forbid some imports
33 - depguard
34
35 # simple security check
36 - gosec
37
38 # Copyloopvar is a linter detects places where loop variables are copied.
39 # this hack was needed before golang 1.22
40 - copyloopvar
41
42 # Fast, configurable, extensible, flexible, and beautiful linter for Go.
43 # Drop-in replacement of golint.
44 - revive
45
46 # Finds sending http request without context.Context
47 - noctx
48
49 # make sure to use t.Helper() when needed
50 - thelper
51
52 # ensure that lint exceptions have explanations. Consider the case below:
53 - nolintlint
54
55 # detect duplicated words in code
56 - dupword
57
58 # detect the possibility to use variables/constants from the Go standard library.
59 - usestdlibvars
60
61 # mirror suggests rewrites to avoid unnecessary []byte/string conversion
62 - mirror
63
64 # testify checks good usage of github.com/stretchr/testify.
65 - testifylint
66
67 # Check whether the function uses a non-inherited context.
68 - contextcheck
69
70 linters-settings:
71 # configure the golang imports we don't want
72 depguard:
73 rules:
74 # Name of a rule.
75 main:
76 # Packages that are not allowed where the value is a suggestion.
77 deny:
78 - pkg: "github.com/pkg/errors"
79 desc: Should be replaced by standard lib errors package
80
81 - pkg: "golang.org/x/net/context"
82 desc: Should be replaced by standard lib context package
83
84
85 loggercheck: # invalid key values count
86 require-string-key: true
87 # Require printf-like format specifier (%s, %d for example) not present.
88 # Default: false
89 no-printf-like: true
90
91 usestdlibvars:
92 # Suggest the use of http.MethodXX.
93 # Default: true
94 http-method: true
95 # Suggest the use of http.StatusXX.
96 # Default: true
97 http-status-code: true
98 # Suggest the use of time.Weekday.String().
99 # Default: true
100 # We don't want this
101 time-weekday: false
102 # Suggest the use of constants available in time package
103 # Default: false
104 time-layout: true
105
106 nolintlint:
107 # Disable to ensure that all nolint directives actually have an effect.
108 # Default: false
109 allow-unused: true # too many false positive reported
110 # Exclude following linters from requiring an explanation.
111 # Default: []
112 allow-no-explanation: []
113 # Enable to require an explanation of nonzero length
114 # after each nolint directive.
115 # Default: false
116 require-explanation: true
117 # Enable to require nolint directives to mention the specific
118 # linter being suppressed.
119 # Default: false
120 require-specific: true
121
122 # define the import orders
123 gci:
124 sections:
125 # Standard section: captures all standard packages.
126 - standard
127 # Default section: catchall that is not standard or custom
128 - default
129 # linters that related to local tool, so they should be separated
130 - localmodule
131
132 staticcheck:
133 # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
134 checks: ["all"]
135
136 revive:
137 enable-all-rules: true
138 rules:
139 # we must provide configuration for linter that requires them
140 # enable-all-rules is OK, but many revive linters expect configuration
141 # and cannot work without them
142
143 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument
144 - name: context-as-argument
145 arguments:
146 - allowTypesBefore: "*testing.T"
147
148 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported
149 - name: exported
150 arguments:
151 # enables checking public methods of private types
152 - "checkPrivateReceivers"
153 # make error messages clearer
154 - "sayRepetitiveInsteadOfStutters"
155
156 # this linter completes revive errcheck linter, it will report method called without handling the error
157 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
158 - name: unhandled-error
159 arguments: # here are the exceptions we don't want to be reported
160 - "fmt.Print.*"
161 - "fmt.Fprint.*"
162 - "bytes.Buffer.Write"
163 - "bytes.Buffer.WriteByte"
164 - "bytes.Buffer.WriteString"
165 - "strings.Builder.WriteString"
166 - "strings.Builder.WriteRune"
167
168 # boolean parameters that create a control coupling could be useful
169 # but this one is way too noisy
170 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter
171 - name: flag-parameter
172 disabled: true
173
174 # even if in revive recommended ones the synthesio codebase uses it a lot
175 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports
176 - name: dot-imports
177 disabled: true
178
179 # depguard linter is easier to configure and more powerful
180 # than revive.imports-blocklist
181 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#imports-blocklist
182 - name: imports-blocklist
183 disabled: true
184
185 # functions with names prefixed with Get are supposed to return a value.
186 # it provides tons of false positive
187 # the most frequent is when an endpoint returns a http replies
188 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return
189 - name: get-return
190 disabled: true
191
192 # struct using nested struct is not a good practice
193 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#nested-structs
194 - name: nested-structs
195 disabled: true
196
197 # too noisy most of the time
198 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#add-constant
199 - name: add-constant
200 disabled: true # too noisy
201
202 # disable everything we don't want
203 - name: line-length-limit
204 disabled: true
205 - name: argument-limit
206 disabled: true
207 - name: cognitive-complexity
208 disabled: true
209 - name: banned-characters
210 disabled: true
211 - name: cyclomatic
212 disabled: true
213 - name: max-public-structs
214 disabled: true
215 - name: function-result-limit
216 disabled: true
217 - name: function-length
218 disabled: true
219 - name: file-header
220 disabled: true
221 - name: empty-lines
222 disabled: true
223
224 misspell:
225 locale: "US" # Fix the colour => color, and co