rubocop-rubomatic 1.3.0 → 1.4.0.pre.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +15 -0
- data/config/bundler.yml +0 -22
- data/config/default.yml +0 -4
- data/config/gemspec_on.yml +0 -23
- data/config/layout.yml +0 -346
- data/config/lint.yml +6 -403
- data/config/metrics.yml +0 -41
- data/config/migration.yml +0 -4
- data/config/naming.yml +0 -68
- data/config/performance.yml +3 -128
- data/config/security.yml +0 -31
- data/config/style.yml +14 -931
- data/lib/rubocop/rubomatic/version.rb +1 -1
- metadata +10 -10
data/config/style.yml
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
Style/AccessModifierDeclarations:
|
2
|
-
Description: 'Checks style of how access modifiers are used.'
|
3
2
|
Enabled: true
|
4
|
-
VersionAdded: '0.57'
|
5
|
-
VersionChanged: '0.81'
|
6
3
|
EnforcedStyle: group
|
7
4
|
SupportedStyles:
|
8
5
|
- inline
|
@@ -10,9 +7,7 @@ Style/AccessModifierDeclarations:
|
|
10
7
|
AllowModifiersOnSymbols: true
|
11
8
|
|
12
9
|
Style/AccessorGrouping:
|
13
|
-
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
14
10
|
Enabled: true
|
15
|
-
VersionAdded: '0.87'
|
16
11
|
EnforcedStyle: separated
|
17
12
|
SupportedStyles:
|
18
13
|
# separated: each accessor goes in a separate statement.
|
@@ -21,22 +16,14 @@ Style/AccessorGrouping:
|
|
21
16
|
- grouped
|
22
17
|
|
23
18
|
Style/Alias:
|
24
|
-
Description: 'Use alias instead of alias_method.'
|
25
|
-
StyleGuide: '#alias-method-lexically'
|
26
19
|
Enabled: true
|
27
|
-
VersionAdded: '0.9'
|
28
|
-
VersionChanged: '0.36'
|
29
20
|
EnforcedStyle: prefer_alias
|
30
21
|
SupportedStyles:
|
31
22
|
- prefer_alias
|
32
23
|
- prefer_alias_method
|
33
24
|
|
34
25
|
Style/AndOr:
|
35
|
-
Description: 'Use &&/|| instead of and/or.'
|
36
|
-
StyleGuide: '#no-and-or-or'
|
37
26
|
Enabled: true
|
38
|
-
VersionAdded: '0.9'
|
39
|
-
VersionChanged: '1.21'
|
40
27
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
41
28
|
# or completely (always).
|
42
29
|
EnforcedStyle: conditionals
|
@@ -45,93 +32,53 @@ Style/AndOr:
|
|
45
32
|
- conditionals
|
46
33
|
|
47
34
|
Style/ArgumentsForwarding:
|
48
|
-
Description: 'Use arguments forwarding.'
|
49
|
-
StyleGuide: '#arguments-forwarding'
|
50
35
|
Enabled: true
|
51
36
|
AllowOnlyRestArgument: true
|
52
|
-
|
37
|
+
<% if ENV['RUBY_MAJOR'].to_f >= 3.2 %>
|
38
|
+
UseAnonymousForwarding: true
|
39
|
+
<% end %>
|
53
40
|
|
54
41
|
Style/ArrayCoercion:
|
55
|
-
Description: >-
|
56
|
-
Use Array() instead of explicit Array check or [*var], when dealing
|
57
|
-
with a variable you want to treat as an Array, but you're not certain it's an array.
|
58
|
-
StyleGuide: '#array-coercion'
|
59
|
-
Safe: false
|
60
42
|
Enabled: true
|
61
|
-
|
43
|
+
|
44
|
+
Style/ArrayFirstLast:
|
45
|
+
Enabled: true
|
62
46
|
|
63
47
|
Style/ArrayIntersect:
|
64
|
-
Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
|
65
48
|
Enabled: true
|
66
|
-
VersionAdded: '1.40'
|
67
49
|
|
68
50
|
Style/ArrayJoin:
|
69
|
-
Description: 'Use Array#join instead of Array#*.'
|
70
|
-
StyleGuide: '#array-join'
|
71
51
|
Enabled: true
|
72
|
-
VersionAdded: '0.20'
|
73
|
-
VersionChanged: '0.31'
|
74
52
|
|
75
53
|
Style/AsciiComments:
|
76
|
-
Description: 'Use only ascii symbols in comments.'
|
77
|
-
StyleGuide: '#english-comments'
|
78
54
|
Enabled: true
|
79
|
-
VersionAdded: '0.9'
|
80
|
-
VersionChanged: '1.21'
|
81
55
|
AllowedChars:
|
82
56
|
- ©
|
83
57
|
|
84
58
|
Style/Attr:
|
85
|
-
Description: 'Checks for uses of Module#attr.'
|
86
|
-
StyleGuide: '#attr'
|
87
59
|
Enabled: true
|
88
|
-
VersionAdded: '0.9'
|
89
|
-
VersionChanged: '0.12'
|
90
60
|
|
91
61
|
Style/AutoResourceCleanup:
|
92
|
-
Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
|
93
62
|
Enabled: true
|
94
|
-
VersionAdded: '0.30'
|
95
63
|
|
96
64
|
Style/BarePercentLiterals:
|
97
|
-
Description: 'Checks if usage of %() or %Q() matches configuration.'
|
98
|
-
StyleGuide: '#percent-q-shorthand'
|
99
65
|
Enabled: true
|
100
|
-
VersionAdded: '0.25'
|
101
66
|
EnforcedStyle: bare_percent
|
102
67
|
SupportedStyles:
|
103
68
|
- percent_q
|
104
69
|
- bare_percent
|
105
70
|
|
106
71
|
Style/BeginBlock:
|
107
|
-
Description: 'Avoid the use of BEGIN blocks.'
|
108
|
-
StyleGuide: '#no-BEGIN-blocks'
|
109
72
|
Enabled: true
|
110
|
-
VersionAdded: '0.9'
|
111
73
|
|
112
74
|
Style/BisectedAttrAccessor:
|
113
|
-
Description: >-
|
114
|
-
Checks for places where `attr_reader` and `attr_writer`
|
115
|
-
for the same method can be combined into single `attr_accessor`.
|
116
75
|
Enabled: true
|
117
|
-
VersionAdded: '0.87'
|
118
76
|
|
119
77
|
Style/BlockComments:
|
120
|
-
Description: 'Do not use block comments.'
|
121
|
-
StyleGuide: '#no-block-comments'
|
122
78
|
Enabled: true
|
123
|
-
VersionAdded: '0.9'
|
124
|
-
VersionChanged: '0.23'
|
125
79
|
|
126
80
|
Style/BlockDelimiters:
|
127
|
-
|
128
|
-
Avoid using {...} for multi-line blocks (multiline chaining is
|
129
|
-
always ugly).
|
130
|
-
Prefer {...} over do...end for single-line blocks.
|
131
|
-
StyleGuide: '#single-line-blocks'
|
132
|
-
Enabled: true
|
133
|
-
VersionAdded: '0.30'
|
134
|
-
VersionChanged: '0.35'
|
81
|
+
Enabled: true
|
135
82
|
EnforcedStyle: line_count_based
|
136
83
|
SupportedStyles:
|
137
84
|
# The `line_count_based` style enforces braces around single line blocks and
|
@@ -235,11 +182,7 @@ Style/BlockDelimiters:
|
|
235
182
|
BracesRequiredMethods: [ ]
|
236
183
|
|
237
184
|
Style/CaseEquality:
|
238
|
-
Description: 'Avoid explicit use of the case equality operator(===).'
|
239
|
-
StyleGuide: '#no-case-equality'
|
240
185
|
Enabled: false
|
241
|
-
VersionAdded: '0.9'
|
242
|
-
VersionChanged: '0.89'
|
243
186
|
# If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
|
244
187
|
# the case equality operator is a constant.
|
245
188
|
#
|
@@ -260,28 +203,18 @@ Style/CaseEquality:
|
|
260
203
|
AllowOnSelfClass: false
|
261
204
|
|
262
205
|
Style/CaseLikeIf:
|
263
|
-
Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
264
|
-
StyleGuide: '#case-vs-if-else'
|
265
206
|
Enabled: true
|
266
|
-
Safe: false
|
267
|
-
VersionAdded: '0.88'
|
268
207
|
|
269
208
|
Style/CharacterLiteral:
|
270
|
-
Description: 'Checks for uses of character literals.'
|
271
|
-
StyleGuide: '#no-character-literals'
|
272
209
|
Enabled: true
|
273
|
-
VersionAdded: '0.9'
|
274
210
|
|
275
211
|
Style/ClassAndModuleChildren:
|
276
|
-
Description: 'Checks style of children classes and modules.'
|
277
|
-
StyleGuide: '#namespace-definition'
|
278
212
|
# Moving from compact to nested children requires knowledge of whether the
|
279
213
|
# outer parent is a module or a class. Moving from nested to compact requires
|
280
214
|
# verification that the outer parent is defined elsewhere. Rubocop does not
|
281
215
|
# have the knowledge to perform either operation safely and thus requires
|
282
216
|
# manual oversight.
|
283
217
|
Enabled: true
|
284
|
-
VersionAdded: '0.19'
|
285
218
|
#
|
286
219
|
# Basically there are two different styles:
|
287
220
|
#
|
@@ -302,20 +235,14 @@ Style/ClassAndModuleChildren:
|
|
302
235
|
- compact
|
303
236
|
|
304
237
|
Style/ClassCheck:
|
305
|
-
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
306
|
-
StyleGuide: '#is-a-vs-kind-of'
|
307
238
|
Enabled: true
|
308
|
-
VersionAdded: '0.24'
|
309
239
|
EnforcedStyle: is_a?
|
310
240
|
SupportedStyles:
|
311
241
|
- is_a?
|
312
242
|
- kind_of?
|
313
243
|
|
314
244
|
Style/ClassEqualityComparison:
|
315
|
-
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
316
|
-
StyleGuide: '#instance-of-vs-class-comparison'
|
317
245
|
Enabled: true
|
318
|
-
VersionAdded: '0.93'
|
319
246
|
AllowedMethods:
|
320
247
|
- ==
|
321
248
|
- equal?
|
@@ -323,43 +250,24 @@ Style/ClassEqualityComparison:
|
|
323
250
|
AllowedPatterns: [ ]
|
324
251
|
|
325
252
|
Style/ClassMethods:
|
326
|
-
Description: 'Use self when defining module/class methods.'
|
327
|
-
StyleGuide: '#def-self-class-methods'
|
328
253
|
Enabled: true
|
329
|
-
VersionAdded: '0.9'
|
330
|
-
VersionChanged: '0.20'
|
331
254
|
|
332
255
|
Style/ClassMethodsDefinitions:
|
333
|
-
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
334
|
-
StyleGuide: '#def-self-class-methods'
|
335
256
|
Enabled: false
|
336
|
-
VersionAdded: '0.89'
|
337
257
|
EnforcedStyle: def_self
|
338
258
|
SupportedStyles:
|
339
259
|
- def_self
|
340
260
|
- self_class
|
341
261
|
|
342
262
|
Style/ClassVars:
|
343
|
-
Description: 'Avoid the use of class variables.'
|
344
|
-
StyleGuide: '#no-class-vars'
|
345
263
|
Enabled: true
|
346
|
-
VersionAdded: '0.13'
|
347
264
|
|
348
265
|
Style/CollectionCompact:
|
349
|
-
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
350
266
|
Enabled: true
|
351
|
-
Safe: false
|
352
|
-
VersionAdded: '1.2'
|
353
|
-
VersionChanged: '1.3'
|
354
267
|
|
355
268
|
# Align with the style guide.
|
356
269
|
Style/CollectionMethods:
|
357
|
-
Description: 'Preferred collection methods.'
|
358
|
-
StyleGuide: '#map-find-select-reduce-include-size'
|
359
270
|
Enabled: true
|
360
|
-
VersionAdded: '0.9'
|
361
|
-
VersionChanged: '1.7'
|
362
|
-
Safe: false
|
363
271
|
# Mapping from undesired method to desired method
|
364
272
|
# e.g. to use `detect` over `find`:
|
365
273
|
#
|
@@ -381,30 +289,16 @@ Style/CollectionMethods:
|
|
381
289
|
- reduce
|
382
290
|
|
383
291
|
Style/ColonMethodCall:
|
384
|
-
Description: 'Do not use :: for method call.'
|
385
|
-
StyleGuide: '#double-colons'
|
386
292
|
Enabled: true
|
387
|
-
VersionAdded: '0.9'
|
388
293
|
|
389
294
|
Style/ColonMethodDefinition:
|
390
|
-
Description: 'Do not use :: for defining class methods.'
|
391
|
-
StyleGuide: '#colon-method-definition'
|
392
295
|
Enabled: true
|
393
|
-
VersionAdded: '0.52'
|
394
296
|
|
395
297
|
Style/CombinableLoops:
|
396
|
-
Description: >-
|
397
|
-
Checks for places where multiple consecutive loops over the same data
|
398
|
-
can be combined into a single loop.
|
399
298
|
Enabled: true
|
400
|
-
Safe: false
|
401
|
-
VersionAdded: '0.90'
|
402
299
|
|
403
300
|
Style/CommandLiteral:
|
404
|
-
Description: 'Use `` or %x around command literals.'
|
405
|
-
StyleGuide: '#percent-x'
|
406
301
|
Enabled: true
|
407
|
-
VersionAdded: '0.30'
|
408
302
|
EnforcedStyle: backticks
|
409
303
|
# backticks: Always use backticks.
|
410
304
|
# percent_x: Always use `%x`.
|
@@ -419,13 +313,7 @@ Style/CommandLiteral:
|
|
419
313
|
|
420
314
|
# Checks formatting of special comments
|
421
315
|
Style/CommentAnnotation:
|
422
|
-
Description: >-
|
423
|
-
Checks formatting of special comments
|
424
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
425
|
-
StyleGuide: '#annotate-keywords'
|
426
316
|
Enabled: true
|
427
|
-
VersionAdded: '0.10'
|
428
|
-
VersionChanged: '1.20'
|
429
317
|
Keywords:
|
430
318
|
- TODO
|
431
319
|
- FIXME
|
@@ -436,30 +324,16 @@ Style/CommentAnnotation:
|
|
436
324
|
RequireColon: true
|
437
325
|
|
438
326
|
Style/CommentedKeyword:
|
439
|
-
Description: 'Do not place comments on the same line as certain keywords.'
|
440
327
|
Enabled: true
|
441
|
-
VersionAdded: '0.51'
|
442
|
-
VersionChanged: '1.19'
|
443
328
|
|
444
329
|
Style/ComparableClamp:
|
445
|
-
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
446
330
|
Enabled: true
|
447
|
-
VersionAdded: '1.44'
|
448
331
|
|
449
332
|
Style/ConcatArrayLiterals:
|
450
|
-
Description: 'Enforces the use of `Array#push(item)` instead of `Array#concat([item])` to avoid redundant array literals.'
|
451
333
|
Enabled: true
|
452
|
-
Safe: false
|
453
|
-
VersionAdded: '1.41'
|
454
334
|
|
455
335
|
Style/ConditionalAssignment:
|
456
|
-
Description: >-
|
457
|
-
Use the return value of `if` and `case` statements for
|
458
|
-
assignment to a variable and variable comparison instead
|
459
|
-
of assigning that variable inside of each branch.
|
460
336
|
Enabled: true
|
461
|
-
VersionAdded: '0.36'
|
462
|
-
VersionChanged: '0.47'
|
463
337
|
EnforcedStyle: assign_to_condition
|
464
338
|
SupportedStyles:
|
465
339
|
- assign_to_condition
|
@@ -474,12 +348,7 @@ Style/ConditionalAssignment:
|
|
474
348
|
IncludeTernaryExpressions: true
|
475
349
|
|
476
350
|
Style/ConstantVisibility:
|
477
|
-
Description: >-
|
478
|
-
Check that class- and module constants have
|
479
|
-
visibility declarations.
|
480
351
|
Enabled: false
|
481
|
-
VersionAdded: '0.66'
|
482
|
-
VersionChanged: '1.10'
|
483
352
|
IgnoreModules: false
|
484
353
|
|
485
354
|
# Checks that you have put a copyright in a comment before any code.
|
@@ -501,76 +370,43 @@ Style/ConstantVisibility:
|
|
501
370
|
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
|
502
371
|
#
|
503
372
|
Style/Copyright:
|
504
|
-
Description: 'Include a copyright notice in each file before any code.'
|
505
373
|
Enabled: false
|
506
|
-
VersionAdded: '0.30'
|
507
374
|
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
508
375
|
AutocorrectNotice: ''
|
509
376
|
|
510
377
|
Style/DataInheritance:
|
511
|
-
Description: Checks for inheritance from Data.define.
|
512
378
|
Enabled: <%= ENV['RUBY_MAJOR'].to_f >= 3.2 %>
|
513
|
-
VersionAdded: '1.49'
|
514
379
|
|
515
380
|
Style/DateTime:
|
516
|
-
Description: 'Use Time over DateTime.'
|
517
|
-
StyleGuide: '#date-time'
|
518
381
|
Enabled: false
|
519
|
-
VersionAdded: '0.51'
|
520
|
-
VersionChanged: '0.92'
|
521
382
|
AllowCoercion: false
|
522
383
|
|
523
384
|
Style/DefWithParentheses:
|
524
|
-
Description: 'Use def with parentheses when there are arguments.'
|
525
|
-
StyleGuide: '#method-parens'
|
526
385
|
Enabled: true
|
527
|
-
VersionAdded: '0.9'
|
528
|
-
VersionChanged: '0.12'
|
529
386
|
|
530
387
|
Style/Dir:
|
531
|
-
Description: >-
|
532
|
-
Use the `__dir__` method to retrieve the canonicalized
|
533
|
-
absolute path to the current file.
|
534
388
|
Enabled: true
|
535
|
-
VersionAdded: '0.50'
|
536
389
|
|
537
390
|
Style/DirEmpty:
|
538
|
-
Description: >-
|
539
|
-
Prefer to use `Dir.empty?('path/to/dir')` when checking if a directory is empty.
|
540
391
|
Enabled: true
|
541
|
-
VersionAdded: '1.48'
|
542
392
|
|
543
393
|
Style/DisableCopsWithinSourceCodeDirective:
|
544
394
|
Severity: info # Or warning
|
545
|
-
Description: >-
|
546
|
-
Forbids disabling/enabling cops within source code.
|
547
395
|
Enabled: true
|
548
|
-
VersionAdded: '0.82'
|
549
|
-
VersionChanged: '1.9'
|
550
396
|
AllowedCops: # Project specific
|
551
397
|
|
552
398
|
Style/DocumentDynamicEvalDefinition:
|
553
|
-
Description: >-
|
554
|
-
When using `class_eval` (or other `eval`) with string interpolation,
|
555
|
-
add a comment block showing its appearance if interpolated.
|
556
|
-
StyleGuide: '#eval-comment-docs'
|
557
399
|
Enabled: true
|
558
|
-
VersionAdded: '1.1'
|
559
|
-
VersionChanged: '1.3'
|
560
400
|
|
561
401
|
Style/Documentation:
|
562
|
-
Description: 'Document classes and non-namespace modules.'
|
563
402
|
Enabled: false
|
564
|
-
VersionAdded: '0.9'
|
565
403
|
AllowedConstants: [ ]
|
566
404
|
Exclude:
|
567
405
|
- 'spec/**/*'
|
568
406
|
- 'test/**/*'
|
569
407
|
|
570
408
|
Style/DocumentationMethod:
|
571
|
-
Description: 'Checks for missing documentation comment for public methods.'
|
572
409
|
Enabled: true
|
573
|
-
VersionAdded: '0.43'
|
574
410
|
RequireForNonPublicMethods: true
|
575
411
|
Exclude:
|
576
412
|
- 'db/migrate/*'
|
@@ -578,49 +414,29 @@ Style/DocumentationMethod:
|
|
578
414
|
- 'test/**/*'
|
579
415
|
|
580
416
|
Style/DoubleCopDisableDirective:
|
581
|
-
Description: 'Checks for double rubocop:disable comments on a single line.'
|
582
417
|
Enabled: true
|
583
|
-
VersionAdded: '0.73'
|
584
418
|
|
585
419
|
Style/DoubleNegation:
|
586
|
-
Description: 'Checks for uses of double negation (!!).'
|
587
|
-
StyleGuide: '#no-bang-bang'
|
588
420
|
Enabled: true
|
589
|
-
VersionAdded: '0.19'
|
590
|
-
VersionChanged: '1.2'
|
591
421
|
EnforcedStyle: allowed_in_returns
|
592
422
|
SupportedStyles:
|
593
423
|
- allowed_in_returns
|
594
424
|
- forbidden
|
595
425
|
|
596
426
|
Style/EachForSimpleLoop:
|
597
|
-
Description: >-
|
598
|
-
Use `Integer#times` for a simple loop which iterates a fixed
|
599
|
-
number of times.
|
600
427
|
Enabled: true
|
601
|
-
VersionAdded: '0.41'
|
602
428
|
|
603
429
|
Style/EachWithObject:
|
604
|
-
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
605
430
|
Enabled: true
|
606
|
-
VersionAdded: '0.22'
|
607
|
-
VersionChanged: '0.42'
|
608
431
|
|
609
432
|
Style/EmptyBlockParameter:
|
610
|
-
Description: 'Omit pipes for empty block parameters.'
|
611
433
|
Enabled: true
|
612
|
-
VersionAdded: '0.52'
|
613
434
|
|
614
435
|
Style/EmptyCaseCondition:
|
615
|
-
Description: 'Avoid empty condition in case statements.'
|
616
436
|
Enabled: true
|
617
|
-
VersionAdded: '0.40'
|
618
437
|
|
619
438
|
Style/EmptyElse:
|
620
|
-
Description: 'Avoid empty else-clauses.'
|
621
439
|
Enabled: true
|
622
|
-
VersionAdded: '0.28'
|
623
|
-
VersionChanged: '0.32'
|
624
440
|
EnforcedStyle: both
|
625
441
|
# empty - warn only on empty `else`
|
626
442
|
# nil - warn on `else` with nil in it
|
@@ -632,51 +448,29 @@ Style/EmptyElse:
|
|
632
448
|
AllowComments: false
|
633
449
|
|
634
450
|
Style/EmptyHeredoc:
|
635
|
-
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
636
451
|
Enabled: true
|
637
|
-
VersionAdded: '1.32'
|
638
452
|
|
639
453
|
Style/EmptyLambdaParameter:
|
640
|
-
Description: 'Omit parens for empty lambda parameters.'
|
641
454
|
Enabled: true
|
642
|
-
VersionAdded: '0.52'
|
643
455
|
|
644
456
|
Style/EmptyLiteral:
|
645
|
-
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
646
|
-
StyleGuide: '#literal-array-hash'
|
647
457
|
Enabled: true
|
648
|
-
VersionAdded: '0.9'
|
649
|
-
VersionChanged: '0.12'
|
650
458
|
|
651
459
|
Style/EmptyMethod:
|
652
|
-
Description: 'Checks the formatting of empty method definitions.'
|
653
|
-
StyleGuide: '#no-single-line-methods'
|
654
460
|
Enabled: true
|
655
|
-
VersionAdded: '0.46'
|
656
461
|
EnforcedStyle: expanded
|
657
462
|
SupportedStyles:
|
658
463
|
- compact
|
659
464
|
- expanded
|
660
465
|
|
661
466
|
Style/Encoding:
|
662
|
-
Description: 'Use UTF-8 as the source file encoding.'
|
663
|
-
StyleGuide: '#utf-8'
|
664
467
|
Enabled: true
|
665
|
-
VersionAdded: '0.9'
|
666
|
-
VersionChanged: '0.50'
|
667
468
|
|
668
469
|
Style/EndBlock:
|
669
|
-
Description: 'Avoid the use of END blocks.'
|
670
|
-
StyleGuide: '#no-END-blocks'
|
671
470
|
Enabled: true
|
672
|
-
VersionAdded: '0.9'
|
673
|
-
VersionChanged: '0.81'
|
674
471
|
|
675
472
|
Style/EndlessMethod:
|
676
|
-
Description: 'Avoid the use of multi-lined endless method definitions.'
|
677
|
-
StyleGuide: '#endless-methods'
|
678
473
|
Enabled: true
|
679
|
-
VersionAdded: '1.8'
|
680
474
|
EnforcedStyle: disallow
|
681
475
|
SupportedStyles:
|
682
476
|
- allow_single_line
|
@@ -684,47 +478,25 @@ Style/EndlessMethod:
|
|
684
478
|
- disallow
|
685
479
|
|
686
480
|
Style/EnvHome:
|
687
|
-
Description: "Checks for consistent usage of `ENV['HOME']`."
|
688
481
|
Enabled: true
|
689
|
-
Safe: false
|
690
|
-
VersionAdded: '1.29'
|
691
482
|
|
692
483
|
Style/EvalWithLocation:
|
693
|
-
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
694
484
|
Enabled: true
|
695
|
-
VersionAdded: '0.52'
|
696
485
|
|
697
486
|
Style/EvenOdd:
|
698
|
-
Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
|
699
|
-
StyleGuide: '#predicate-methods'
|
700
487
|
Enabled: true
|
701
|
-
VersionAdded: '0.12'
|
702
|
-
VersionChanged: '0.29'
|
703
488
|
|
704
489
|
Style/ExactRegexpMatch:
|
705
|
-
Description: Checks for exact regexp match inside Regexp literals.
|
706
490
|
Enabled: true
|
707
|
-
VersionAdded: '1.51'
|
708
491
|
|
709
492
|
Style/ExpandPathArguments:
|
710
|
-
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
|
711
493
|
Enabled: true
|
712
|
-
VersionAdded: '0.53'
|
713
494
|
|
714
495
|
Style/ExplicitBlockArgument:
|
715
|
-
Description: >-
|
716
|
-
Consider using explicit block argument to avoid writing block literal
|
717
|
-
that just passes its arguments to another block.
|
718
|
-
StyleGuide: '#block-argument'
|
719
496
|
Enabled: true
|
720
|
-
VersionAdded: '0.89'
|
721
|
-
VersionChanged: '1.8'
|
722
497
|
|
723
498
|
Style/ExponentialNotation:
|
724
|
-
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
725
|
-
StyleGuide: '#exponential-notation'
|
726
499
|
Enabled: true
|
727
|
-
VersionAdded: '0.82'
|
728
500
|
EnforcedStyle: scientific
|
729
501
|
SupportedStyles:
|
730
502
|
- scientific
|
@@ -732,41 +504,21 @@ Style/ExponentialNotation:
|
|
732
504
|
- integral
|
733
505
|
|
734
506
|
Style/FetchEnvVar:
|
735
|
-
Description: >-
|
736
|
-
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
737
|
-
Reference:
|
738
|
-
- https://rubystyle.guide/#hash-fetch-defaults
|
739
507
|
Enabled: true
|
740
|
-
VersionAdded: '1.28'
|
741
508
|
# Environment variables to be excluded from the inspection.
|
742
509
|
AllowedVars: [ ]
|
743
510
|
|
744
511
|
Style/FileEmpty:
|
745
|
-
Description: >-
|
746
|
-
Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
|
747
512
|
Enabled: true
|
748
|
-
VersionAdded: '1.48'
|
749
513
|
|
750
514
|
Style/FileRead:
|
751
|
-
Description: 'Favor `File.(bin)read` convenience methods.'
|
752
|
-
StyleGuide: '#file-read'
|
753
515
|
Enabled: true
|
754
|
-
VersionAdded: '1.24'
|
755
516
|
|
756
517
|
Style/FileWrite:
|
757
|
-
Description: 'Favor `File.(bin)write` convenience methods.'
|
758
|
-
StyleGuide: '#file-write'
|
759
518
|
Enabled: true
|
760
|
-
VersionAdded: '1.24'
|
761
519
|
|
762
520
|
Style/FloatDivision:
|
763
|
-
Description: 'For performing float division, coerce one side only.'
|
764
|
-
StyleGuide: '#float-division'
|
765
|
-
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
766
521
|
Enabled: true
|
767
|
-
VersionAdded: '0.72'
|
768
|
-
VersionChanged: '1.9'
|
769
|
-
Safe: false
|
770
522
|
EnforcedStyle: single_coerce
|
771
523
|
SupportedStyles:
|
772
524
|
- left_coerce
|
@@ -775,22 +527,14 @@ Style/FloatDivision:
|
|
775
527
|
- fdiv
|
776
528
|
|
777
529
|
Style/For:
|
778
|
-
Description: 'Checks use of for or each in multiline loops.'
|
779
|
-
StyleGuide: '#no-for-loops'
|
780
530
|
Enabled: true
|
781
|
-
VersionAdded: '0.13'
|
782
|
-
VersionChanged: '1.26'
|
783
531
|
EnforcedStyle: each
|
784
532
|
SupportedStyles:
|
785
533
|
- each
|
786
534
|
- for
|
787
535
|
|
788
536
|
Style/FormatString:
|
789
|
-
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
790
|
-
StyleGuide: '#sprintf'
|
791
537
|
Enabled: true
|
792
|
-
VersionAdded: '0.19'
|
793
|
-
VersionChanged: '0.49'
|
794
538
|
EnforcedStyle: format
|
795
539
|
SupportedStyles:
|
796
540
|
- format
|
@@ -798,7 +542,6 @@ Style/FormatString:
|
|
798
542
|
- percent
|
799
543
|
|
800
544
|
Style/FormatStringToken:
|
801
|
-
Description: 'Use a consistent style for format string tokens.'
|
802
545
|
Enabled: true
|
803
546
|
EnforcedStyle: template
|
804
547
|
SupportedStyles:
|
@@ -812,18 +555,11 @@ Style/FormatStringToken:
|
|
812
555
|
# style token in a format string to be allowed when enforced style is not
|
813
556
|
# `unannotated`.
|
814
557
|
MaxUnannotatedPlaceholdersAllowed: 0
|
815
|
-
VersionAdded: '0.49'
|
816
|
-
VersionChanged: '1.0'
|
817
558
|
AllowedMethods: [ ]
|
818
559
|
AllowedPatterns: [ ]
|
819
560
|
|
820
561
|
Style/FrozenStringLiteralComment:
|
821
|
-
Description: >-
|
822
|
-
Add the frozen_string_literal comment to the top of files
|
823
|
-
to help transition to frozen string literals by default.
|
824
562
|
Enabled: true
|
825
|
-
VersionAdded: '0.36'
|
826
|
-
VersionChanged: '0.79'
|
827
563
|
EnforcedStyle: always
|
828
564
|
SupportedStyles:
|
829
565
|
# `always` will always add the frozen string literal comment to a file
|
@@ -842,87 +578,46 @@ Style/FrozenStringLiteralComment:
|
|
842
578
|
- './**/*.json.jbuilder'
|
843
579
|
|
844
580
|
Style/GlobalStdStream:
|
845
|
-
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
846
|
-
StyleGuide: '#global-stdout'
|
847
581
|
Enabled: true
|
848
|
-
VersionAdded: '0.89'
|
849
582
|
|
850
583
|
Style/GlobalVars:
|
851
|
-
Description: 'Do not introduce global variables.'
|
852
|
-
StyleGuide: '#instance-vars'
|
853
|
-
Reference: 'https://www.zenspider.com/ruby/quickref.html'
|
854
584
|
Enabled: true
|
855
|
-
VersionAdded: '0.13'
|
856
585
|
# Built-in global variables are allowed by default.
|
857
586
|
AllowedVariables: [ ]
|
858
587
|
|
859
588
|
Style/GuardClause:
|
860
|
-
Description: 'Check for conditionals that can be replaced with guard clauses.'
|
861
|
-
StyleGuide: '#no-nested-conditionals'
|
862
589
|
Enabled: true
|
863
|
-
VersionAdded: '0.20'
|
864
|
-
VersionChanged: '1.31'
|
865
590
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
866
591
|
# needs to have to trigger this cop
|
867
592
|
MinBodyLength: 1
|
868
593
|
AllowConsecutiveConditionals: false
|
869
594
|
|
870
595
|
Style/HashAsLastArrayItem:
|
871
|
-
Description: >-
|
872
|
-
Checks for presence or absence of braces around hash literal as a last
|
873
|
-
array item depending on configuration.
|
874
|
-
StyleGuide: '#hash-literal-as-last-array-item'
|
875
596
|
Enabled: true
|
876
|
-
VersionAdded: '0.88'
|
877
597
|
EnforcedStyle: braces
|
878
598
|
SupportedStyles:
|
879
599
|
- braces
|
880
600
|
- no_braces
|
881
601
|
|
882
602
|
Style/HashConversion:
|
883
|
-
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
884
|
-
StyleGuide: '#avoid-hash-constructor'
|
885
603
|
Enabled: true
|
886
|
-
VersionAdded: '1.10'
|
887
|
-
VersionChanged: '1.11'
|
888
604
|
AllowSplatArgument: false
|
889
605
|
|
890
606
|
Style/HashEachMethods:
|
891
|
-
Description: 'Use Hash#each_key and Hash#each_value.'
|
892
|
-
StyleGuide: '#hash-each'
|
893
607
|
Enabled: true
|
894
|
-
Safe: false
|
895
|
-
VersionAdded: '0.80'
|
896
|
-
VersionChanged: '1.16'
|
897
608
|
AllowedReceivers: [ ]
|
898
609
|
|
899
610
|
Style/HashExcept:
|
900
|
-
Description: >-
|
901
|
-
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
902
|
-
that can be replaced with `Hash#except` method.
|
903
611
|
Enabled: true
|
904
|
-
Safe: false
|
905
|
-
VersionAdded: '1.7'
|
906
|
-
VersionChanged: '1.39'
|
907
612
|
|
908
613
|
Style/HashLikeCase:
|
909
|
-
Description: >-
|
910
|
-
Checks for places where `case-when` represents a simple 1:1
|
911
|
-
mapping and can be replaced with a hash lookup.
|
912
614
|
Enabled: true
|
913
|
-
VersionAdded: '0.88'
|
914
615
|
# `MinBranchesCount` defines the number of branches `case` needs to have
|
915
616
|
# to trigger this cop
|
916
617
|
MinBranchesCount: 3
|
917
618
|
|
918
619
|
Style/HashSyntax:
|
919
|
-
Description: >-
|
920
|
-
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
921
|
-
{ :a => 1, :b => 2 }.
|
922
|
-
StyleGuide: '#hash-literals'
|
923
620
|
Enabled: true
|
924
|
-
VersionAdded: '0.9'
|
925
|
-
VersionChanged: '1.24'
|
926
621
|
EnforcedStyle: ruby19_no_mixed_keys
|
927
622
|
SupportedStyles:
|
928
623
|
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
@@ -950,100 +645,46 @@ Style/HashSyntax:
|
|
950
645
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
951
646
|
|
952
647
|
Style/HashTransformKeys:
|
953
|
-
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
954
648
|
Enabled: true
|
955
|
-
VersionAdded: '0.80'
|
956
|
-
VersionChanged: '0.90'
|
957
|
-
Safe: false
|
958
649
|
|
959
650
|
Style/HashTransformValues:
|
960
|
-
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
961
651
|
Enabled: true
|
962
|
-
VersionAdded: '0.80'
|
963
|
-
VersionChanged: '0.90'
|
964
|
-
Safe: false
|
965
652
|
|
966
653
|
Style/IdenticalConditionalBranches:
|
967
|
-
Description: >-
|
968
|
-
Checks that conditional statements do not have an identical
|
969
|
-
line at the end of each branch, which can validly be moved
|
970
|
-
out of the conditional.
|
971
654
|
Enabled: true
|
972
|
-
VersionAdded: '0.36'
|
973
|
-
VersionChanged: '1.19'
|
974
655
|
|
975
656
|
Style/IfInsideElse:
|
976
|
-
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
977
657
|
Enabled: true
|
978
658
|
AllowIfModifier: true
|
979
|
-
VersionAdded: '0.36'
|
980
|
-
VersionChanged: '1.3'
|
981
659
|
|
982
660
|
Style/IfUnlessModifier:
|
983
|
-
Description: >-
|
984
|
-
Favor modifier if/unless usage when you have a
|
985
|
-
single-line body.
|
986
|
-
StyleGuide: '#if-as-a-modifier'
|
987
661
|
Enabled: false
|
988
|
-
VersionAdded: '0.9'
|
989
|
-
VersionChanged: '0.30'
|
990
662
|
|
991
663
|
Style/IfUnlessModifierOfIfUnless:
|
992
|
-
Description: >-
|
993
|
-
Avoid modifier if/unless usage on conditionals.
|
994
664
|
Enabled: true
|
995
|
-
VersionAdded: '0.39'
|
996
|
-
VersionChanged: '0.87'
|
997
665
|
|
998
666
|
Style/IfWithBooleanLiteralBranches:
|
999
|
-
Description: 'Checks for redundant `if` with boolean literal branches.'
|
1000
667
|
Enabled: true
|
1001
|
-
VersionAdded: '1.9'
|
1002
668
|
AllowedMethods:
|
1003
669
|
- nonzero?
|
1004
670
|
|
1005
671
|
Style/IfWithSemicolon:
|
1006
|
-
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
1007
|
-
StyleGuide: '#no-semicolon-ifs'
|
1008
672
|
Enabled: true
|
1009
|
-
VersionAdded: '0.9'
|
1010
|
-
VersionChanged: '0.83'
|
1011
673
|
|
1012
674
|
Style/ImplicitRuntimeError:
|
1013
|
-
Description: >-
|
1014
|
-
Use `raise` or `fail` with an explicit exception class and
|
1015
|
-
message, rather than just a message.
|
1016
675
|
Enabled: false
|
1017
|
-
VersionAdded: '0.41'
|
1018
676
|
|
1019
677
|
Style/InPatternThen:
|
1020
|
-
Description: 'Checks for `in;` uses in `case` expressions.'
|
1021
|
-
StyleGuide: '#no-in-pattern-semicolons'
|
1022
678
|
Enabled: true
|
1023
|
-
VersionAdded: '1.16'
|
1024
679
|
|
1025
680
|
Style/InfiniteLoop:
|
1026
|
-
Description: >-
|
1027
|
-
Use Kernel#loop for infinite loops.
|
1028
|
-
This cop is unsafe if the body may raise a `StopIteration` exception.
|
1029
|
-
Safe: false
|
1030
|
-
StyleGuide: '#infinite-loop'
|
1031
681
|
Enabled: true
|
1032
|
-
VersionAdded: '0.26'
|
1033
|
-
VersionChanged: '0.61'
|
1034
682
|
|
1035
683
|
Style/InlineComment:
|
1036
|
-
Description: 'Avoid trailing inline comments.'
|
1037
684
|
Enabled: true
|
1038
|
-
VersionAdded: '0.23'
|
1039
685
|
|
1040
686
|
Style/InverseMethods:
|
1041
|
-
Description: >-
|
1042
|
-
Use the inverse method instead of `!.method`
|
1043
|
-
if an inverse method is defined.
|
1044
687
|
Enabled: true
|
1045
|
-
Safe: false
|
1046
|
-
VersionAdded: '0.48'
|
1047
688
|
# `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
|
1048
689
|
# The relationship of inverse methods only needs to be defined in one direction.
|
1049
690
|
# Keys and values both need to be defined as symbols.
|
@@ -1065,9 +706,7 @@ Style/InverseMethods:
|
|
1065
706
|
:select!: :reject!
|
1066
707
|
|
1067
708
|
Style/InvertibleUnlessCondition:
|
1068
|
-
Description: 'Favor `if` with inverted condition over `unless`.'
|
1069
709
|
Enabled: true
|
1070
|
-
VersionAdded: '1.44'
|
1071
710
|
# `InverseMethods` are methods that can be inverted in a `unless` condition.
|
1072
711
|
# The relationship of inverse methods needs to be defined in both directions.
|
1073
712
|
# Keys and values both need to be defined as symbols.
|
@@ -1092,10 +731,7 @@ Style/InvertibleUnlessCondition:
|
|
1092
731
|
# :many?: :one?
|
1093
732
|
|
1094
733
|
Style/IpAddresses:
|
1095
|
-
Description: "Don't include literal IP addresses in code."
|
1096
734
|
Enabled: true
|
1097
|
-
VersionAdded: '0.58'
|
1098
|
-
VersionChanged: '0.91'
|
1099
735
|
# Allow addresses to be permitted
|
1100
736
|
AllowedAddresses:
|
1101
737
|
- "::"
|
@@ -1107,18 +743,10 @@ Style/IpAddresses:
|
|
1107
743
|
- '**/*.gemspec'
|
1108
744
|
|
1109
745
|
Style/KeywordParametersOrder:
|
1110
|
-
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
1111
|
-
StyleGuide: '#keyword-parameters-order'
|
1112
746
|
Enabled: true
|
1113
|
-
VersionAdded: '0.90'
|
1114
|
-
VersionChanged: '1.7'
|
1115
747
|
|
1116
748
|
Style/Lambda:
|
1117
|
-
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
1118
|
-
StyleGuide: '#lambda-multi-line'
|
1119
749
|
Enabled: true
|
1120
|
-
VersionAdded: '0.9'
|
1121
|
-
VersionChanged: '0.40'
|
1122
750
|
EnforcedStyle: literal
|
1123
751
|
SupportedStyles:
|
1124
752
|
- line_count_dependent
|
@@ -1126,28 +754,17 @@ Style/Lambda:
|
|
1126
754
|
- literal
|
1127
755
|
|
1128
756
|
Style/LambdaCall:
|
1129
|
-
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
1130
|
-
StyleGuide: '#proc-call'
|
1131
757
|
Enabled: true
|
1132
|
-
VersionAdded: '0.13'
|
1133
|
-
VersionChanged: '0.14'
|
1134
758
|
EnforcedStyle: call
|
1135
759
|
SupportedStyles:
|
1136
760
|
- call
|
1137
761
|
- braces
|
1138
762
|
|
1139
763
|
Style/LineEndConcatenation:
|
1140
|
-
Description: >-
|
1141
|
-
Use \ instead of + or << to concatenate two string literals at
|
1142
|
-
line end.
|
1143
764
|
Enabled: true
|
1144
|
-
VersionAdded: '0.18'
|
1145
|
-
VersionChanged: '0.64'
|
1146
765
|
|
1147
766
|
Style/MagicCommentFormat:
|
1148
|
-
Description: 'Use a consistent style for magic comments.'
|
1149
767
|
Enabled: true
|
1150
|
-
VersionAdded: '1.35'
|
1151
768
|
EnforcedStyle: snake_case
|
1152
769
|
SupportedStyles:
|
1153
770
|
# `snake` will enforce the magic comment is written
|
@@ -1165,28 +782,16 @@ Style/MagicCommentFormat:
|
|
1165
782
|
- uppercase
|
1166
783
|
|
1167
784
|
Style/MapCompactWithConditionalBlock:
|
1168
|
-
Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
|
1169
785
|
Enabled: true
|
1170
|
-
VersionAdded: '1.30'
|
1171
786
|
|
1172
787
|
Style/MapToHash:
|
1173
|
-
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
1174
788
|
Enabled: true
|
1175
|
-
VersionAdded: '1.24'
|
1176
|
-
Safe: false
|
1177
789
|
|
1178
790
|
Style/MapToSet:
|
1179
|
-
Description: Prefer `to_set` with a block over `map.to_set`.
|
1180
791
|
Enabled: true
|
1181
|
-
Safe: false
|
1182
|
-
VersionAdded: '1.42'
|
1183
792
|
|
1184
793
|
Style/MethodCallWithArgsParentheses:
|
1185
|
-
Description: 'Use parentheses for method calls with arguments.'
|
1186
|
-
StyleGuide: '#method-invocation-parens'
|
1187
794
|
Enabled: true
|
1188
|
-
VersionAdded: '0.47'
|
1189
|
-
VersionChanged: '1.7'
|
1190
795
|
IgnoreMacros: true
|
1191
796
|
AllowedMethods: [ ]
|
1192
797
|
AllowedPatterns: [ ]
|
@@ -1204,28 +809,15 @@ Style/MethodCallWithArgsParentheses:
|
|
1204
809
|
- 'Gemfile'
|
1205
810
|
|
1206
811
|
Style/MethodCallWithoutArgsParentheses:
|
1207
|
-
Description: 'Do not use parentheses for method calls with no arguments.'
|
1208
|
-
StyleGuide: '#method-invocation-parens'
|
1209
812
|
Enabled: true
|
1210
813
|
AllowedMethods: [ ]
|
1211
814
|
AllowedPatterns: [ ]
|
1212
|
-
VersionAdded: '0.47'
|
1213
|
-
VersionChanged: '0.55'
|
1214
815
|
|
1215
816
|
Style/MethodCalledOnDoEndBlock:
|
1216
|
-
Description: 'Avoid chaining a method call on a do...end block.'
|
1217
|
-
StyleGuide: '#single-line-blocks'
|
1218
817
|
Enabled: true
|
1219
|
-
VersionAdded: '0.14'
|
1220
818
|
|
1221
819
|
Style/MethodDefParentheses:
|
1222
|
-
Description: >-
|
1223
|
-
Checks if the method definitions have or don't have
|
1224
|
-
parentheses.
|
1225
|
-
StyleGuide: '#method-parens'
|
1226
820
|
Enabled: true
|
1227
|
-
VersionAdded: '0.16'
|
1228
|
-
VersionChanged: '1.7'
|
1229
821
|
EnforcedStyle: require_parentheses
|
1230
822
|
SupportedStyles:
|
1231
823
|
- require_parentheses
|
@@ -1233,29 +825,13 @@ Style/MethodDefParentheses:
|
|
1233
825
|
- require_no_parentheses_except_multiline
|
1234
826
|
|
1235
827
|
Style/MinMax:
|
1236
|
-
Description: >-
|
1237
|
-
Use `Enumerable#minmax` instead of `Enumerable#min`
|
1238
|
-
and `Enumerable#max` in conjunction.
|
1239
828
|
Enabled: true
|
1240
|
-
VersionAdded: '0.50'
|
1241
829
|
|
1242
830
|
Style/MinMaxComparison:
|
1243
|
-
Description: Enforces the use of `max` or `min` instead of comparison for greater
|
1244
|
-
or less.
|
1245
831
|
Enabled: true
|
1246
|
-
Safe: false
|
1247
|
-
VersionAdded: '1.42'
|
1248
832
|
|
1249
833
|
Style/MissingElse:
|
1250
|
-
Description: >-
|
1251
|
-
Require if/case expressions to have an else branches.
|
1252
|
-
If enabled, it is recommended that
|
1253
|
-
Style/UnlessElse and Style/EmptyElse be enabled.
|
1254
|
-
This will conflict with Style/EmptyElse if
|
1255
|
-
Style/EmptyElse is configured to style "both".
|
1256
834
|
Enabled: false
|
1257
|
-
VersionAdded: '0.30'
|
1258
|
-
VersionChanged: '0.38'
|
1259
835
|
EnforcedStyle: both
|
1260
836
|
SupportedStyles:
|
1261
837
|
# if - warn when an if expression is missing an else branch
|
@@ -1266,19 +842,10 @@ Style/MissingElse:
|
|
1266
842
|
- both
|
1267
843
|
|
1268
844
|
Style/MissingRespondToMissing:
|
1269
|
-
Description: >-
|
1270
|
-
Checks if `method_missing` is implemented
|
1271
|
-
without implementing `respond_to_missing`.
|
1272
|
-
StyleGuide: '#no-method-missing'
|
1273
845
|
Enabled: true
|
1274
|
-
VersionAdded: '0.56'
|
1275
846
|
|
1276
847
|
Style/MixinGrouping:
|
1277
|
-
Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
|
1278
|
-
StyleGuide: '#mixin-grouping'
|
1279
848
|
Enabled: true
|
1280
|
-
VersionAdded: '0.48'
|
1281
|
-
VersionChanged: '0.49'
|
1282
849
|
EnforcedStyle: separated
|
1283
850
|
SupportedStyles:
|
1284
851
|
# separated: each mixed in module goes in a separate statement.
|
@@ -1287,18 +854,12 @@ Style/MixinGrouping:
|
|
1287
854
|
- grouped
|
1288
855
|
|
1289
856
|
Style/MixinUsage:
|
1290
|
-
Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
|
1291
857
|
Enabled: true
|
1292
|
-
VersionAdded: '0.51'
|
1293
858
|
Exclude:
|
1294
859
|
- './**/*.rake'
|
1295
860
|
|
1296
861
|
Style/ModuleFunction:
|
1297
|
-
Description: 'Checks for usage of `extend self` in modules.'
|
1298
|
-
StyleGuide: '#module-function'
|
1299
862
|
Enabled: true
|
1300
|
-
VersionAdded: '0.11'
|
1301
|
-
VersionChanged: '0.65'
|
1302
863
|
EnforcedStyle: module_function
|
1303
864
|
SupportedStyles:
|
1304
865
|
- module_function
|
@@ -1307,76 +868,40 @@ Style/ModuleFunction:
|
|
1307
868
|
Autocorrect: false
|
1308
869
|
|
1309
870
|
Style/MultilineBlockChain:
|
1310
|
-
Description: 'Avoid multi-line chains of blocks.'
|
1311
|
-
StyleGuide: '#single-line-blocks'
|
1312
871
|
Enabled: true
|
1313
|
-
VersionAdded: '0.13'
|
1314
872
|
|
1315
873
|
Style/MultilineIfModifier:
|
1316
|
-
Description: 'Only use if/unless modifiers on single line statements.'
|
1317
|
-
StyleGuide: '#no-multiline-if-modifiers'
|
1318
874
|
Enabled: true
|
1319
|
-
VersionAdded: '0.45'
|
1320
875
|
|
1321
876
|
Style/MultilineIfThen:
|
1322
|
-
Description: 'Do not use then for multi-line if/unless.'
|
1323
|
-
StyleGuide: '#no-then'
|
1324
877
|
Enabled: true
|
1325
|
-
VersionAdded: '0.9'
|
1326
|
-
VersionChanged: '0.26'
|
1327
878
|
|
1328
879
|
Style/MultilineInPatternThen:
|
1329
|
-
Description: 'Do not use `then` for multi-line `in` statement.'
|
1330
|
-
StyleGuide: '#no-then'
|
1331
880
|
Enabled: true
|
1332
|
-
VersionAdded: '1.16'
|
1333
881
|
|
1334
882
|
Style/MultilineMemoization:
|
1335
|
-
Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
|
1336
883
|
Enabled: true
|
1337
|
-
VersionAdded: '0.44'
|
1338
|
-
VersionChanged: '0.48'
|
1339
884
|
EnforcedStyle: keyword
|
1340
885
|
SupportedStyles:
|
1341
886
|
- keyword
|
1342
887
|
- braces
|
1343
888
|
|
1344
889
|
Style/MultilineMethodSignature:
|
1345
|
-
Description: 'Avoid multi-line method signatures.'
|
1346
890
|
Enabled: false
|
1347
|
-
VersionAdded: '0.59'
|
1348
|
-
VersionChanged: '1.7'
|
1349
891
|
|
1350
892
|
Style/MultilineTernaryOperator:
|
1351
|
-
Description: >-
|
1352
|
-
Avoid multi-line ?: (the ternary operator);
|
1353
|
-
use if/unless instead.
|
1354
|
-
StyleGuide: '#no-multiline-ternary'
|
1355
893
|
Enabled: true
|
1356
|
-
VersionAdded: '0.9'
|
1357
|
-
VersionChanged: '0.86'
|
1358
894
|
|
1359
895
|
Style/MultilineWhenThen:
|
1360
|
-
Description: 'Do not use then for multi-line when statement.'
|
1361
|
-
StyleGuide: '#no-then'
|
1362
896
|
Enabled: true
|
1363
|
-
VersionAdded: '0.73'
|
1364
897
|
|
1365
898
|
Style/MultipleComparison:
|
1366
|
-
Description: >-
|
1367
|
-
Avoid comparing a variable with multiple items in a conditional,
|
1368
|
-
use Array#include? instead.
|
1369
899
|
Enabled: true
|
1370
|
-
VersionAdded: '0.49'
|
1371
|
-
VersionChanged: '1.1'
|
1372
900
|
AllowMethodComparison: true
|
1373
901
|
ComparisonsThreshold: 2
|
1374
902
|
|
1375
903
|
Style/MutableConstant:
|
1376
|
-
Description: 'Do not assign mutable objects to constants.'
|
1377
904
|
Enabled: true
|
1378
|
-
VersionAdded: '0.34'
|
1379
|
-
VersionChanged: '1.8'
|
1380
905
|
EnforcedStyle: literals
|
1381
906
|
SupportedStyles:
|
1382
907
|
# literals: freeze literals assigned to constants
|
@@ -1389,13 +914,7 @@ Style/MutableConstant:
|
|
1389
914
|
- strict
|
1390
915
|
|
1391
916
|
Style/NegatedIf:
|
1392
|
-
Description: >-
|
1393
|
-
Favor unless over if for negative conditions
|
1394
|
-
(or control flow or).
|
1395
|
-
StyleGuide: '#unless-for-negatives'
|
1396
917
|
Enabled: true
|
1397
|
-
VersionAdded: '0.20'
|
1398
|
-
VersionChanged: '0.48'
|
1399
918
|
EnforcedStyle: both
|
1400
919
|
SupportedStyles:
|
1401
920
|
# both: prefix and postfix negated `if` should both use `unless`
|
@@ -1406,17 +925,10 @@ Style/NegatedIf:
|
|
1406
925
|
- postfix
|
1407
926
|
|
1408
927
|
Style/NegatedIfElseCondition:
|
1409
|
-
Description: >-
|
1410
|
-
Checks for uses of `if-else` and ternary operators with a negated condition
|
1411
|
-
which can be simplified by inverting condition and swapping branches.
|
1412
928
|
Enabled: true
|
1413
|
-
VersionAdded: '1.2'
|
1414
929
|
|
1415
930
|
Style/NegatedUnless:
|
1416
|
-
Description: 'Favor if over unless for negative conditions.'
|
1417
|
-
StyleGuide: '#if-for-negatives'
|
1418
931
|
Enabled: true
|
1419
|
-
VersionAdded: '0.69'
|
1420
932
|
EnforcedStyle: both
|
1421
933
|
SupportedStyles:
|
1422
934
|
# both: prefix and postfix negated `unless` should both use `if`
|
@@ -1427,29 +939,16 @@ Style/NegatedUnless:
|
|
1427
939
|
- postfix
|
1428
940
|
|
1429
941
|
Style/NegatedWhile:
|
1430
|
-
Description: 'Favor until over while for negative conditions.'
|
1431
|
-
StyleGuide: '#until-for-negatives'
|
1432
942
|
Enabled: true
|
1433
|
-
VersionAdded: '0.20'
|
1434
943
|
|
1435
944
|
Style/NestedFileDirname:
|
1436
|
-
Description: 'Checks for nested `File.dirname`.'
|
1437
945
|
Enabled: true
|
1438
|
-
VersionAdded: '1.26'
|
1439
946
|
|
1440
947
|
Style/NestedModifier:
|
1441
|
-
Description: 'Avoid using nested modifiers.'
|
1442
|
-
StyleGuide: '#no-nested-modifiers'
|
1443
948
|
Enabled: true
|
1444
|
-
VersionAdded: '0.35'
|
1445
949
|
|
1446
950
|
Style/NestedParenthesizedCalls:
|
1447
|
-
Description: >-
|
1448
|
-
Parenthesize method calls which are nested inside the
|
1449
|
-
argument list of another parenthesized method call.
|
1450
951
|
Enabled: true
|
1451
|
-
VersionAdded: '0.36'
|
1452
|
-
VersionChanged: '0.77'
|
1453
952
|
AllowedMethods:
|
1454
953
|
- be
|
1455
954
|
- be_a
|
@@ -1470,18 +969,10 @@ Style/NestedParenthesizedCalls:
|
|
1470
969
|
- start_with
|
1471
970
|
|
1472
971
|
Style/NestedTernaryOperator:
|
1473
|
-
Description: 'Use one expression per branch in a ternary operator.'
|
1474
|
-
StyleGuide: '#no-nested-ternary'
|
1475
972
|
Enabled: true
|
1476
|
-
VersionAdded: '0.9'
|
1477
|
-
VersionChanged: '0.86'
|
1478
973
|
|
1479
974
|
Style/Next:
|
1480
|
-
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
1481
|
-
StyleGuide: '#no-nested-conditionals'
|
1482
975
|
Enabled: true
|
1483
|
-
VersionAdded: '0.22'
|
1484
|
-
VersionChanged: '0.35'
|
1485
976
|
# With `always` all conditions at the end of an iteration needs to be
|
1486
977
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
1487
978
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
@@ -1494,28 +985,17 @@ Style/Next:
|
|
1494
985
|
- always
|
1495
986
|
|
1496
987
|
Style/NilComparison:
|
1497
|
-
Description: 'Prefer x.nil? to x == nil.'
|
1498
|
-
StyleGuide: '#predicate-methods'
|
1499
988
|
Enabled: true
|
1500
|
-
VersionAdded: '0.12'
|
1501
|
-
VersionChanged: '0.59'
|
1502
989
|
EnforcedStyle: predicate
|
1503
990
|
SupportedStyles:
|
1504
991
|
- predicate
|
1505
992
|
- comparison
|
1506
993
|
|
1507
994
|
Style/NilLambda:
|
1508
|
-
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
1509
995
|
Enabled: true
|
1510
|
-
VersionAdded: '1.3'
|
1511
|
-
VersionChanged: '1.15'
|
1512
996
|
|
1513
997
|
Style/NonNilCheck:
|
1514
|
-
Description: 'Checks for redundant nil checks.'
|
1515
|
-
StyleGuide: '#no-non-nil-checks'
|
1516
998
|
Enabled: true
|
1517
|
-
VersionAdded: '0.20'
|
1518
|
-
VersionChanged: '0.22'
|
1519
999
|
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
1520
1000
|
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
1521
1001
|
# **usually** OK, but might change behavior.
|
@@ -1525,45 +1005,28 @@ Style/NonNilCheck:
|
|
1525
1005
|
IncludeSemanticChanges: false
|
1526
1006
|
|
1527
1007
|
Style/Not:
|
1528
|
-
Description: 'Use ! instead of not.'
|
1529
|
-
StyleGuide: '#bang-not-not'
|
1530
1008
|
Enabled: true
|
1531
|
-
VersionAdded: '0.9'
|
1532
|
-
VersionChanged: '0.20'
|
1533
1009
|
|
1534
1010
|
Style/NumberedParameters:
|
1535
|
-
Description: 'Restrict the usage of numbered parameters.'
|
1536
1011
|
Enabled: true
|
1537
|
-
VersionAdded: '1.22'
|
1538
1012
|
EnforcedStyle: disallow
|
1539
1013
|
SupportedStyles:
|
1540
1014
|
- allow_single_line
|
1541
1015
|
- disallow
|
1542
1016
|
|
1543
1017
|
Style/NumberedParametersLimit:
|
1544
|
-
Description: 'Avoid excessive numbered params in a single block.'
|
1545
1018
|
Enabled: true
|
1546
|
-
VersionAdded: '1.22'
|
1547
1019
|
Max: 0
|
1548
1020
|
|
1549
1021
|
Style/NumericLiteralPrefix:
|
1550
|
-
Description: 'Use smallcase prefixes for numeric literals.'
|
1551
|
-
StyleGuide: '#numeric-literal-prefixes'
|
1552
1022
|
Enabled: true
|
1553
|
-
VersionAdded: '0.41'
|
1554
1023
|
EnforcedOctalStyle: zero_with_o
|
1555
1024
|
SupportedOctalStyles:
|
1556
1025
|
- zero_with_o
|
1557
1026
|
- zero_only
|
1558
1027
|
|
1559
1028
|
Style/NumericLiterals:
|
1560
|
-
Description: >-
|
1561
|
-
Add underscores to large numeric literals to improve their
|
1562
|
-
readability.
|
1563
|
-
StyleGuide: '#underscores-in-numerics'
|
1564
1029
|
Enabled: true
|
1565
|
-
VersionAdded: '0.9'
|
1566
|
-
VersionChanged: '0.48'
|
1567
1030
|
Strict: true
|
1568
1031
|
MinDigits: 4
|
1569
1032
|
# You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
|
@@ -1578,17 +1041,10 @@ Style/NumericLiterals:
|
|
1578
1041
|
AllowedPatterns: [ ]
|
1579
1042
|
|
1580
1043
|
Style/NumericPredicate:
|
1581
|
-
Description: >-
|
1582
|
-
Checks for the use of predicate- or comparison methods for
|
1583
|
-
numeric comparisons.
|
1584
|
-
StyleGuide: '#predicate-methods'
|
1585
|
-
Safe: false
|
1586
1044
|
# This will change to a new method call which isn't guaranteed to be on the
|
1587
1045
|
# object. Switching these methods has to be done with knowledge of the types
|
1588
1046
|
# of the variables which rubocop doesn't have.
|
1589
1047
|
Enabled: false
|
1590
|
-
VersionAdded: '0.42'
|
1591
|
-
VersionChanged: '0.59'
|
1592
1048
|
EnforcedStyle: predicate
|
1593
1049
|
SupportedStyles:
|
1594
1050
|
- predicate
|
@@ -1601,10 +1057,7 @@ Style/NumericPredicate:
|
|
1601
1057
|
- 'spec/**/*'
|
1602
1058
|
|
1603
1059
|
Style/ObjectThen:
|
1604
|
-
Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
|
1605
|
-
StyleGuide: '#object-yield-self-vs-object-then'
|
1606
1060
|
Enabled: true
|
1607
|
-
VersionAdded: '1.28'
|
1608
1061
|
# Use `Object#yield_self` or `Object#then`?
|
1609
1062
|
# Prefer `Object#yield_self` to `Object#then` (yield_self)
|
1610
1063
|
# Prefer `Object#then` to `Object#yield_self` (then)
|
@@ -1614,35 +1067,17 @@ Style/ObjectThen:
|
|
1614
1067
|
- yield_self
|
1615
1068
|
|
1616
1069
|
Style/OneLineConditional:
|
1617
|
-
Description: >-
|
1618
|
-
Favor the ternary operator (?:) or multi-line constructs over
|
1619
|
-
single-line if/then/else/end constructs.
|
1620
|
-
StyleGuide: '#ternary-operator'
|
1621
1070
|
Enabled: true
|
1622
1071
|
AlwaysCorrectToMultiline: false
|
1623
|
-
VersionAdded: '0.9'
|
1624
|
-
VersionChanged: '0.90'
|
1625
1072
|
|
1626
1073
|
Style/OpenStructUse:
|
1627
|
-
Description: >-
|
1628
|
-
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
1629
|
-
version compatibility, and potential security issues.
|
1630
|
-
Reference:
|
1631
|
-
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
1632
1074
|
Enabled: true
|
1633
|
-
VersionAdded: '1.23'
|
1634
1075
|
|
1635
1076
|
Style/OperatorMethodCall:
|
1636
|
-
Description: 'Checks for redundant dot before operator method call.'
|
1637
|
-
StyleGuide: '#operator-method-call'
|
1638
1077
|
Enabled: true
|
1639
|
-
VersionAdded: '1.37'
|
1640
1078
|
|
1641
1079
|
Style/OptionHash:
|
1642
|
-
Description: "Don't use option hashes when you can use keyword arguments."
|
1643
1080
|
Enabled: false
|
1644
|
-
VersionAdded: '0.33'
|
1645
|
-
VersionChanged: '0.34'
|
1646
1081
|
# A list of parameter names that will be flagged by this cop.
|
1647
1082
|
SuspiciousParamNames:
|
1648
1083
|
- options
|
@@ -1653,100 +1088,54 @@ Style/OptionHash:
|
|
1653
1088
|
Allowlist: [ ]
|
1654
1089
|
|
1655
1090
|
Style/OptionalArguments:
|
1656
|
-
Description: >-
|
1657
|
-
Checks for optional arguments that do not appear at the end
|
1658
|
-
of the argument list.
|
1659
|
-
StyleGuide: '#optional-arguments'
|
1660
1091
|
Enabled: true
|
1661
|
-
Safe: false
|
1662
|
-
VersionAdded: '0.33'
|
1663
|
-
VersionChanged: '0.83'
|
1664
1092
|
|
1665
1093
|
Style/OptionalBooleanParameter:
|
1666
|
-
Description: 'Use keyword arguments when defining method with boolean argument.'
|
1667
|
-
StyleGuide: '#boolean-keyword-arguments'
|
1668
1094
|
Enabled: false
|
1669
|
-
Safe: false
|
1670
|
-
VersionAdded: '0.89'
|
1671
1095
|
AllowedMethods:
|
1672
1096
|
- respond_to_missing?
|
1673
1097
|
|
1674
1098
|
Style/OrAssignment:
|
1675
|
-
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
1676
|
-
StyleGuide: '#double-pipe-for-uninit'
|
1677
1099
|
Enabled: true
|
1678
|
-
VersionAdded: '0.50'
|
1679
1100
|
|
1680
1101
|
Style/ParallelAssignment:
|
1681
|
-
Description: >-
|
1682
|
-
Check for simple usages of parallel assignment.
|
1683
|
-
It will only warn when the number of variables
|
1684
|
-
matches on both sides of the assignment.
|
1685
|
-
StyleGuide: '#parallel-assignment'
|
1686
1102
|
Enabled: true
|
1687
|
-
VersionAdded: '0.32'
|
1688
1103
|
|
1689
1104
|
Style/ParenthesesAroundCondition:
|
1690
|
-
Description: >-
|
1691
|
-
Don't use parentheses around the condition of an
|
1692
|
-
if/unless/while.
|
1693
|
-
StyleGuide: '#no-parens-around-condition'
|
1694
1105
|
Enabled: true
|
1695
|
-
VersionAdded: '0.9'
|
1696
|
-
VersionChanged: '0.56'
|
1697
1106
|
AllowSafeAssignment: true
|
1698
1107
|
AllowInMultilineConditions: false
|
1699
1108
|
|
1700
1109
|
Style/PercentLiteralDelimiters:
|
1701
|
-
Description: 'Use `%`-literal delimiters consistently.'
|
1702
|
-
StyleGuide: '#percent-literal-braces'
|
1703
1110
|
Enabled: true
|
1704
|
-
VersionAdded: '0.19'
|
1705
1111
|
# Specify the default preferred delimiter for all types with the 'default' key
|
1706
1112
|
# Override individual delimiters (even with default specified) by specifying
|
1707
1113
|
# an individual key
|
1708
1114
|
PreferredDelimiters:
|
1709
1115
|
default: '[]'
|
1710
|
-
VersionChanged: '0.48'
|
1711
1116
|
|
1712
1117
|
Style/PercentQLiterals:
|
1713
|
-
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
1714
1118
|
Enabled: true
|
1715
|
-
VersionAdded: '0.25'
|
1716
1119
|
EnforcedStyle: lower_case_q
|
1717
1120
|
SupportedStyles:
|
1718
1121
|
- lower_case_q # Use `%q` when possible, `%Q` when necessary
|
1719
1122
|
- upper_case_q # Always use `%Q`
|
1720
1123
|
|
1721
1124
|
Style/PerlBackrefs:
|
1722
|
-
Description: 'Avoid Perl-style regex back references.'
|
1723
|
-
StyleGuide: '#no-perl-regexp-last-matchers'
|
1724
1125
|
Enabled: true
|
1725
|
-
VersionAdded: '0.13'
|
1726
1126
|
|
1727
1127
|
Style/PreferredHashMethods:
|
1728
|
-
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
1729
|
-
StyleGuide: '#hash-key'
|
1730
1128
|
Enabled: false
|
1731
|
-
Safe: false
|
1732
|
-
VersionAdded: '0.41'
|
1733
|
-
VersionChanged: '0.70'
|
1734
1129
|
EnforcedStyle: short
|
1735
1130
|
SupportedStyles:
|
1736
1131
|
- short
|
1737
1132
|
- verbose
|
1738
1133
|
|
1739
1134
|
Style/Proc:
|
1740
|
-
Description: 'Use proc instead of Proc.new.'
|
1741
|
-
StyleGuide: '#proc'
|
1742
1135
|
Enabled: true
|
1743
|
-
VersionAdded: '0.9'
|
1744
|
-
VersionChanged: '0.18'
|
1745
1136
|
|
1746
1137
|
Style/QuotedSymbols:
|
1747
|
-
Description: 'Use a consistent style for quoted symbols.'
|
1748
1138
|
Enabled: true
|
1749
|
-
VersionAdded: '1.16'
|
1750
1139
|
EnforcedStyle: same_as_string_literals
|
1751
1140
|
SupportedStyles:
|
1752
1141
|
- same_as_string_literals
|
@@ -1754,11 +1143,7 @@ Style/QuotedSymbols:
|
|
1754
1143
|
- double_quotes
|
1755
1144
|
|
1756
1145
|
Style/RaiseArgs:
|
1757
|
-
Description: 'Checks the arguments passed to raise/fail.'
|
1758
|
-
StyleGuide: '#exception-class-messages'
|
1759
1146
|
Enabled: true
|
1760
|
-
VersionAdded: '0.14'
|
1761
|
-
VersionChanged: '1.2'
|
1762
1147
|
EnforcedStyle: exploded
|
1763
1148
|
SupportedStyles:
|
1764
1149
|
- compact # raise Exception.new(msg)
|
@@ -1766,19 +1151,10 @@ Style/RaiseArgs:
|
|
1766
1151
|
AllowedCompactTypes: [ ]
|
1767
1152
|
|
1768
1153
|
Style/RandomWithOffset:
|
1769
|
-
Description: >-
|
1770
|
-
Prefer to use ranges when generating random numbers instead of
|
1771
|
-
integers with offsets.
|
1772
|
-
StyleGuide: '#random-numbers'
|
1773
1154
|
Enabled: true
|
1774
|
-
VersionAdded: '0.52'
|
1775
1155
|
|
1776
1156
|
Style/RedundantArgument:
|
1777
|
-
Description: 'Check for a redundant argument passed to certain methods.'
|
1778
1157
|
Enabled: true
|
1779
|
-
Safe: false
|
1780
|
-
VersionAdded: '1.4'
|
1781
|
-
VersionChanged: '1.40'
|
1782
1158
|
Methods:
|
1783
1159
|
# Array#sum
|
1784
1160
|
sum: 0
|
@@ -1788,208 +1164,110 @@ Style/RedundantArgument:
|
|
1788
1164
|
chomp!:
|
1789
1165
|
|
1790
1166
|
Style/RedundantArrayConstructor:
|
1791
|
-
Description: Checks for the instantiation of array using redundant `Array` constructor.
|
1792
1167
|
Enabled: true
|
1793
|
-
VersionAdded: '1.52'
|
1794
1168
|
|
1795
1169
|
Style/RedundantAssignment:
|
1796
|
-
Description: 'Checks for redundant assignment before returning.'
|
1797
1170
|
Enabled: true
|
1798
|
-
VersionAdded: '0.87'
|
1799
1171
|
|
1800
1172
|
Style/RedundantBegin:
|
1801
|
-
Description: "Don't use begin blocks when they are not needed."
|
1802
|
-
StyleGuide: '#begin-implicit'
|
1803
1173
|
Enabled: true
|
1804
|
-
VersionAdded: '0.10'
|
1805
|
-
VersionChanged: '0.21'
|
1806
1174
|
|
1807
1175
|
Style/RedundantCapitalW:
|
1808
|
-
Description: 'Checks for %W when interpolation is not needed.'
|
1809
1176
|
Enabled: true
|
1810
|
-
VersionAdded: '0.76'
|
1811
1177
|
|
1812
1178
|
Style/RedundantCondition:
|
1813
|
-
Description: 'Checks for unnecessary conditional expressions.'
|
1814
1179
|
Enabled: true
|
1815
|
-
VersionAdded: '0.76'
|
1816
1180
|
|
1817
1181
|
Style/RedundantConditional:
|
1818
|
-
Description: "Don't return true/false from a conditional."
|
1819
1182
|
Enabled: true
|
1820
|
-
VersionAdded: '0.50'
|
1821
1183
|
|
1822
1184
|
Style/RedundantConstantBase:
|
1823
|
-
Description: Avoid redundant `::` prefix on constant.
|
1824
1185
|
Enabled: true
|
1825
|
-
VersionAdded: '1.40'
|
1826
1186
|
|
1827
1187
|
Style/RedundantCurrentDirectoryInPath:
|
1828
|
-
Description: Checks for uses a redundant current directory in path.
|
1829
1188
|
Enabled: true
|
1830
|
-
VersionAdded: '1.53'
|
1831
1189
|
|
1832
1190
|
Style/RedundantDoubleSplatHashBraces:
|
1833
|
-
Description: 'Checks for redundant uses of double splat hash braces.'
|
1834
1191
|
Enabled: true
|
1835
|
-
VersionAdded: '1.41'
|
1836
1192
|
|
1837
1193
|
Style/RedundantEach:
|
1838
|
-
Description: 'Checks for redundant `each`.'
|
1839
1194
|
Enabled: true
|
1840
|
-
Safe: false
|
1841
|
-
VersionAdded: '1.38'
|
1842
1195
|
|
1843
1196
|
Style/RedundantException:
|
1844
|
-
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
1845
|
-
StyleGuide: '#no-explicit-runtimeerror'
|
1846
1197
|
Enabled: true
|
1847
|
-
VersionAdded: '0.14'
|
1848
|
-
VersionChanged: '0.29'
|
1849
1198
|
|
1850
1199
|
Style/RedundantFetchBlock:
|
1851
|
-
Description: >-
|
1852
|
-
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
1853
|
-
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
1854
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
1855
1200
|
Enabled: true
|
1856
|
-
Safe: false
|
1857
1201
|
# If enabled, this cop will autocorrect usages of
|
1858
1202
|
# `fetch` being called with block returning a constant.
|
1859
1203
|
# This can be dangerous since constants will not be defined at that moment.
|
1860
1204
|
SafeForConstants: false
|
1861
|
-
VersionAdded: '0.86'
|
1862
1205
|
|
1863
1206
|
Style/RedundantFileExtensionInRequire:
|
1864
|
-
Description: >-
|
1865
|
-
Checks for the presence of superfluous `.rb` extension in
|
1866
|
-
the filename provided to `require` and `require_relative`.
|
1867
|
-
StyleGuide: '#no-explicit-rb-to-require'
|
1868
1207
|
Enabled: true
|
1869
|
-
VersionAdded: '0.88'
|
1870
1208
|
|
1871
1209
|
Style/RedundantFilterChain:
|
1872
|
-
Description: Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods
|
1873
|
-
chained to `select`/`filter`/`find_all` and change them to use predicate method
|
1874
|
-
instead.
|
1875
1210
|
Enabled: true
|
1876
|
-
VersionAdded: '1.52'
|
1877
1211
|
|
1878
1212
|
Style/RedundantFreeze:
|
1879
|
-
Description: "Checks usages of Object#freeze on immutable objects."
|
1880
1213
|
Enabled: true
|
1881
|
-
VersionAdded: '0.34'
|
1882
|
-
VersionChanged: '0.66'
|
1883
1214
|
|
1884
1215
|
Style/RedundantHeredocDelimiterQuotes:
|
1885
|
-
Description: 'Checks for redundant heredoc delimiter quotes.'
|
1886
1216
|
Enabled: true
|
1887
|
-
VersionAdded: '1.45'
|
1888
1217
|
|
1889
1218
|
Style/RedundantInitialize:
|
1890
|
-
Description: 'Checks for redundant `initialize` methods.'
|
1891
1219
|
Enabled: true
|
1892
|
-
Safe: false
|
1893
1220
|
AllowComments: true
|
1894
|
-
VersionAdded: '1.27'
|
1895
|
-
VersionChanged: '1.28'
|
1896
1221
|
|
1897
1222
|
Style/RedundantInterpolation:
|
1898
|
-
Description: 'Checks for strings that are just an interpolated expression.'
|
1899
1223
|
Enabled: true
|
1900
|
-
VersionAdded: '0.76'
|
1901
|
-
VersionChanged: '1.30'
|
1902
1224
|
|
1903
1225
|
Style/RedundantLineContinuation:
|
1904
|
-
Description: Check for redundant line continuation.
|
1905
1226
|
Enabled: true
|
1906
|
-
VersionAdded: '1.49'
|
1907
1227
|
|
1908
1228
|
Style/RedundantParentheses:
|
1909
|
-
Description: "Checks for parentheses that seem not to serve any purpose."
|
1910
1229
|
Enabled: true
|
1911
|
-
VersionAdded: '0.36'
|
1912
1230
|
|
1913
1231
|
Style/RedundantPercentQ:
|
1914
|
-
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
1915
|
-
StyleGuide: '#percent-q'
|
1916
1232
|
Enabled: true
|
1917
|
-
VersionAdded: '0.76'
|
1918
1233
|
|
1919
1234
|
Style/RedundantRegexpArgument:
|
1920
|
-
Description: Identifies places where argument can be replaced from a deterministic
|
1921
|
-
regexp to a string.
|
1922
1235
|
Enabled: true
|
1923
|
-
VersionAdded: '1.53'
|
1924
1236
|
|
1925
1237
|
Style/RedundantRegexpCharacterClass:
|
1926
|
-
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
1927
1238
|
Enabled: true
|
1928
|
-
VersionAdded: '0.85'
|
1929
1239
|
|
1930
1240
|
Style/RedundantRegexpConstructor:
|
1931
|
-
Description: Checks for the instantiation of regexp using redundant `Regexp.new` or
|
1932
|
-
`Regexp.compile`.
|
1933
1241
|
Enabled: true
|
1934
|
-
VersionAdded: '1.52'
|
1935
1242
|
|
1936
1243
|
Style/RedundantRegexpEscape:
|
1937
|
-
Description: 'Checks for redundant escapes in Regexps.'
|
1938
1244
|
Enabled: true
|
1939
|
-
VersionAdded: '0.85'
|
1940
1245
|
|
1941
1246
|
Style/RedundantReturn:
|
1942
|
-
Description: "Don't use return where it's not required."
|
1943
|
-
StyleGuide: '#no-explicit-return'
|
1944
1247
|
Enabled: false
|
1945
|
-
VersionAdded: '0.10'
|
1946
|
-
VersionChanged: '0.14'
|
1947
1248
|
# When `true` allows code like `return x, y`.
|
1948
1249
|
AllowMultipleReturnValues: false
|
1949
1250
|
|
1950
1251
|
Style/RedundantSelf:
|
1951
|
-
Description: "Don't use self where it's not needed."
|
1952
|
-
StyleGuide: '#no-self-unless-required'
|
1953
1252
|
Enabled: true
|
1954
|
-
VersionAdded: '0.10'
|
1955
|
-
VersionChanged: '0.13'
|
1956
1253
|
|
1957
1254
|
Style/RedundantSelfAssignment:
|
1958
|
-
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
1959
1255
|
Enabled: true
|
1960
|
-
Safe: false
|
1961
|
-
VersionAdded: '0.90'
|
1962
1256
|
|
1963
1257
|
Style/RedundantSelfAssignmentBranch:
|
1964
|
-
Description: 'Checks for places where conditional branch makes redundant self-assignment.'
|
1965
1258
|
Enabled: true
|
1966
|
-
VersionAdded: '1.19'
|
1967
1259
|
|
1968
1260
|
Style/RedundantSort:
|
1969
|
-
Description: >-
|
1970
|
-
Use `min` instead of `sort.first`,
|
1971
|
-
`max_by` instead of `sort_by...last`, etc.
|
1972
1261
|
Enabled: true
|
1973
|
-
VersionAdded: '0.76'
|
1974
|
-
VersionChanged: '1.22'
|
1975
|
-
Safe: false
|
1976
1262
|
|
1977
1263
|
Style/RedundantSortBy:
|
1978
|
-
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
1979
1264
|
Enabled: true
|
1980
|
-
VersionAdded: '0.36'
|
1981
1265
|
|
1982
1266
|
Style/RedundantStringEscape:
|
1983
|
-
Description: 'Checks for redundant escapes in string literals.'
|
1984
1267
|
Enabled: true
|
1985
|
-
VersionAdded: '1.37'
|
1986
1268
|
|
1987
1269
|
Style/RegexpLiteral:
|
1988
|
-
Description: 'Use / or %r around regular expressions.'
|
1989
|
-
StyleGuide: '#percent-r'
|
1990
1270
|
Enabled: true
|
1991
|
-
VersionAdded: '0.9'
|
1992
|
-
VersionChanged: '0.30'
|
1993
1271
|
EnforcedStyle: slashes
|
1994
1272
|
# slashes: Always use slashes.
|
1995
1273
|
# percent_r: Always use `%r`.
|
@@ -2003,21 +1281,13 @@ Style/RegexpLiteral:
|
|
2003
1281
|
AllowInnerSlashes: false
|
2004
1282
|
|
2005
1283
|
Style/RequireOrder:
|
2006
|
-
Description: Sort `require` and `require_relative` in alphabetical order.
|
2007
1284
|
Enabled: true
|
2008
|
-
VersionAdded: '1.40'
|
2009
1285
|
|
2010
1286
|
Style/RescueModifier:
|
2011
|
-
Description: 'Avoid using rescue in its modifier form.'
|
2012
|
-
StyleGuide: '#no-rescue-modifiers'
|
2013
1287
|
Enabled: true
|
2014
|
-
VersionAdded: '0.9'
|
2015
|
-
VersionChanged: '0.34'
|
2016
1288
|
|
2017
1289
|
Style/RescueStandardError:
|
2018
|
-
Description: 'Avoid rescuing without specifying an error class.'
|
2019
1290
|
Enabled: true
|
2020
|
-
VersionAdded: '0.52'
|
2021
1291
|
EnforcedStyle: implicit
|
2022
1292
|
# implicit: Do not include the error class, `rescue`
|
2023
1293
|
# explicit: Require an error class `rescue StandardError`
|
@@ -2026,32 +1296,19 @@ Style/RescueStandardError:
|
|
2026
1296
|
- explicit
|
2027
1297
|
|
2028
1298
|
Style/ReturnNil:
|
2029
|
-
Description: 'Use return instead of return nil.'
|
2030
1299
|
Enabled: false
|
2031
1300
|
EnforcedStyle: return
|
2032
1301
|
SupportedStyles:
|
2033
1302
|
- return
|
2034
1303
|
- return_nil
|
2035
|
-
VersionAdded: '0.50'
|
2036
1304
|
|
2037
1305
|
Style/ReturnNilInPredicateMethodDefinition:
|
2038
|
-
Description: Checks if uses of `return` or `return nil` in predicate method definition.
|
2039
|
-
StyleGuide: "#bool-methods-qmark"
|
2040
1306
|
Enabled: true
|
2041
1307
|
AllowedMethods: [ ]
|
2042
1308
|
AllowedPatterns: [ ]
|
2043
|
-
VersionAdded: '1.53'
|
2044
1309
|
|
2045
1310
|
Style/SafeNavigation:
|
2046
|
-
|
2047
|
-
Transforms usages of a method call safeguarded by
|
2048
|
-
a check for the existence of the object to
|
2049
|
-
safe navigation (`&.`).
|
2050
|
-
Autocorrection is unsafe as it assumes the object will
|
2051
|
-
be `nil` or truthy, but never `false`.
|
2052
|
-
Enabled: true
|
2053
|
-
VersionAdded: '0.43'
|
2054
|
-
VersionChanged: '1.27'
|
1311
|
+
Enabled: true
|
2055
1312
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
2056
1313
|
# to whatever it used to return.
|
2057
1314
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -2065,48 +1322,24 @@ Style/SafeNavigation:
|
|
2065
1322
|
MaxChainLength: 2
|
2066
1323
|
|
2067
1324
|
Style/Sample:
|
2068
|
-
Description: >-
|
2069
|
-
Use `sample` instead of `shuffle.first`,
|
2070
|
-
`shuffle.last`, and `shuffle[Integer]`.
|
2071
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
2072
1325
|
Enabled: true
|
2073
|
-
VersionAdded: '0.30'
|
2074
1326
|
|
2075
1327
|
Style/SelectByRegexp:
|
2076
|
-
Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
|
2077
1328
|
Enabled: true
|
2078
|
-
VersionAdded: '1.22'
|
2079
1329
|
|
2080
1330
|
Style/SelfAssignment:
|
2081
|
-
Description: >-
|
2082
|
-
Checks for places where self-assignment shorthand should have
|
2083
|
-
been used.
|
2084
|
-
StyleGuide: '#self-assignment'
|
2085
1331
|
Enabled: true
|
2086
|
-
VersionAdded: '0.19'
|
2087
|
-
VersionChanged: '0.29'
|
2088
1332
|
|
2089
1333
|
Style/Semicolon:
|
2090
|
-
Description: "Don't use semicolons to terminate expressions."
|
2091
|
-
StyleGuide: '#no-semicolon'
|
2092
1334
|
Enabled: true
|
2093
|
-
VersionAdded: '0.9'
|
2094
|
-
VersionChanged: '0.19'
|
2095
1335
|
# Allow `;` to separate several expressions on the same line.
|
2096
1336
|
AllowAsExpressionSeparator: false
|
2097
1337
|
|
2098
1338
|
Style/Send:
|
2099
|
-
Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
|
2100
|
-
StyleGuide: '#prefer-public-send'
|
2101
1339
|
Enabled: true
|
2102
|
-
VersionAdded: '0.33'
|
2103
1340
|
|
2104
1341
|
Style/SignalException:
|
2105
|
-
Description: 'Checks for proper usage of fail and raise.'
|
2106
|
-
StyleGuide: '#prefer-raise-over-fail'
|
2107
1342
|
Enabled: true
|
2108
|
-
VersionAdded: '0.11'
|
2109
|
-
VersionChanged: '0.37'
|
2110
1343
|
EnforcedStyle: only_raise
|
2111
1344
|
SupportedStyles:
|
2112
1345
|
- only_raise
|
@@ -2114,16 +1347,10 @@ Style/SignalException:
|
|
2114
1347
|
- semantic
|
2115
1348
|
|
2116
1349
|
Style/SingleArgumentDig:
|
2117
|
-
Description: 'Avoid using single argument dig method.'
|
2118
1350
|
Enabled: false
|
2119
|
-
VersionAdded: '0.89'
|
2120
|
-
Safe: false
|
2121
1351
|
|
2122
1352
|
Style/SingleLineBlockParams:
|
2123
|
-
Description: 'Enforces the names of some block params.'
|
2124
1353
|
Enabled: false
|
2125
|
-
VersionAdded: '0.16'
|
2126
|
-
VersionChanged: '1.6'
|
2127
1354
|
Methods:
|
2128
1355
|
- reduce:
|
2129
1356
|
- acc
|
@@ -2132,35 +1359,22 @@ Style/SingleLineBlockParams:
|
|
2132
1359
|
- acc
|
2133
1360
|
- elem
|
2134
1361
|
|
1362
|
+
Style/SingleLineDoEndBlock:
|
1363
|
+
Enabled: true
|
1364
|
+
|
2135
1365
|
Style/SingleLineMethods:
|
2136
|
-
Description: 'Avoid single-line methods.'
|
2137
|
-
StyleGuide: '#no-single-line-methods'
|
2138
1366
|
Enabled: true
|
2139
|
-
VersionAdded: '0.9'
|
2140
|
-
VersionChanged: '1.8'
|
2141
1367
|
AllowIfMethodIsEmpty: true
|
2142
1368
|
|
2143
1369
|
Style/SlicingWithRange:
|
2144
|
-
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
2145
1370
|
Enabled: true
|
2146
|
-
VersionAdded: '0.83'
|
2147
|
-
Safe: false
|
2148
1371
|
|
2149
1372
|
Style/SoleNestedConditional:
|
2150
|
-
Description: >-
|
2151
|
-
Finds sole nested conditional nodes
|
2152
|
-
which can be merged into outer conditional node.
|
2153
1373
|
Enabled: true
|
2154
|
-
VersionAdded: '0.89'
|
2155
|
-
VersionChanged: '1.5'
|
2156
1374
|
AllowModifier: true
|
2157
1375
|
|
2158
1376
|
Style/SpecialGlobalVars:
|
2159
|
-
Description: 'Avoid Perl-style global variables.'
|
2160
|
-
StyleGuide: '#no-cryptic-perlisms'
|
2161
1377
|
Enabled: true
|
2162
|
-
VersionAdded: '0.13'
|
2163
|
-
VersionChanged: '0.36'
|
2164
1378
|
RequireEnglish: true
|
2165
1379
|
EnforcedStyle: use_english_names
|
2166
1380
|
SupportedStyles:
|
@@ -2169,58 +1383,30 @@ Style/SpecialGlobalVars:
|
|
2169
1383
|
- use_builtin_english_names
|
2170
1384
|
|
2171
1385
|
Style/StabbyLambdaParentheses:
|
2172
|
-
Description: 'Check for the usage of parentheses around stabby lambda arguments.'
|
2173
|
-
StyleGuide: '#stabby-lambda-with-args'
|
2174
1386
|
Enabled: true
|
2175
|
-
VersionAdded: '0.35'
|
2176
1387
|
EnforcedStyle: require_parentheses
|
2177
1388
|
SupportedStyles:
|
2178
1389
|
- require_parentheses
|
2179
1390
|
- require_no_parentheses
|
2180
1391
|
|
2181
1392
|
Style/StaticClass:
|
2182
|
-
Description: 'Prefer modules to classes with only class methods.'
|
2183
|
-
StyleGuide: '#modules-vs-classes'
|
2184
1393
|
Enabled: true
|
2185
|
-
Safe: false
|
2186
|
-
VersionAdded: '1.3'
|
2187
1394
|
|
2188
1395
|
Style/StderrPuts:
|
2189
|
-
Description: 'Use `warn` instead of `$stderr.puts`.'
|
2190
|
-
StyleGuide: '#warn'
|
2191
1396
|
Enabled: true
|
2192
|
-
VersionAdded: '0.51'
|
2193
1397
|
|
2194
1398
|
Style/StringChars:
|
2195
|
-
Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
|
2196
|
-
StyleGuide: '#string-chars'
|
2197
1399
|
Enabled: true
|
2198
|
-
Safe: false
|
2199
|
-
VersionAdded: '1.12'
|
2200
1400
|
|
2201
1401
|
Style/StringConcatenation:
|
2202
|
-
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
2203
|
-
StyleGuide: '#string-interpolation'
|
2204
1402
|
Enabled: true
|
2205
|
-
Safe: false
|
2206
|
-
VersionAdded: '0.89'
|
2207
|
-
VersionChanged: '1.18'
|
2208
1403
|
Mode: aggressive
|
2209
1404
|
|
2210
1405
|
Style/StringHashKeys:
|
2211
|
-
Description: 'Prefer symbols instead of strings as hash keys.'
|
2212
|
-
StyleGuide: '#symbols-as-keys'
|
2213
1406
|
Enabled: false
|
2214
|
-
VersionAdded: '0.52'
|
2215
|
-
VersionChanged: '0.75'
|
2216
|
-
Safe: false
|
2217
1407
|
|
2218
1408
|
Style/StringLiterals:
|
2219
|
-
Description: 'Checks if uses of quotes match the configured preference.'
|
2220
|
-
StyleGuide: '#consistent-string-literals'
|
2221
1409
|
Enabled: true
|
2222
|
-
VersionAdded: '0.9'
|
2223
|
-
VersionChanged: '0.36'
|
2224
1410
|
EnforcedStyle: single_quotes
|
2225
1411
|
SupportedStyles:
|
2226
1412
|
- single_quotes
|
@@ -2230,21 +1416,14 @@ Style/StringLiterals:
|
|
2230
1416
|
ConsistentQuotesInMultiline: false
|
2231
1417
|
|
2232
1418
|
Style/StringLiteralsInInterpolation:
|
2233
|
-
Description: >-
|
2234
|
-
Checks if uses of quotes inside expressions in interpolated
|
2235
|
-
strings match the configured preference.
|
2236
1419
|
Enabled: true
|
2237
|
-
VersionAdded: '0.27'
|
2238
1420
|
EnforcedStyle: single_quotes
|
2239
1421
|
SupportedStyles:
|
2240
1422
|
- single_quotes
|
2241
1423
|
- double_quotes
|
2242
1424
|
|
2243
1425
|
Style/StringMethods:
|
2244
|
-
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
2245
1426
|
Enabled: true
|
2246
|
-
VersionAdded: '0.34'
|
2247
|
-
VersionChanged: '0.34'
|
2248
1427
|
# Mapping from undesired method to desired_method
|
2249
1428
|
# e.g. to use `to_sym` over `intern`:
|
2250
1429
|
#
|
@@ -2255,29 +1434,19 @@ Style/StringMethods:
|
|
2255
1434
|
intern: to_sym
|
2256
1435
|
|
2257
1436
|
Style/Strip:
|
2258
|
-
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
2259
1437
|
Enabled: true
|
2260
|
-
VersionAdded: '0.36'
|
2261
1438
|
|
2262
1439
|
Style/StructInheritance:
|
2263
|
-
Description: 'Checks for inheritance from Struct.new.'
|
2264
|
-
StyleGuide: '#no-extend-struct-new'
|
2265
1440
|
Enabled: true
|
2266
|
-
|
2267
|
-
|
1441
|
+
|
1442
|
+
Style/SuperWithArgsParentheses:
|
1443
|
+
Enabled: true
|
2268
1444
|
|
2269
1445
|
Style/SwapValues:
|
2270
|
-
Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
|
2271
|
-
StyleGuide: '#values-swapping'
|
2272
1446
|
Enabled: true
|
2273
|
-
VersionAdded: '1.1'
|
2274
1447
|
|
2275
1448
|
Style/SymbolArray:
|
2276
|
-
Description: 'Use %i or %I for arrays of symbols.'
|
2277
|
-
StyleGuide: '#percent-i'
|
2278
1449
|
Enabled: true
|
2279
|
-
VersionAdded: '0.9'
|
2280
|
-
VersionChanged: '0.49'
|
2281
1450
|
EnforcedStyle: percent
|
2282
1451
|
MinSize: 2
|
2283
1452
|
SupportedStyles:
|
@@ -2285,16 +1454,10 @@ Style/SymbolArray:
|
|
2285
1454
|
- brackets
|
2286
1455
|
|
2287
1456
|
Style/SymbolLiteral:
|
2288
|
-
Description: 'Use plain symbols instead of string symbols when possible.'
|
2289
1457
|
Enabled: true
|
2290
|
-
VersionAdded: '0.30'
|
2291
1458
|
|
2292
1459
|
Style/SymbolProc:
|
2293
|
-
Description: 'Use symbols as procs instead of blocks when possible.'
|
2294
1460
|
Enabled: true
|
2295
|
-
Safe: false
|
2296
|
-
VersionAdded: '0.26'
|
2297
|
-
VersionChanged: '1.40'
|
2298
1461
|
AllowMethodsWithArguments: false
|
2299
1462
|
# A list of method names to be always allowed by the check.
|
2300
1463
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
@@ -2304,10 +1467,7 @@ Style/SymbolProc:
|
|
2304
1467
|
AllowComments: false
|
2305
1468
|
|
2306
1469
|
Style/TernaryParentheses:
|
2307
|
-
Description: 'Checks for use of parentheses around ternary conditions.'
|
2308
1470
|
Enabled: true
|
2309
|
-
VersionAdded: '0.42'
|
2310
|
-
VersionChanged: '0.46'
|
2311
1471
|
EnforcedStyle: require_parentheses_when_complex
|
2312
1472
|
SupportedStyles:
|
2313
1473
|
- require_parentheses
|
@@ -2316,31 +1476,19 @@ Style/TernaryParentheses:
|
|
2316
1476
|
AllowSafeAssignment: false
|
2317
1477
|
|
2318
1478
|
Style/TopLevelMethodDefinition:
|
2319
|
-
Description: 'Looks for top-level method definitions.'
|
2320
|
-
StyleGuide: '#top-level-methods'
|
2321
1479
|
Enabled: false
|
2322
|
-
VersionAdded: '1.15'
|
2323
1480
|
|
2324
1481
|
Style/TrailingBodyOnClass:
|
2325
|
-
Description: 'Class body goes below class statement.'
|
2326
1482
|
Enabled: true
|
2327
|
-
VersionAdded: '0.53'
|
2328
1483
|
|
2329
1484
|
Style/TrailingBodyOnMethodDefinition:
|
2330
|
-
Description: 'Method body goes below definition.'
|
2331
1485
|
Enabled: true
|
2332
|
-
VersionAdded: '0.52'
|
2333
1486
|
|
2334
1487
|
Style/TrailingBodyOnModule:
|
2335
|
-
Description: 'Module body goes below module statement.'
|
2336
1488
|
Enabled: true
|
2337
|
-
VersionAdded: '0.53'
|
2338
1489
|
|
2339
1490
|
Style/TrailingCommaInArguments:
|
2340
|
-
Description: 'Checks for trailing comma in argument lists.'
|
2341
|
-
StyleGuide: '#no-trailing-params-comma'
|
2342
1491
|
Enabled: true
|
2343
|
-
VersionAdded: '0.36'
|
2344
1492
|
# If `comma`, the cop requires a comma after the last argument, but only for
|
2345
1493
|
# parenthesized method calls where each argument is on its own line.
|
2346
1494
|
# If `consistent_comma`, the cop requires a comma after the last argument,
|
@@ -2352,10 +1500,7 @@ Style/TrailingCommaInArguments:
|
|
2352
1500
|
- no_comma
|
2353
1501
|
|
2354
1502
|
Style/TrailingCommaInArrayLiteral:
|
2355
|
-
Description: 'Checks for trailing comma in array literals.'
|
2356
|
-
StyleGuide: '#no-trailing-array-commas'
|
2357
1503
|
Enabled: true
|
2358
|
-
VersionAdded: '0.53'
|
2359
1504
|
# If `comma`, the cop requires a comma after the last item in an array,
|
2360
1505
|
# but only when each item is on its own line.
|
2361
1506
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
@@ -2367,13 +1512,9 @@ Style/TrailingCommaInArrayLiteral:
|
|
2367
1512
|
- no_comma
|
2368
1513
|
|
2369
1514
|
Style/TrailingCommaInBlockArgs:
|
2370
|
-
Description: 'Checks for useless trailing commas in block arguments.'
|
2371
1515
|
Enabled: true
|
2372
|
-
Safe: false
|
2373
|
-
VersionAdded: '0.81'
|
2374
1516
|
|
2375
1517
|
Style/TrailingCommaInHashLiteral:
|
2376
|
-
Description: 'Checks for trailing comma in hash literals.'
|
2377
1518
|
Enabled: true
|
2378
1519
|
# If `comma`, the cop requires a comma after the last item in a hash,
|
2379
1520
|
# but only when each item is on its own line.
|
@@ -2384,30 +1525,18 @@ Style/TrailingCommaInHashLiteral:
|
|
2384
1525
|
- comma
|
2385
1526
|
- consistent_comma
|
2386
1527
|
- no_comma
|
2387
|
-
VersionAdded: '0.53'
|
2388
1528
|
|
2389
1529
|
Style/TrailingMethodEndStatement:
|
2390
|
-
Description: 'Checks for trailing end statement on line of method body.'
|
2391
1530
|
Enabled: true
|
2392
|
-
VersionAdded: '0.52'
|
2393
1531
|
|
2394
1532
|
Style/TrailingUnderscoreVariable:
|
2395
|
-
Description: >-
|
2396
|
-
Checks for the usage of unneeded trailing underscores at the
|
2397
|
-
end of parallel variable assignment.
|
2398
1533
|
AllowNamedUnderscoreVariables: true
|
2399
1534
|
Enabled: true
|
2400
|
-
VersionAdded: '0.31'
|
2401
|
-
VersionChanged: '0.35'
|
2402
1535
|
|
2403
1536
|
# `TrivialAccessors` requires exact name matches and doesn't allow
|
2404
1537
|
# predicated methods by default.
|
2405
1538
|
Style/TrivialAccessors:
|
2406
|
-
Description: 'Prefer attr_* methods to trivial readers/writers.'
|
2407
|
-
StyleGuide: '#attr_family'
|
2408
1539
|
Enabled: true
|
2409
|
-
VersionAdded: '0.9'
|
2410
|
-
VersionChanged: '1.15'
|
2411
1540
|
# When set to `false` the cop will suggest the use of accessor methods
|
2412
1541
|
# in situations like:
|
2413
1542
|
#
|
@@ -2448,66 +1577,32 @@ Style/TrivialAccessors:
|
|
2448
1577
|
- to_sym
|
2449
1578
|
|
2450
1579
|
Style/UnlessElse:
|
2451
|
-
Description: >-
|
2452
|
-
Do not use unless with else. Rewrite these with the positive
|
2453
|
-
case first.
|
2454
|
-
StyleGuide: '#no-else-with-unless'
|
2455
1580
|
Enabled: true
|
2456
|
-
VersionAdded: '0.9'
|
2457
1581
|
|
2458
1582
|
Style/UnlessLogicalOperators:
|
2459
|
-
Description: >-
|
2460
|
-
Checks for use of logical operators in an unless condition.
|
2461
1583
|
Enabled: true
|
2462
|
-
VersionAdded: '1.11'
|
2463
1584
|
EnforcedStyle: forbid_logical_operators
|
2464
1585
|
SupportedStyles:
|
2465
1586
|
- forbid_mixed_logical_operators
|
2466
1587
|
- forbid_logical_operators
|
2467
1588
|
|
2468
1589
|
Style/UnpackFirst:
|
2469
|
-
Description: >-
|
2470
|
-
Checks for accessing the first element of `String#unpack`
|
2471
|
-
instead of using `unpack1`.
|
2472
1590
|
Enabled: true
|
2473
|
-
VersionAdded: '0.54'
|
2474
1591
|
|
2475
1592
|
Style/VariableInterpolation:
|
2476
|
-
Description: >-
|
2477
|
-
Don't interpolate global, instance and class variables
|
2478
|
-
directly in strings.
|
2479
|
-
StyleGuide: '#curlies-interpolate'
|
2480
1593
|
Enabled: true
|
2481
|
-
VersionAdded: '0.9'
|
2482
|
-
VersionChanged: '0.20'
|
2483
1594
|
|
2484
1595
|
Style/WhenThen:
|
2485
|
-
Description: 'Use when x then ... for one-line cases.'
|
2486
|
-
StyleGuide: '#no-when-semicolons'
|
2487
1596
|
Enabled: true
|
2488
|
-
VersionAdded: '0.9'
|
2489
1597
|
|
2490
1598
|
Style/WhileUntilDo:
|
2491
|
-
Description: 'Checks for redundant do after while or until.'
|
2492
|
-
StyleGuide: '#no-multiline-while-do'
|
2493
1599
|
Enabled: true
|
2494
|
-
VersionAdded: '0.9'
|
2495
1600
|
|
2496
1601
|
Style/WhileUntilModifier:
|
2497
|
-
Description: >-
|
2498
|
-
Favor modifier while/until usage when you have a
|
2499
|
-
single-line body.
|
2500
|
-
StyleGuide: '#while-as-a-modifier'
|
2501
1602
|
Enabled: false
|
2502
|
-
VersionAdded: '0.9'
|
2503
|
-
VersionChanged: '0.30'
|
2504
1603
|
|
2505
1604
|
Style/WordArray:
|
2506
|
-
Description: 'Use %w or %W for arrays of words.'
|
2507
|
-
StyleGuide: '#percent-w'
|
2508
1605
|
Enabled: true
|
2509
|
-
VersionAdded: '0.9'
|
2510
|
-
VersionChanged: '1.19'
|
2511
1606
|
EnforcedStyle: percent
|
2512
1607
|
SupportedStyles:
|
2513
1608
|
# percent style: %w(word1 word2)
|
@@ -2522,14 +1617,9 @@ Style/WordArray:
|
|
2522
1617
|
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
2523
1618
|
|
2524
1619
|
Style/YAMLFileRead:
|
2525
|
-
Description: Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse`
|
2526
|
-
with `File.read` argument.
|
2527
1620
|
Enabled: true
|
2528
|
-
VersionAdded: '1.53'
|
2529
1621
|
|
2530
1622
|
Style/YodaCondition:
|
2531
|
-
Description: 'Forbid or enforce yoda conditions.'
|
2532
|
-
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
2533
1623
|
Enabled: false
|
2534
1624
|
EnforcedStyle: forbid_for_all_comparison_operators
|
2535
1625
|
SupportedStyles:
|
@@ -2541,13 +1631,6 @@ Style/YodaCondition:
|
|
2541
1631
|
- require_for_all_comparison_operators
|
2542
1632
|
# enforce yoda only for equality operators: `!=` and `==`
|
2543
1633
|
- require_for_equality_operators_only
|
2544
|
-
Safe: false
|
2545
|
-
VersionAdded: '0.49'
|
2546
|
-
VersionChanged: '0.75'
|
2547
1634
|
|
2548
1635
|
Style/ZeroLengthPredicate:
|
2549
|
-
Description: 'Use #empty? when testing for objects of length 0.'
|
2550
1636
|
Enabled: true
|
2551
|
-
Safe: false
|
2552
|
-
VersionAdded: '0.37'
|
2553
|
-
VersionChanged: '0.39'
|