-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgoogle-style.yml
557 lines (427 loc) · 11.6 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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
# 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: 3.0
# Added in Rubocop 1.30
Gemspec/DeprecatedAttributeAssignment:
Enabled: true
# Added in Rubocop 1.44
Gemspec/DevelopmentDependencies:
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.31
Layout/LineContinuationLeadingSpace:
Enabled: true
# Added in Rubocop 1.31
Layout/LineContinuationSpacing:
Enabled: true
# 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.31
Lint/ConstantOverwrittenInRescue:
Enabled: true
# Samples often use Kernel#p which Lint/Debugger doesn't like.
Lint/Debugger:
Exclude:
- "samples/**/*.rb"
- "snippets/**/*.rb"
# Added in Rubocop 1.8
Lint/DeprecatedConstants:
Enabled: true
# Added in Rubocop 1.3
Lint/DuplicateBranch:
Enabled: true
# Added in Rubocop 1.37
Lint/DuplicateMagicComment:
Enabled: true
# Added in Rubocop 1.50
Lint/DuplicateMatchPattern:
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.59
Lint/ItWithoutArgumentsInBlock:
Enabled: true
# Added in Rubocop 1.8
Lint/LambdaWithoutLiteralBlock:
Enabled: true
# Added in Rubocop 1.58
Lint/LiteralAssignmentInCondition:
Enabled: true
# Added in Rubocop 1.53
Lint/MixedCaseRange:
Enabled: true
# Added in Rubocop 1.2
Lint/NoReturnInBeginEndBlocks:
Enabled: true
# Added in Rubocop 1.31
Lint/NonAtomicFileOperation:
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.53
Lint/RedundantRegexpQuantifiers:
Enabled: true
# Added in Rubocop 1.27
Lint/RefinementImportMethods:
Enabled: true
# Added in Rubocop 1.32
Lint/RequireRangeParentheses:
Enabled: true
# Added in Rubocop 1.22
Lint/RequireRelativeSelfPath:
Enabled: true
# Could be problematic for code refactoring, and overall not very useful.
Lint/SafeNavigationConsistency:
Enabled: false
# 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.43
Lint/UselessRescue:
Enabled: true
# Added in Rubocop 1.23
Lint/UselessRuby2Keywords:
Enabled: true
Metrics/AbcSize:
Max: 30
# Could be problematic for generated code, and overall not very useful.
Metrics/CollectionLiteralLength:
Enabled: false
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
RedundantBlockArgumentNames: [] # To support Ruby < 3.2
RedundantKeywordRestArgumentNames: [] # To support Ruby < 3.2
RedundantRestArgumentNames: [] # To support Ruby < 3.2
UseAnonymousForwarding: false # To support Ruby < 3.2
# 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.44
Style/ComparableClamp:
Enabled: true
# Added in Rubocop 1.41
Style/ConcatArrayLiterals:
Enabled: true
# Added in Rubocop 1.48
Style/DirEmpty:
Enabled: true
# Added in Rubocop 1.1
Style/DocumentDynamicEvalDefinition:
Enabled: true
# Added in Rubocop 1.32
Style/EmptyHeredoc:
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
# Added in Rubocop 1.51
Style/ExactRegexpMatch:
Enabled: true
# This check is overly paranoid.
Style/FetchEnvVar:
Enabled: false
# Added in Rubocop 1.48
Style/FileEmpty:
Enabled: true
# 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.35
Style/MagicCommentFormat:
Enabled: true
# Added in Rubocop 1.30
Style/MapCompactWithConditionalBlock:
Enabled: true
# Added in Rubocop 1.63
Style/MapIntoArray:
Enabled: true
# Added in Rubocop 1.24
Style/MapToHash:
Enabled: true
# Added in Rubocop 1.42
Style/MapToSet:
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
# I (dazuma@) am not a fan of this rule. It's a bit more readable but at the
# cost of being logically clever.
Style/MinMaxComparison:
Enabled: false
# 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
# I (dazuma@) am not a fan of this rule. Its readability benefit is debatable
# and it carries the cost of being logically clever.
Style/MultipleComparison:
Enabled: false
# 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.37. Open to disabling this if it causes problems for
# metaprogramming-heavy code.
Style/OperatorMethodCall:
Enabled: true
# Added in Rubocop 1.16
Style/QuotedSymbols:
Enabled: true
# Added in Rubocop 1.4
Style/RedundantArgument:
Enabled: true
# Added in Rubocop 1.52
Style/RedundantArrayConstructor:
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
# Disabled because we believe it's good practice to be explicit about constant
# namespaces, given how confusing constant lookup rules are in Ruby.
Style/RedundantConstantBase:
Enabled: false
# Added in Rubocop 1.53
Style/RedundantCurrentDirectoryInPath:
Enabled: true
# Added in Rubocop 1.41
Style/RedundantDoubleSplatHashBraces:
Enabled: true
# Added in Rubocop 1.38
Style/RedundantEach:
Enabled: true
# Added in Rubocop 1.52
Style/RedundantFilterChain:
Enabled: true
# Added in Rubocop 1.45
Style/RedundantHeredocDelimiterQuotes:
Enabled: true
# Added in Rubocop 1.27
Style/RedundantInitialize:
Enabled: true
# Added in Rubocop 1.49
Style/RedundantLineContinuation:
Enabled: true
# Added in Rubocop 1.53
Style/RedundantRegexpArgument:
Enabled: true
# Added in Rubocop 1.52
Style/RedundantRegexpConstructor:
Enabled: true
# Added in Rubocop 1.19
Style/RedundantSelfAssignmentBranch:
Enabled: true
# Added in Rubocop 1.37
Style/RedundantStringEscape:
Enabled: true
# Disabled because we find it to be pedantic. The enforced rules are too simple
# to capture readability, and are especially problematic for generated code.
Style/RegexpLiteral:
Enabled: false
# The idiom is useful in a variety of cases. We prefer to allow it.
Style/RescueModifier:
Enabled: false
# Added in Rubocop 1.53. Open to disabling, since there may be exceptions.
Style/ReturnNilInPredicateMethodDefinition:
Enabled: true
# We disagree with this one. Grep is more specialized than select/reject.
Style/SelectByRegexp:
Enabled: false
# Added in Rubocop 1.57
Style/SingleLineDoEndBlock:
Enabled: true
# Added in Rubocop 1.12
Style/StringChars:
Enabled: true
# We prefer standardizing on double-quoted strings for readability.
Style/StringLiterals:
EnforcedStyle: double_quotes
# We prefer omitting parentheses where possible.
Style/SuperWithArgsParentheses:
Enabled: false
# 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
# Added in Rubocop 1.53
Style/YAMLFileRead:
Enabled: true