crossplane
/
.golangci.yml
215 строк · 6.6 Кб
1run:
2timeout: 10m
3
4skip-files:
5- "zz_generated\\..+\\.go$"
6
7output:
8# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
9format: colored-line-number
10
11linters-settings:
12errcheck:
13# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
14# default is false: such cases aren't reported by default.
15check-type-assertions: false
16
17# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
18# default is false: such cases aren't reported by default.
19check-blank: false
20
21# [deprecated] comma-separated list of pairs of the form pkg:regex
22# the regex is used to ignore names within pkg. (default "fmt:.*").
23# see https://github.com/kisielk/errcheck#the-deprecated-method for details
24ignore: fmt:.*,io/ioutil:^Read.*
25
26govet:
27# report about shadowed variables
28check-shadowing: false
29
30gofmt:
31# simplify code: gofmt with `-s` option, true by default
32simplify: true
33
34gci:
35custom-order: true
36sections:
37- standard
38- default
39- prefix(github.com/crossplane/crossplane-runtime)
40- prefix(github.com/crossplane/crossplane)
41- blank
42- dot
43
44gocyclo:
45# minimal code complexity to report, 30 by default (but we recommend 10-20)
46min-complexity: 10
47
48maligned:
49# print struct with more effective memory layout or not, false by default
50suggest-new: true
51
52dupl:
53# tokens count to trigger issue, 150 by default
54threshold: 100
55
56goconst:
57# minimal length of string constant, 3 by default
58min-len: 3
59# minimal occurrences count to trigger, 3 by default
60min-occurrences: 5
61
62lll:
63# tab width in spaces. Default to 1.
64tab-width: 1
65
66unused:
67# treat code as a program (not a library) and report unused exported identifiers; default is false.
68# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
69# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
70# with golangci-lint call it on a directory with the changed file.
71check-exported: false
72
73unparam:
74# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
75# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
76# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
77# with golangci-lint call it on a directory with the changed file.
78check-exported: false
79
80nakedret:
81# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
82max-func-lines: 30
83
84prealloc:
85# XXX: we don't recommend using this linter before doing performance profiling.
86# For most programs usage of prealloc will be a premature optimization.
87
88# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
89# True by default.
90simple: true
91range-loops: true # Report preallocation suggestions on range loops, true by default
92for-loops: false # Report preallocation suggestions on for loops, false by default
93
94gocritic:
95# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
96# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
97enabled-tags:
98- performance
99
100settings: # settings passed to gocritic
101captLocal: # must be valid enabled check name
102paramsOnly: true
103rangeValCopy:
104sizeThreshold: 32
105
106nolintlint:
107require-explanation: true
108require-specific: true
109
110
111linters:
112enable:
113- megacheck
114- govet
115- gocyclo
116- gocritic
117- goconst
118- gci
119- gofmt # We enable this as well as goimports for its simplify mode.
120- prealloc
121- revive
122- unconvert
123- misspell
124- nakedret
125- nolintlint
126
127disable:
128# These linters are all deprecated as of golangci-lint v1.49.0. We disable
129# them explicitly to avoid the linter logging deprecation warnings.
130- deadcode
131- varcheck
132- scopelint
133- structcheck
134- interfacer
135
136presets:
137- bugs
138- unused
139fast: false
140
141
142issues:
143# Excluding configuration per-path and per-linter
144exclude-rules:
145# Exclude some linters from running on tests files.
146- path: _test(ing)?\.go
147linters:
148- gocyclo
149- errcheck
150- dupl
151- gosec
152- scopelint
153- unparam
154
155# Ease some gocritic warnings on test files.
156- path: _test\.go
157text: "(unnamedResult|exitAfterDefer)"
158linters:
159- gocritic
160
161# These are performance optimisations rather than style issues per se.
162# They warn when function arguments or range values copy a lot of memory
163# rather than using a pointer.
164- text: "(hugeParam|rangeValCopy):"
165linters:
166- gocritic
167
168# This "TestMain should call os.Exit to set exit code" warning is not clever
169# enough to notice that we call a helper method that calls os.Exit.
170- text: "SA3000:"
171linters:
172- staticcheck
173
174- text: "k8s.io/api/core/v1"
175linters:
176- goimports
177
178# This is a "potential hardcoded credentials" warning. It's triggered by
179# any variable with 'secret' in the same, and thus hits a lot of false
180# positives in Kubernetes land where a Secret is an object type.
181- text: "G101:"
182linters:
183- gosec
184- gas
185
186# This is an 'errors unhandled' warning that duplicates errcheck.
187- text: "G104:"
188linters:
189- gosec
190- gas
191
192# Some k8s dependencies do not have JSON tags on all fields in structs.
193- path: k8s.io/
194linters:
195- musttag
196
197# Independently from option `exclude` we use default exclude patterns,
198# it can be disabled by this option. To list all
199# excluded by default patterns execute `golangci-lint run --help`.
200# Default value for this option is true.
201exclude-use-default: false
202
203# Show only new issues: if there are unstaged changes or untracked files,
204# only those changes are analyzed, else only changes in HEAD~ are analyzed.
205# It's a super-useful option for integration of golangci-lint into existing
206# large codebase. It's not practical to fix all existing issues at the moment
207# of integration: much better don't allow issues in new code.
208# Default is false.
209new: false
210
211# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
212max-per-linter: 0
213
214# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
215max-same-issues: 0
216