forked from googleapis/ruby-style
-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-style.yml
374 lines (287 loc) · 7.66 KB
/
google-style.yml
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
AllCops:
NewCops: disable
SuggestExtensions: false
TargetRubyVersion: 2.6
# Added in Rubocop 1.10
Gemspec/DateAssignment:
Enabled: true
# Added in Rubocop 1.30
Gemspec/DeprecatedAttributeAssignment:
Enabled: true
# Disabled for now.
Gemspec/RequireMFA:
Enabled: false
# Enforcing a blank line often worsens vertical layout.
Layout/EmptyLineAfterGuardClause:
Enabled: false
# For the extra line between copyright and code.
Layout/EmptyLines:
Enabled: false
# This tends to be problematic, especially for nested hashes. In many cases,
# our code adheres to the "table" style, but we do not want to enforce it.
Layout/HashAlignment:
Enabled: false
# Added in Rubocop 1.18
Layout/LineEndStringConcatenationIndentation:
Enabled: true
# Our current preferred line length.
Layout/LineLength:
Max: 120
# Added in Rubocop 1.7
Layout/SpaceBeforeBrackets:
Enabled: true
# Added in Rubocop 1.7
Lint/AmbiguousAssignment:
Enabled: true
# Added in Rubocop 1.21
Lint/AmbiguousOperatorPrecedence:
Enabled: true
# Added in Rubocop 1.19
Lint/AmbiguousRange:
Enabled: true
# Added in Rubocop 1.8
Lint/DeprecatedConstants:
Enabled: true
# Added in Rubocop 1.3
Lint/DuplicateBranch:
Enabled: true
# Added in Rubocop 1.1
Lint/DuplicateRegexpCharacterClassElement:
Enabled: true
# Added in Rubocop 1.1
Lint/EmptyBlock:
Enabled: true
# Added in Rubocop 1.3
Lint/EmptyClass:
Enabled: true
# Added in Rubocop 1.16
Lint/EmptyInPattern:
Enabled: true
# Added in Rubocop 1.21
Lint/IncompatibleIoSelectWithFiberScheduler:
Enabled: true
# Added in Rubocop 1.8
Lint/LambdaWithoutLiteralBlock:
Enabled: true
# Added in Rubocop 1.2
Lint/NoReturnInBeginEndBlocks:
Enabled: true
# Added in Rubocop 1.9
Lint/NumberedParameterAssignment:
Enabled: true
# Added in Rubocop 1.9
Lint/OrAssignmentToConstant:
Enabled: true
# Added in Rubocop 1.8
Lint/RedundantDirGlobSort:
Enabled: true
# Added in Rubocop 1.27
Lint/RefinementImportMethods:
Enabled: true
# Added in Rubocop 1.22
Lint/RequireRelativeSelfPath:
Enabled: true
# Added in Rubocop 1.9
Lint/SymbolConversion:
Enabled: true
# Added in Rubocop 1.1
Lint/ToEnumArguments:
Enabled: true
# Added in Rubocop 1.9
Lint/TripleQuotes:
Enabled: true
# Added in Rubocop 1.5
Lint/UnexpectedBlockArity:
Enabled: true
# Added in Rubocop 1.1
Lint/UnmodifiedReduceAccumulator:
Enabled: true
# Added in Rubocop 1.23
Lint/UselessRuby2Keywords:
Enabled: true
Metrics/AbcSize:
Max: 30
Metrics/CyclomaticComplexity:
Max: 10
Metrics/MethodLength:
Max: 25
# Sometimes problematic for API calls which might have a lot of parameters,
# and for generated code.
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Max: 10
# Added in Rubocop 1.24
Naming/BlockForwarding:
Enabled: true
# Does not allow distinguishing verbs (e.g. is vs has). Also causes problems
# for generated code that might have generated method names.
Naming/PredicateName:
Enabled: false
# Numbers are occasionally semantically useful in names, and also occasionally
# appear in generated code.
Naming/VariableNumber:
Enabled: false
# Added in Rubocop 1.28
Security/CompoundHash:
Enabled: true
# Added in Rubocop 1.22
Security/IoMethods:
Enabled: true
# Better to separate accessors for yardoc and type declarations.
Style/AccessorGrouping:
EnforcedStyle: separated
# Added in Rubocop 1.1
Style/ArgumentsForwarding:
Enabled: true
# Problematic for generated code which might include unicode in comments.
Style/AsciiComments:
Enabled: false
# There are cases where we use the === operator as a general interface, e.g.
# when specifying type checker objects.
Style/CaseEquality:
Enabled: false
# Added in Rubocop 1.2
Style/CollectionCompact:
Enabled: true
# Added in Rubocop 1.1
Style/DocumentDynamicEvalDefinition:
Enabled: true
# We prefer consistent method indentation.
Style/EmptyMethod:
EnforcedStyle: expanded
# Added in Rubocop 1.8
Style/EndlessMethod:
Enabled: true
# Added in Rubocop 1.29
Style/EnvHome:
Enabled: true
# This check is overly paranoid.
Style/FetchEnvVar:
Enabled: false
# Added in Rubocop 1.24
Style/FileRead:
Enabled: true
# Added in Rubocop 1.24
Style/FileWrite:
Enabled: true
# Frozen string literals are no more as of Ruby 3.
Style/FrozenStringLiteralComment:
Enabled: false
# Added in Rubocop 1.10
Style/HashConversion:
Enabled: true
# Added in Rubocop 1.7
Style/HashExcept:
Enabled: true
# It is sometimes preferable to use the non-modifier form even for single-line
# expressions, for readability.
Style/IfUnlessModifier:
Enabled: false
# Added in Rubocop 1.9
Style/IfWithBooleanLiteralBranches:
Enabled: true
# Added in Rubocop 1.16
Style/InPatternThen:
Enabled: true
# Added in Rubocop 1.30
Style/MapCompactWithConditionalBlock:
Enabled: true
# Added in Rubocop 1.24
Style/MapToHash:
Enabled: true
# We adopt Seattle-style paren usage
Style/MethodCallWithArgsParentheses:
AllowParenthesesInCamelCaseMethod: true
AllowParenthesesInChaining: true
AllowParenthesesInMultilineCall: true
Enabled: true
EnforcedStyle: omit_parentheses
# We adopt Seattle-style paren usage
Style/MethodDefParentheses:
EnforcedStyle: require_no_parentheses
# Enable use of the different semantics of module_function and extend self.
Style/ModuleFunction:
Enabled: false
# Added in Rubocop 1.16
Style/MultilineInPatternThen:
Enabled: true
# Added in Rubocop 1.2
Style/NegatedIfElseCondition:
Enabled: true
# Added in Rubocop 1.26
Style/NestedFileDirname:
Enabled: true
# Added in Rubocop 1.3
Style/NilLambda:
Enabled: true
# Added in Rubocop 1.22
Style/NumberedParameters:
Enabled: true
# Added in Rubocop 1.22
Style/NumberedParametersLimit:
Enabled: true
# Added in Rubocop 1.28
Style/ObjectThen:
Enabled: true
# Disabled for tests but left enabled for production code.
# Added in Rubocop 1.23
Style/OpenStructUse:
Enabled: true
Exclude:
- "test/**/*.rb"
- "acceptance/**/*.rb"
- "samples/acceptance/**/*.rb"
# Added in Rubocop 1.16
Style/QuotedSymbols:
Enabled: true
# Added in Rubocop 1.4
Style/RedundantArgument:
Enabled: true
# Disabled because we prefer to keep begin-end blocks in memoization for
# readability (see https://github.com/rubocop/rubocop/pull/9602).
Style/RedundantBegin:
Enabled: false
# Added in Rubocop 1.27
Style/RedundantInitialize:
Enabled: true
# Added in Rubocop 1.19
Style/RedundantSelfAssignmentBranch:
Enabled: true
# The idiom is useful in a variety of cases. We prefer to allow it.
Style/RescueModifier:
Enabled: false
# We disagree with this one. Grep is more specialized than select/reject
Style/SelectByRegexp:
Enabled: false
# Added in Rubocop 1.12
Style/StringChars:
Enabled: true
# We prefer standardizing on double-quoted strings for readability.
Style/StringLiterals:
EnforcedStyle: double_quotes
# Added in Rubocop 1.1
Style/SwapValues:
Enabled: true
# We prefer traditional bracket style for all arrays.
Style/SymbolArray:
EnforcedStyle: brackets
# There are some cases where a full method shows intent better than an attr.
Style/TrivialAccessors:
Enabled: false
# We prefer traditional bracket style for all arrays.
Style/WordArray:
EnforcedStyle: brackets