New ๐ŸŒŠ wave for @helm

Commit 0eb23eda

0eb23eda539cMerged

Svyatoslav Dumchenko <[email protected]> ยท 5 years ago ยท 1 file ยท +1 added

Description

add golangci-lint configuration

Details

Commit
0eb23eda539c
Parent
63d88ca3bdad

.golangci.ymladdedView file

1+# options for analysis running
2+run:
3+ timeout: 5m
4+
5+linters:
6+ enable-all: true
7+ disable:
8+ - interfacer
9+ - wrapcheck
10+ - maligned
11+ - scopelint
12+ - golint
13+ - nlreturn
14+ - gochecknoglobals
15+ - tagliatelle
16+ - deadcode
17+ - ifshort
18+ - gomnd
19+ - goerr113
20+ - godot
21+ - wsl
22+
23+# all available settings of specific linters
24+linters-settings:
25+
26+ cyclop:
27+ # the maximal code complexity to report
28+ max-complexity: 10
29+ # the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
30+ package-average: 0.0
31+ # should ignore tests (default false)
32+ skip-tests: false
33+
34+ dogsled:
35+ # checks assignments with too many blank identifiers; default is 2
36+ max-blank-identifiers: 2
37+
38+ dupl:
39+ # tokens count to trigger issue, 150 by default
40+ threshold: 100
41+
42+ errcheck:
43+ # report about not checking of errors in type assertions: `a := b.(MyStruct)`;
44+ # default is false: such cases aren't reported by default.
45+ check-type-assertions: false
46+
47+ # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
48+ # default is false: such cases aren't reported by default.
49+ check-blank: false
50+
51+ # [deprecated] comma-separated list of pairs of the form pkg:regex
52+ # the regex is used to ignore names within pkg. (default "fmt:.*").
53+ # see https://github.com/kisielk/errcheck#the-deprecated-method for details
54+ ignore: fmt:.*,io/ioutil:^Read.*
55+
56+ errorlint:
57+ # Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
58+ errorf: true
59+ # Check for plain type assertions and type switches
60+ asserts: true
61+ # Check for plain error comparisons
62+ comparison: true
63+
64+ exhaustive:
65+ # check switch statements in generated files also
66+ check-generated: false
67+ # indicates that switch statements are to be considered exhaustive if a
68+ # 'default' case is present, even if all enum members aren't listed in the
69+ # switch
70+ default-signifies-exhaustive: false
71+
72+ exhaustivestruct:
73+ # Struct Patterns is list of expressions to match struct packages and names
74+ # The struct packages have the form example.com/package.ExampleStruct
75+ # The matching patterns can use matching syntax from https://pkg.go.dev/path#Match
76+ # If this list is empty, all structs are tested.
77+ struct-patterns:
78+ - '*.Test'
79+ - 'example.com/package.ExampleStruct'
80+
81+ forbidigo:
82+ # Forbid the following identifiers (identifiers are written using regexp):
83+ forbid:
84+ - ^print.*$
85+ - 'fmt\.Print.*'
86+ # Exclude godoc examples from forbidigo checks. Default is true.
87+ exclude_godoc_examples: false
88+
89+ funlen:
90+ lines: 60
91+ statements: 40
92+
93+ gci:
94+ # put imports beginning with prefix after 3rd-party packages;
95+ # only support one prefix
96+ # if not set, use goimports.local-prefixes
97+ local-prefixes: github.com/org/project
98+
99+ gocognit:
100+ # minimal code complexity to report, 30 by default (but we recommend 10-20)
101+ min-complexity: 10
102+
103+ nestif:
104+ # minimal complexity of if statements to report, 5 by default
105+ min-complexity: 4
106+
107+ goconst:
108+ # minimal length of string constant, 3 by default
109+ min-len: 3
110+ # minimal occurrences count to trigger, 3 by default
111+ min-occurrences: 3
112+
113+ gocritic:
114+ enabled-tags:
115+ - diagnostic
116+ - experimental
117+ - opinionated
118+ - performance
119+ - style
120+
121+ disabled-checks:
122+ - commentedOutCode
123+ - typeSwitchVar
124+ - whyNoLint
125+
126+ settings:
127+ captLocal: # must be valid enabled check name
128+ # whether to restrict checker to params only (default true)
129+ paramsOnly: true
130+ elseif:
131+ # whether to skip balanced if-else pairs (default true)
132+ skipBalanced: true
133+ hugeParam:
134+ # size in bytes that makes the warning trigger (default 80)
135+ sizeThreshold: 80
136+ nestingReduce:
137+ # min number of statements inside a branch to trigger a warning (default 5)
138+ bodyWidth: 5
139+ rangeExprCopy:
140+ # size in bytes that makes the warning trigger (default 512)
141+ sizeThreshold: 512
142+ # whether to check test functions (default true)
143+ skipTestFuncs: true
144+ rangeValCopy:
145+ # size in bytes that makes the warning trigger (default 128)
146+ sizeThreshold: 32
147+ # whether to check test functions (default true)
148+ skipTestFuncs: true
149+ ruleguard:
150+ # path to a gorules file for the ruleguard checker
151+ rules: ''
152+ truncateCmp:
153+ # whether to skip int/uint/uintptr types (default true)
154+ skipArchDependent: true
155+ underef:
156+ # whether to skip (*x).method() calls where x is a pointer receiver (default true)
157+ skipRecvDeref: true
158+ unnamedResult:
159+ # whether to check exported functions
160+ checkExported: true
161+
162+ gocyclo:
163+ # minimal code complexity to report, 30 by default (but we recommend 10-20)
164+ min-complexity: 10
165+
166+ gofmt:
167+ # simplify code: gofmt with `-s` option, true by default
168+ simplify: true
169+
170+ gofumpt:
171+ # Choose whether or not to use the extra rules that are disabled
172+ # by default
173+ extra-rules: false
174+
175+ goimports:
176+
177+ gomoddirectives:
178+ # Allow local `replace` directives. Default is false.
179+ replace-local: false
180+ # List of allowed `replace` directives. Default is empty.
181+ replace-allow-list:
182+ - launchpad.net/gocheck
183+ # Allow to not explain why the version has been retracted in the `retract` directives. Default is false.
184+ retract-allow-no-explanation: false
185+ # Forbid the use of the `exclude` directives. Default is false.
186+ exclude-forbidden: false
187+
188+ gosec:
189+ # To select a subset of rules to run.
190+ # Available rules: https://github.com/securego/gosec#available-rules
191+ includes:
192+ - G401
193+ - G306
194+ - G101
195+ # To specify a set of rules to explicitly exclude.
196+ # Available rules: https://github.com/securego/gosec#available-rules
197+ excludes:
198+ - G204
199+ # To specify the configuration of rules.
200+ # The configuration of rules is not fully documented by gosec:
201+ # https://github.com/securego/gosec#configuration
202+ # https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102
203+ config:
204+ G306: "0600"
205+ G101:
206+ pattern: "(?i)example"
207+ ignore_entropy: false
208+ entropy_threshold: "80.0"
209+ per_char_threshold: "3.0"
210+ truncate: "32"
211+
212+ gosimple:
213+ # Select the Go version to target. The default is '1.13'.
214+ go: "1.16"
215+ # https://staticcheck.io/docs/options#checks
216+ checks: [ "all" ]
217+
218+ govet:
219+ # report about shadowed variables
220+ check-shadowing: false
221+
222+ # settings per analyzer
223+ settings:
224+ printf: # analyzer name, run `go tool vet help` to see all analyzers
225+ funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
226+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
227+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
228+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
229+ - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
230+
231+ enable-all: true
232+ disable:
233+ - shadow
234+
235+ lll:
236+ # max line length, lines longer will be reported. Default is 120.
237+ # '\t' is counted as 1 character by default, and can be changed with the tab-width option
238+ line-length: 120
239+ # tab width in spaces. Default to 1.
240+ tab-width: 1
241+
242+ makezero:
243+ # Allow only slices initialized with a length of zero. Default is false.
244+ always: false
245+
246+ misspell:
247+ # Correct spellings using locale preferences for US or UK.
248+ # Default is to use a neutral variety of English.
249+ # Setting locale to US will correct the British spelling of 'colour' to 'color'.
250+ locale: US
251+
252+ nakedret:
253+ # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
254+ max-func-lines: 30
255+
256+ prealloc:
257+ # XXX: we don't recommend using this linter before doing performance profiling.
258+ # For most programs usage of prealloc will be a premature optimization.
259+
260+ # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
261+ # True by default.
262+ simple: true
263+ range-loops: true # Report preallocation suggestions on range loops, true by default
264+ for-loops: false # Report preallocation suggestions on for loops, false by default
265+
266+ promlinter:
267+ # Promlinter cannot infer all metrics name in static analysis.
268+ # Enable strict mode will also include the errors caused by failing to parse the args.
269+ strict: false
270+ # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
271+ disabled-linters:
272+ # - "Help"
273+ # - "MetricUnits"
274+ # - "Counter"
275+ # - "HistogramSummaryReserved"
276+ # - "MetricTypeInName"
277+ # - "ReservedChars"
278+ # - "CamelCase"
279+ # - "lintUnitAbbreviations"
280+
281+ predeclared:
282+ # comma-separated list of predeclared identifiers to not report on
283+ ignore: ""
284+ # include method names and field names (i.e., qualified names) in checks
285+ q: false
286+
287+ nolintlint:
288+ # Enable to ensure that nolint directives are all used. Default is true.
289+ allow-unused: false
290+ # Disable to ensure that nolint directives don't have a leading space. Default is true.
291+ allow-leading-space: true
292+ # Exclude following linters from requiring an explanation. Default is [].
293+ allow-no-explanation: []
294+ # Enable to require an explanation of nonzero length after each nolint directive. Default is false.
295+ require-explanation: false
296+ # Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
297+ require-specific: true
298+
299+ staticcheck:
300+ # Select the Go version to target. The default is '1.13'.
301+ go: "1.16"
302+ # https://staticcheck.io/docs/options#checks
303+ checks: [ "all" ]
304+
305+ stylecheck:
306+ # Select the Go version to target. The default is '1.13'.
307+ go: "1.16"
308+ # https://staticcheck.io/docs/options#checks
309+ checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
310+ # https://staticcheck.io/docs/options#dot_import_whitelist
311+ dot-import-whitelist:
312+ - fmt
313+ # https://staticcheck.io/docs/options#initialisms
314+ initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS" ]
315+ # https://staticcheck.io/docs/options#http_status_code_whitelist
316+ http-status-code-whitelist: [ "200", "400", "404", "500" ]
317+
318+ testpackage:
319+ # regexp pattern to skip files
320+ skip-regexp: (export|internal)_test\.go
321+
322+ thelper:
323+ # The following configurations enable all checks. It can be omitted because all checks are enabled by default.
324+ # You can enable only required checks deleting unnecessary checks.
325+ test:
326+ first: true
327+ name: true
328+ begin: true
329+ benchmark:
330+ first: true
331+ name: true
332+ begin: true
333+ tb:
334+ first: true
335+ name: true
336+ begin: true
337+
338+ unparam:
339+ # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
340+ # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
341+ # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
342+ # with golangci-lint call it on a directory with the changed file.
343+ check-exported: false
344+
345+ unused:
346+ go: "1.16"
347+
348+ whitespace:
349+ multi-if: false # Enforces newlines (or comments) after every multi-line if statement
350+ multi-func: false # Enforces newlines (or comments) after every multi-line function signature
351+
352+severity:
353+ # Default value is empty string.
354+ # Set the default severity for issues. If severity rules are defined and the issues
355+ # do not match or no severity is provided to the rule this will be the default
356+ # severity applied. Severities should match the supported severity names of the
357+ # selected out format.
358+ # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
359+ # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
360+ # - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
361+ default-severity: error
362+
363+ # The default value is false.
364+ # If set to true severity-rules regular expressions become case sensitive.
365+ case-sensitive: false
366+
367+ # Default value is empty list.
368+ # When a list of severity rules are provided, severity information will be added to lint
369+ # issues. Severity rules have the same filtering capability as exclude rules except you
370+ # are allowed to specify one matcher per severity rule.
371+ # Only affects out formats that support setting severity information.
372+ rules:
373+ - linters:
374+ - dupl
375+ - revive
376+ - funlen
377+ - lll
378+ - godox
379+ - gocognit
380+ - nestif
381+ - gocyclo
382+ - cyclop
383+ severity: warning