1- linters-settings :
2- errcheck :
3- # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
4- # default is false: such cases aren't reported by default.
5- check-type-assertions : false
6-
7- # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
8- # default is false: such cases aren't reported by default.
9- check-blank : false
10-
11- # [deprecated] comma-separated list of pairs of the form pkg:regex
12- # the regex is used to ignore names within pkg. (default "fmt:.*").
13- # see https://github.com/kisielk/errcheck#the-deprecated-method for details
14- exclude-functions :
15- - fmt:.*
16- - io/ioutil:^Read.*
17-
18- govet :
19- # report about shadowed variables
20- disable :
21- - shadow
22- gofmt :
23- # simplify code: gofmt with `-s` option, true by default
24- simplify : true
25-
26- goimports :
27- # put imports beginning with prefix after 3rd-party packages;
28- # it's a comma-separated list of prefixes
29- local-prefixes : github.com/SAP/metrics-operator
30-
31- gocyclo :
32- # minimal code complexity to report, 30 by default (but we recommend 10-20)
33- min-complexity : 10
34-
35- dupl :
36- # tokens count to trigger issue, 150 by default
37- threshold : 100
38-
39- goconst :
40- # minimal length of string constant, 3 by default
41- min-len : 3
42- # minimal occurrences count to trigger, 3 by default
43- min-occurrences : 5
44-
45- lll :
46- # Max line length, lines longer will be reported.
47- # '\t' is counted as 1 character by default, and can be changed with the tab-width option.
48- # Default: 120.
49- line-length : 120
50- # Tab width in spaces.
51- # Default: 1
52- tab-width : 1
53-
54- unused :
55- # treat code as a program (not a library) and report unused exported identifiers; default is false.
56- # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
57- # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
58- # with golangci-lint call it on a directory with the changed file.
59- exported-fields-are-used : false
60-
61- unparam :
62- # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
63- # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
64- # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
65- # with golangci-lint call it on a directory with the changed file.
66- check-exported : false
67-
68- nakedret :
69- # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
70- max-func-lines : 30
71-
72- prealloc :
73- # XXX: we don't recommend using this linter before doing performance profiling.
74- # For most programs usage of prealloc will be a premature optimization.
75-
76- # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
77- # True by default.
78- simple : true
79- range-loops : true # Report preallocation suggestions on range loops, true by default
80- for-loops : false # Report preallocation suggestions on for loops, false by default
81-
82- gocritic :
83- # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
84- # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
85- enabled-tags :
86- - performance
87-
88- settings : # settings passed to gocritic
89- captLocal : # must be valid enabled check name
90- paramsOnly : true
91- rangeValCopy :
92- sizeThreshold : 32
1+ version : " 2"
932
943linters :
954 enable :
96- - gosimple
975 - staticcheck
986 - unused
997 - govet
1008 - gocyclo
1019 - gocritic
10210 - goconst
103- - goimports
104- - gofmt # We enable this as well as goimports for its simplify mode.
10511 - prealloc
10612 - revive
10713 - unconvert
10814 - misspell
10915 - nakedret
11016 disable :
11117 - nilnesserr
112- presets :
113- - bugs
114- - unused
115- fast : false
116-
18+ settings :
19+ errcheck :
20+ # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
21+ # default is false: such cases aren't reported by default.
22+ check-type-assertions : false
23+
24+ # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
25+ # default is false: such cases aren't reported by default.
26+ check-blank : false
27+
28+ # [deprecated] comma-separated list of pairs of the form pkg:regex
29+ # the regex is used to ignore names within pkg. (default "fmt:.*").
30+ # see https://github.com/kisielk/errcheck#the-deprecated-method for details
31+ exclude-functions :
32+ - fmt:.*
33+ - io/ioutil:^Read.*
34+
35+ govet :
36+ # report about shadowed variables
37+ disable :
38+ - shadow
39+ gocyclo :
40+ # minimal code complexity to report, 30 by default (but we recommend 10-20)
41+ min-complexity : 10
42+
43+ dupl :
44+ # tokens count to trigger issue, 150 by default
45+ threshold : 100
46+
47+ goconst :
48+ # minimal length of string constant, 3 by default
49+ min-len : 3
50+ # minimal occurrences count to trigger, 3 by default
51+ min-occurrences : 5
52+
53+ lll :
54+ # Max line length, lines longer will be reported.
55+ # '\t' is counted as 1 character by default, and can be changed with the tab-width option.
56+ # Default: 120.
57+ line-length : 120
58+ # Tab width in spaces.
59+ # Default: 1
60+ tab-width : 1
61+
62+ unused :
63+ # treat code as a program (not a library) and report unused exported identifiers; default is false.
64+ # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
65+ # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
66+ # with golangci-lint call it on a directory with the changed file.
67+ exported-fields-are-used : false
68+
69+ unparam :
70+ # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
71+ # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
72+ # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
73+ # with golangci-lint call it on a directory with the changed file.
74+ check-exported : false
75+
76+ nakedret :
77+ # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
78+ max-func-lines : 30
79+
80+ prealloc :
81+ # XXX: we don't recommend using this linter before doing performance profiling.
82+ # For most programs usage of prealloc will be a premature optimization.
83+
84+ # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
85+ # True by default.
86+ simple : true
87+ range-loops : true # Report preallocation suggestions on range loops, true by default
88+ for-loops : false # Report preallocation suggestions on for loops, false by default
89+
90+ gocritic :
91+ # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
92+ # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
93+ enabled-tags :
94+ - performance
95+
96+ settings : # settings passed to gocritic
97+ captLocal : # must be valid enabled check name
98+ paramsOnly : true
99+ rangeValCopy :
100+ sizeThreshold : 32
101+
102+ exclusions :
103+ generated : strict
104+ rules :
105+ # Exclude some linters from running on tests files.
106+ - path : _test(ing)?\.go
107+ linters :
108+ - gocyclo
109+ - errcheck
110+ - dupl
111+ - gosec
112+ - scopelint
113+ - unparam
114+ - revive
115+
116+ # Ease some gocritic warnings on test files.
117+ - path : _test\.go
118+ text : " (unnamedResult|exitAfterDefer)"
119+ linters :
120+ - gocritic
121+
122+ # These are performance optimisations rather than style issues per se.
123+ # They warn when function arguments or range values copy a lot of memory
124+ # rather than using a pointer.
125+ - text : " (hugeParam|rangeValCopy):"
126+ linters :
127+ - gocritic
128+
129+ # This "TestMain should call os.Exit to set exit code" warning is not clever
130+ # enough to notice that we call a helper method that calls os.Exit.
131+ - text : " SA3000:"
132+ linters :
133+ - staticcheck
134+
135+ - text : " k8s.io/api/core/v1"
136+ linters :
137+ - goimports
138+
139+ # This is a "potential hardcoded credentials" warning. It's triggered by
140+ # any variable with 'secret' in the same, and thus hits a lot of false
141+ # positives in Kubernetes land where a Secret is an object type.
142+ - text : " G101:"
143+ linters :
144+ - gosec
145+ - gas
146+
147+ # This is an 'errors unhandled' warning that duplicates errcheck.
148+ - text : " G104:"
149+ linters :
150+ - gosec
151+ - gas
152+ # ease package comments rule
153+ - text : " package-comments:"
154+ linters :
155+ - revive
117156
118157issues :
119- exclude-files :
120- - ' zz_generated.*\.go'
121- # Excluding configuration per-path and per-linter
122- exclude-rules :
123- # Exclude some linters from running on tests files.
124- - path : _test(ing)?\.go
125- linters :
126- - gocyclo
127- - errcheck
128- - dupl
129- - gosec
130- - scopelint
131- - unparam
132- - revive
133-
134- # Ease some gocritic warnings on test files.
135- - path : _test\.go
136- text : " (unnamedResult|exitAfterDefer)"
137- linters :
138- - gocritic
139-
140- # These are performance optimisations rather than style issues per se.
141- # They warn when function arguments or range values copy a lot of memory
142- # rather than using a pointer.
143- - text : " (hugeParam|rangeValCopy):"
144- linters :
145- - gocritic
146-
147- # This "TestMain should call os.Exit to set exit code" warning is not clever
148- # enough to notice that we call a helper method that calls os.Exit.
149- - text : " SA3000:"
150- linters :
151- - staticcheck
152-
153- - text : " k8s.io/api/core/v1"
154- linters :
155- - goimports
156-
157- # This is a "potential hardcoded credentials" warning. It's triggered by
158- # any variable with 'secret' in the same, and thus hits a lot of false
159- # positives in Kubernetes land where a Secret is an object type.
160- - text : " G101:"
161- linters :
162- - gosec
163- - gas
164-
165- # This is an 'errors unhandled' warning that duplicates errcheck.
166- - text : " G104:"
167- linters :
168- - gosec
169- - gas
170- # ease package comments rule
171- - text : " package-comments:"
172- linters :
173- - revive
174-
175- # Independently from option `exclude` we use default exclude patterns,
176- # it can be disabled by this option. To list all
177- # excluded by default patterns execute `golangci-lint run --help`.
178- # Default value for this option is true.
179- exclude-use-default : false
180-
181158 # Show only new issues: if there are unstaged changes or untracked files,
182159 # only those changes are analyzed, else only changes in HEAD~ are analyzed.
183160 # It's a super-useful option for integration of golangci-lint into existing
@@ -192,5 +169,15 @@ issues:
192169 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
193170 max-same-issues : 0
194171
172+ formatters :
173+ enable :
174+ - gofmt
175+ - goimports
176+ settings :
177+
178+ gofmt :
179+ # simplify code: gofmt with `-s` option, true by default
180+ simplify : true
181+
195182run :
196183 timeout : 10m
0 commit comments