cookstyle 3.0.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/config/default.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  inherit_from:
2
2
  - upstream.yml
3
3
  - disable_all.yml
4
- - cookstyle_base.yml
5
4
  - cookstyle.yml
@@ -491,7 +491,7 @@ Style/EmptyElse:
491
491
  Enabled: false
492
492
  Style/EmptyLambdaParameter:
493
493
  Enabled: false
494
- Style/EmptyLineAfterGuardClause:
494
+ Layout/EmptyLineAfterGuardClause:
495
495
  Enabled: false
496
496
  Style/EmptyLiteral:
497
497
  Enabled: false
@@ -743,8 +743,12 @@ Rails/ApplicationJob:
743
743
  Enabled: false
744
744
  Rails/ApplicationRecord:
745
745
  Enabled: false
746
+ Rails/AssertNot:
747
+ Enabled: false
746
748
  Rails/Blank:
747
749
  Enabled: false
750
+ Rails/BulkChangeTable:
751
+ Enabled: false
748
752
  Rails/CreateTableWithTimestamps:
749
753
  Enabled: false
750
754
  Rails/Date:
@@ -779,6 +783,8 @@ Rails/InverseOf:
779
783
  Enabled: false
780
784
  Rails/LexicallyScopedActionFilter:
781
785
  Enabled: false
786
+ Rails/LinkToBlank:
787
+ Enabled: false
782
788
  Rails/NotNullColumn:
783
789
  Enabled: false
784
790
  Rails/OutputSafety:
@@ -795,6 +801,8 @@ Rails/ReadWriteAttribute:
795
801
  Enabled: false
796
802
  Rails/RedundantReceiverInWithOptions:
797
803
  Enabled: false
804
+ Rails/RefuteMethods:
805
+ Enabled: false
798
806
  Rails/RequestReferer:
799
807
  Enabled: false
800
808
  Rails/ReversibleMigration:
data/config/disabled.yml CHANGED
@@ -68,7 +68,7 @@ Style/DocumentationMethod:
68
68
  - 'spec/**/*'
69
69
  - 'test/**/*'
70
70
 
71
- Style/EmptyLineAfterGuardClause:
71
+ Layout/EmptyLineAfterGuardClause:
72
72
  Description: 'Add empty line after guard clause.'
73
73
  Enabled: false
74
74
 
data/config/upstream.yml CHANGED
@@ -6,9 +6,17 @@ inherit_from:
6
6
  - disabled.yml
7
7
 
8
8
  # Common configuration.
9
+
9
10
  AllCops:
11
+ RubyInterpreters:
12
+ - ruby
13
+ - macruby
14
+ - rake
15
+ - jruby
16
+ - rbx
10
17
  # Include common Ruby source files.
11
18
  Include:
19
+ - '**/*.rb'
12
20
  - '**/*.arb'
13
21
  - '**/*.axlsx'
14
22
  - '**/*.builder'
@@ -35,7 +43,6 @@ AllCops:
35
43
  - '**/.irbrc'
36
44
  - '**/.pryrc'
37
45
  - '**/buildfile'
38
- - '**/config.ru'
39
46
  - '**/Appraisals'
40
47
  - '**/Berksfile'
41
48
  - '**/Brewfile'
@@ -73,7 +80,7 @@ AllCops:
73
80
  DisplayStyleGuide: false
74
81
  # When specifying style guide URLs, any paths and/or fragments will be
75
82
  # evaluated relative to the base URL.
76
- StyleGuideBaseURL: https://github.com/bbatsov/ruby-style-guide
83
+ StyleGuideBaseURL: https://github.com/rubocop-hq/ruby-style-guide
77
84
  # Extra details are not displayed in offense messages by default. Change
78
85
  # behavior by overriding ExtraDetails, or by giving the
79
86
  # `-E/--extra-details` option.
@@ -82,15 +89,15 @@ AllCops:
82
89
  # default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
83
90
  # the `--only-guide-cops` option.
84
91
  StyleGuideCopsOnly: false
85
- # All cops except the ones in disabled.yml are enabled by default. Change
86
- # this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
92
+ # All cops except the ones configured `Enabled: false` in this file are enabled by default.
93
+ # Change this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
87
94
  # When `DisabledByDefault` is `true`, all cops in the default configuration
88
95
  # are disabled, and only cops in user configuration are enabled. This makes
89
96
  # cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
90
97
  # cops in user configuration will be enabled even if they don't set the
91
98
  # Enabled parameter.
92
- # When `EnabledByDefault` is `true`, all cops, even those in disabled.yml,
93
- # are enabled by default. Cops can still be disabled in user configuration.
99
+ # When `EnabledByDefault` is `true`, all cops, even those configured `Enabled: false`
100
+ # in this file are enabled by default. Cops can still be disabled in user configuration.
94
101
  # Note that it is invalid to set both EnabledByDefault and DisabledByDefault
95
102
  # to true in the same configuration.
96
103
  EnabledByDefault: false
@@ -123,21 +130,94 @@ AllCops:
123
130
  # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
124
131
  # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
125
132
  # from the lock file.) If the Ruby version is still unresolved, RuboCop will
126
- # use the oldest officially supported Ruby version (currently Ruby 2.1).
133
+ # use the oldest officially supported Ruby version (currently Ruby 2.2).
127
134
  TargetRubyVersion: ~
128
135
  # What version of Rails is the inspected code using? If a value is specified
129
- # for TargetRailsVersion then it is used. Acceptable values are specificed
136
+ # for TargetRailsVersion then it is used. Acceptable values are specificed
130
137
  # as a float (i.e. 5.1); the patch version of Rails should not be included.
131
138
  # If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
132
139
  # gems.locked file to find the version of Rails that has been bound to the
133
- # application. If neither of those files exist, RuboCop will use Rails 5.0
140
+ # application. If neither of those files exist, RuboCop will use Rails 5.0
134
141
  # as the default.
135
142
  TargetRailsVersion: ~
136
143
 
144
+ #################### Bundler ###############################
145
+
146
+ Bundler/DuplicatedGem:
147
+ Description: 'Checks for duplicate gem entries in Gemfile.'
148
+ Enabled: true
149
+ VersionAdded: '0.46'
150
+ Include:
151
+ - '**/*.gemfile'
152
+ - '**/Gemfile'
153
+ - '**/gems.rb'
154
+
155
+ Bundler/GemComment:
156
+ Description: 'Add a comment describing each gem.'
157
+ Enabled: false
158
+ VersionAdded: '0.59'
159
+ Include:
160
+ - '**/*.gemfile'
161
+ - '**/Gemfile'
162
+ - '**/gems.rb'
163
+ Whitelist: []
164
+
165
+ Bundler/InsecureProtocolSource:
166
+ Description: >-
167
+ The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
168
+ because HTTP requests are insecure. Please change your source to
169
+ 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
170
+ Enabled: true
171
+ VersionAdded: '0.50'
172
+ Include:
173
+ - '**/*.gemfile'
174
+ - '**/Gemfile'
175
+ - '**/gems.rb'
176
+
177
+ Bundler/OrderedGems:
178
+ Description: >-
179
+ Gems within groups in the Gemfile should be alphabetically sorted.
180
+ Enabled: true
181
+ VersionAdded: '0.46'
182
+ VersionChanged: '0.47'
183
+ TreatCommentsAsGroupSeparators: true
184
+ Include:
185
+ - '**/*.gemfile'
186
+ - '**/Gemfile'
187
+ - '**/gems.rb'
188
+
189
+ #################### Gemspec ###############################
190
+
191
+ Gemspec/DuplicatedAssignment:
192
+ Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
193
+ Enabled: true
194
+ VersionAdded: '0.52'
195
+ Include:
196
+ - '**/*.gemspec'
197
+
198
+ Gemspec/OrderedDependencies:
199
+ Description: >-
200
+ Dependencies in the gemspec should be alphabetically sorted.
201
+ Enabled: true
202
+ VersionAdded: '0.51'
203
+ TreatCommentsAsGroupSeparators: true
204
+ Include:
205
+ - '**/*.gemspec'
206
+
207
+ Gemspec/RequiredRubyVersion:
208
+ Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
209
+ Enabled: true
210
+ VersionAdded: '0.52'
211
+ Include:
212
+ - '**/*.gemspec'
213
+
137
214
  #################### Layout ###########################
138
215
 
139
- # Indent private/protected/public as deep as method definitions
140
216
  Layout/AccessModifierIndentation:
217
+ Description: Check indentation of private/protected visibility modifiers.
218
+ StyleGuide: '#indent-public-private-protected'
219
+ Enabled: true
220
+ VersionAdded: '0.49'
141
221
  EnforcedStyle: indent
142
222
  SupportedStyles:
143
223
  - outdent
@@ -146,8 +226,20 @@ Layout/AccessModifierIndentation:
146
226
  # But it can be overridden by setting this parameter
147
227
  IndentationWidth: ~
148
228
 
149
- # Align the elements of a hash literal if they span more than one line.
229
+ Layout/AlignArray:
230
+ Description: >-
231
+ Align the elements of an array literal if they span more than
232
+ one line.
233
+ StyleGuide: '#align-multiline-arrays'
234
+ Enabled: true
235
+ VersionAdded: '0.49'
236
+
150
237
  Layout/AlignHash:
238
+ Description: >-
239
+ Align the elements of a hash literal if they span more than
240
+ one line.
241
+ Enabled: true
242
+ VersionAdded: '0.49'
151
243
  # Alignment of entries using hash rocket as separator. Valid values are:
152
244
  #
153
245
  # key - left alignment of keys
@@ -219,6 +311,12 @@ Layout/AlignHash:
219
311
  - ignore_explicit
220
312
 
221
313
  Layout/AlignParameters:
314
+ Description: >-
315
+ Align the parameters of a method call if they span more
316
+ than one line.
317
+ StyleGuide: '#no-double-indent'
318
+ Enabled: true
319
+ VersionAdded: '0.49'
222
320
  # Alignment of parameters in multi-line method calls.
223
321
  #
224
322
  # The `with_first_parameter` style aligns the following lines along the same
@@ -240,8 +338,10 @@ Layout/AlignParameters:
240
338
  # But it can be overridden by setting this parameter
241
339
  IndentationWidth: ~
242
340
 
243
- # checks whether the end keywords are aligned properly for `do` `end` blocks.
244
341
  Layout/BlockAlignment:
342
+ Description: 'Align block ends correctly.'
343
+ Enabled: true
344
+ VersionAdded: '0.53'
245
345
  # The value `start_of_block` means that the `end` should be aligned with line
246
346
  # where the `do` keyword appears.
247
347
  # The value `start_of_line` means it should be aligned with the whole
@@ -253,8 +353,16 @@ Layout/BlockAlignment:
253
353
  - start_of_block
254
354
  - start_of_line
255
355
 
256
- # Indentation of `when`.
356
+ Layout/BlockEndNewline:
357
+ Description: 'Put end statement of multiline block on its own line.'
358
+ Enabled: true
359
+ VersionAdded: '0.49'
360
+
257
361
  Layout/CaseIndentation:
362
+ Description: 'Indentation of when in a case/when/[else/]end.'
363
+ StyleGuide: '#indent-when-to-case'
364
+ Enabled: true
365
+ VersionAdded: '0.49'
258
366
  EnforcedStyle: case
259
367
  SupportedStyles:
260
368
  - case
@@ -265,7 +373,52 @@ Layout/CaseIndentation:
265
373
  # This only matters if `IndentOneStep` is `true`
266
374
  IndentationWidth: ~
267
375
 
376
+ Layout/ClassStructure:
377
+ Description: 'Enforces a configured order of definitions within a class body.'
378
+ StyleGuide: 'https://github.com/rubocop-hq/ruby-style-guide#consistent-classes'
379
+ Enabled: false
380
+ VersionAdded: '0.52'
381
+ Categories:
382
+ module_inclusion:
383
+ - include
384
+ - prepend
385
+ - extend
386
+ ExpectedOrder:
387
+ - module_inclusion
388
+ - constants
389
+ - public_class_methods
390
+ - initializer
391
+ - public_methods
392
+ - protected_methods
393
+ - private_methods
394
+
395
+ Layout/ClosingHeredocIndentation:
396
+ Description: 'Checks the indentation of here document closings.'
397
+ Enabled: true
398
+ VersionAdded: '0.57'
399
+
400
+ Layout/ClosingParenthesisIndentation:
401
+ Description: 'Checks the indentation of hanging closing parentheses.'
402
+ Enabled: true
403
+ VersionAdded: '0.49'
404
+
405
+ Layout/CommentIndentation:
406
+ Description: 'Indentation of comments.'
407
+ Enabled: true
408
+ VersionAdded: '0.49'
409
+
410
+ Layout/ConditionPosition:
411
+ Description: >-
412
+ Checks for condition placed in a confusing position relative to
413
+ the keyword.
414
+ StyleGuide: '#same-line-condition'
415
+ Enabled: true
416
+ VersionAdded: '0.53'
417
+
268
418
  Layout/DefEndAlignment:
419
+ Description: 'Align ends corresponding to defs correctly.'
420
+ Enabled: true
421
+ VersionAdded: '0.53'
269
422
  # The value `def` means that `end` should be aligned with the def keyword.
270
423
  # The value `start_of_line` means that `end` should be aligned with method
271
424
  # calls like `private`, `public`, etc, if present in front of the `def`
@@ -277,32 +430,90 @@ Layout/DefEndAlignment:
277
430
  AutoCorrect: false
278
431
  Severity: warning
279
432
 
280
- # Multi-line method chaining should be done with leading dots.
281
433
  Layout/DotPosition:
434
+ Description: 'Checks the position of the dot in multi-line method calls.'
435
+ StyleGuide: '#consistent-multi-line-chains'
436
+ Enabled: true
437
+ VersionAdded: '0.49'
282
438
  EnforcedStyle: leading
283
439
  SupportedStyles:
284
440
  - leading
285
441
  - trailing
286
442
 
443
+ Layout/ElseAlignment:
444
+ Description: 'Align elses and elsifs correctly.'
445
+ Enabled: true
446
+ VersionAdded: '0.49'
447
+
287
448
  Layout/EmptyComment:
449
+ Description: 'Checks empty comment.'
450
+ Enabled: true
451
+ VersionAdded: '0.53'
288
452
  AllowBorderComment: true
289
453
  AllowMarginComment: true
290
454
 
291
- # Use empty lines between defs.
455
+ Layout/EmptyLineAfterGuardClause:
456
+ Description: 'Add empty line after guard clause.'
457
+ Enabled: true
458
+ VersionAdded: '0.56'
459
+ VersionChanged: '0.59'
460
+
461
+ Layout/EmptyLineAfterMagicComment:
462
+ Description: 'Add an empty line after magic comments to separate them from code.'
463
+ StyleGuide: '#separate-magic-comments-from-code'
464
+ Enabled: true
465
+ VersionAdded: '0.49'
466
+
292
467
  Layout/EmptyLineBetweenDefs:
468
+ Description: 'Use empty lines between defs.'
469
+ StyleGuide: '#empty-lines-between-methods'
470
+ Enabled: true
471
+ VersionAdded: '0.49'
293
472
  # If `true`, this parameter means that single line method definitions don't
294
473
  # need an empty line between them.
295
474
  AllowAdjacentOneLineDefs: false
296
475
  # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
297
476
  NumberOfEmptyLines: 1
298
477
 
478
+ Layout/EmptyLines:
479
+ Description: "Don't use several empty lines in a row."
480
+ StyleGuide: '#two-or-more-empty-lines'
481
+ Enabled: true
482
+ VersionAdded: '0.49'
483
+
484
+ Layout/EmptyLinesAroundAccessModifier:
485
+ Description: "Keep blank lines around access modifiers."
486
+ StyleGuide: '#empty-lines-around-access-modifier'
487
+ Enabled: true
488
+ VersionAdded: '0.49'
489
+
490
+ Layout/EmptyLinesAroundArguments:
491
+ Description: "Keeps track of empty lines around method arguments."
492
+ Enabled: true
493
+ VersionAdded: '0.52'
494
+
495
+ Layout/EmptyLinesAroundBeginBody:
496
+ Description: "Keeps track of empty lines around begin-end bodies."
497
+ StyleGuide: '#empty-lines-around-bodies'
498
+ Enabled: true
499
+ VersionAdded: '0.49'
500
+
299
501
  Layout/EmptyLinesAroundBlockBody:
502
+ Description: "Keeps track of empty lines around block bodies."
503
+ StyleGuide: '#empty-lines-around-bodies'
504
+ Enabled: true
505
+ VersionAdded: '0.49'
300
506
  EnforcedStyle: no_empty_lines
301
507
  SupportedStyles:
302
508
  - empty_lines
303
509
  - no_empty_lines
304
510
 
305
511
  Layout/EmptyLinesAroundClassBody:
512
+ Description: "Keeps track of empty lines around class bodies."
513
+ StyleGuide: '#empty-lines-around-bodies'
514
+ Enabled: true
515
+ VersionAdded: '0.49'
516
+ VersionChanged: '0.53'
306
517
  EnforcedStyle: no_empty_lines
307
518
  SupportedStyles:
308
519
  - empty_lines
@@ -312,7 +523,23 @@ Layout/EmptyLinesAroundClassBody:
312
523
  - beginning_only
313
524
  - ending_only
314
525
 
526
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
527
+ Description: "Keeps track of empty lines around exception handling keywords."
528
+ StyleGuide: '#empty-lines-around-bodies'
529
+ Enabled: true
530
+ VersionAdded: '0.49'
531
+
532
+ Layout/EmptyLinesAroundMethodBody:
533
+ Description: "Keeps track of empty lines around method bodies."
534
+ StyleGuide: '#empty-lines-around-bodies'
535
+ Enabled: true
536
+ VersionAdded: '0.49'
537
+
315
538
  Layout/EmptyLinesAroundModuleBody:
539
+ Description: "Keeps track of empty lines around module bodies."
540
+ StyleGuide: '#empty-lines-around-bodies'
541
+ Enabled: true
542
+ VersionAdded: '0.49'
316
543
  EnforcedStyle: no_empty_lines
317
544
  SupportedStyles:
318
545
  - empty_lines
@@ -320,8 +547,10 @@ Layout/EmptyLinesAroundModuleBody:
320
547
  - empty_lines_special
321
548
  - no_empty_lines
322
549
 
323
- # Align ends correctly.
324
550
  Layout/EndAlignment:
551
+ Description: 'Align ends correctly.'
552
+ Enabled: true
553
+ VersionAdded: '0.53'
325
554
  # The value `keyword` means that `end` should be aligned with the matching
326
555
  # keyword (`if`, `while`, etc.).
327
556
  # The value `variable` means that in assignments, `end` should be aligned
@@ -338,6 +567,10 @@ Layout/EndAlignment:
338
567
  Severity: warning
339
568
 
340
569
  Layout/EndOfLine:
570
+ Description: 'Use Unix-style line endings.'
571
+ StyleGuide: '#crlf'
572
+ Enabled: true
573
+ VersionAdded: '0.49'
341
574
  # The `native` style means that CR+LF (Carriage Return + Line Feed) is
342
575
  # enforced on Windows, and LF is enforced on other platforms. The other styles
343
576
  # mean LF and CR+LF, respectively.
@@ -348,6 +581,9 @@ Layout/EndOfLine:
348
581
  - crlf
349
582
 
350
583
  Layout/ExtraSpacing:
584
+ Description: 'Do not use unnecessary spacing.'
585
+ Enabled: true
586
+ VersionAdded: '0.49'
351
587
  # When true, allows most uses of extra spacing if the intent is to align
352
588
  # things with the previous or next line, not counting empty lines or comment
353
589
  # lines.
@@ -355,12 +591,47 @@ Layout/ExtraSpacing:
355
591
  # When true, forces the alignment of `=` in assignments on consecutive lines.
356
592
  ForceEqualSignAlignment: false
357
593
 
594
+ Layout/FirstArrayElementLineBreak:
595
+ Description: >-
596
+ Checks for a line break before the first element in a
597
+ multi-line array.
598
+ Enabled: false
599
+ VersionAdded: '0.49'
600
+
601
+ Layout/FirstHashElementLineBreak:
602
+ Description: >-
603
+ Checks for a line break before the first element in a
604
+ multi-line hash.
605
+ Enabled: false
606
+ VersionAdded: '0.49'
607
+
608
+ Layout/FirstMethodArgumentLineBreak:
609
+ Description: >-
610
+ Checks for a line break before the first argument in a
611
+ multi-line method call.
612
+ Enabled: false
613
+ VersionAdded: '0.49'
614
+
615
+ Layout/FirstMethodParameterLineBreak:
616
+ Description: >-
617
+ Checks for a line break before the first parameter in a
618
+ multi-line method parameter definition.
619
+ Enabled: false
620
+ VersionAdded: '0.49'
621
+
358
622
  Layout/FirstParameterIndentation:
623
+ Description: 'Checks the indentation of the first parameter in a method call.'
624
+ Enabled: true
625
+ VersionAdded: '0.49'
626
+ VersionChanged: '0.56'
359
627
  EnforcedStyle: special_for_inner_method_call_in_parentheses
360
628
  SupportedStyles:
361
629
  # The first parameter should always be indented one step more than the
362
630
  # preceding line.
363
631
  - consistent
632
+ # The first parameter should always be indented one level relative to the
633
+ # parent that is receiving the parameter
634
+ - consistent_relative_to_receiver
364
635
  # The first parameter should normally be indented one step more than the
365
636
  # preceding line, but if it's a parameter for a method call that is itself
366
637
  # a parameter in a method call, then the inner parameter should be indented
@@ -373,25 +644,12 @@ Layout/FirstParameterIndentation:
373
644
  # But it can be overridden by setting this parameter
374
645
  IndentationWidth: ~
375
646
 
376
- Layout/IndentationConsistency:
377
- # The difference between `rails` and `normal` is that the `rails` style
378
- # prescribes that in classes and modules the `protected` and `private`
379
- # modifier keywords shall be indented the same as public methods and that
380
- # protected and private members shall be indented one step more than the
381
- # modifiers. Other than that, both styles mean that entities on the same
382
- # logical depth shall have the same indentation.
383
- EnforcedStyle: normal
384
- SupportedStyles:
385
- - normal
386
- - rails
387
-
388
- Layout/IndentationWidth:
389
- # Number of spaces for each indentation level.
390
- Width: 2
391
- IgnoredPatterns: []
392
-
393
- # Checks the indentation of the first element in an array literal.
394
647
  Layout/IndentArray:
648
+ Description: >-
649
+ Checks the indentation of the first element in an array
650
+ literal.
651
+ Enabled: true
652
+ VersionAdded: '0.49'
395
653
  # The value `special_inside_parentheses` means that array literals with
396
654
  # brackets that have their opening bracket on the same line as a surrounding
397
655
  # opening round parenthesis, shall have their first element indented relative
@@ -412,14 +670,20 @@ Layout/IndentArray:
412
670
  # But it can be overridden by setting this parameter
413
671
  IndentationWidth: ~
414
672
 
415
- # Checks the indentation of assignment RHS, when on a different line from LHS
416
673
  Layout/IndentAssignment:
674
+ Description: >-
675
+ Checks the indentation of the first line of the
676
+ right-hand-side of a multi-line assignment.
677
+ Enabled: true
678
+ VersionAdded: '0.49'
417
679
  # By default, the indentation width from `Layout/IndentationWidth` is used
418
680
  # But it can be overridden by setting this parameter
419
681
  IndentationWidth: ~
420
682
 
421
- # Checks the indentation of the first key in a hash literal.
422
683
  Layout/IndentHash:
684
+ Description: 'Checks the indentation of the first key in a hash literal.'
685
+ Enabled: true
686
+ VersionAdded: '0.49'
423
687
  # The value `special_inside_parentheses` means that hash literals with braces
424
688
  # that have their opening brace on the same line as a surrounding opening
425
689
  # round parenthesis, shall have their first key indented relative to the
@@ -441,6 +705,10 @@ Layout/IndentHash:
441
705
  IndentationWidth: ~
442
706
 
443
707
  Layout/IndentHeredoc:
708
+ Description: 'This cop checks the indentation of the here document bodies.'
709
+ StyleGuide: '#squiggly-heredocs'
710
+ Enabled: true
711
+ VersionAdded: '0.49'
444
712
  EnforcedStyle: auto_detection
445
713
  SupportedStyles:
446
714
  - auto_detection
@@ -449,13 +717,55 @@ Layout/IndentHeredoc:
449
717
  - powerpack
450
718
  - unindent
451
719
 
452
- Layout/SpaceInLambdaLiteral:
453
- EnforcedStyle: require_no_space
720
+ Layout/IndentationConsistency:
721
+ Description: 'Keep indentation straight.'
722
+ StyleGuide: '#spaces-indentation'
723
+ Enabled: true
724
+ VersionAdded: '0.49'
725
+ # The difference between `rails` and `normal` is that the `rails` style
726
+ # prescribes that in classes and modules the `protected` and `private`
727
+ # modifier keywords shall be indented the same as public methods and that
728
+ # protected and private members shall be indented one step more than the
729
+ # modifiers. Other than that, both styles mean that entities on the same
730
+ # logical depth shall have the same indentation.
731
+ EnforcedStyle: normal
454
732
  SupportedStyles:
455
- - require_no_space
456
- - require_space
733
+ - normal
734
+ - rails
735
+
736
+ Layout/IndentationWidth:
737
+ Description: 'Use 2 spaces for indentation.'
738
+ StyleGuide: '#spaces-indentation'
739
+ Enabled: true
740
+ VersionAdded: '0.49'
741
+ # Number of spaces for each indentation level.
742
+ Width: 2
743
+ IgnoredPatterns: []
744
+
745
+ Layout/InitialIndentation:
746
+ Description: >-
747
+ Checks the indentation of the first non-blank non-comment line in a file.
748
+ Enabled: true
749
+ VersionAdded: '0.49'
750
+
751
+ Layout/LeadingBlankLines:
752
+ Description: Check for unnecessary blank lines at the beginning of a file.
753
+ Enabled: true
754
+ VersionAdded: '0.57'
755
+
756
+ Layout/LeadingCommentSpace:
757
+ Description: 'Comments should start with a space.'
758
+ StyleGuide: '#hash-space'
759
+ Enabled: true
760
+ VersionAdded: '0.49'
457
761
 
458
762
  Layout/MultilineArrayBraceLayout:
763
+ Description: >-
764
+ Checks that the closing brace in an array literal is
765
+ either on the same line as the last array element, or
766
+ a new line.
767
+ Enabled: true
768
+ VersionAdded: '0.49'
459
769
  EnforcedStyle: symmetrical
460
770
  SupportedStyles:
461
771
  # symmetrical: closing brace is positioned in same way as opening brace
@@ -466,6 +776,10 @@ Layout/MultilineArrayBraceLayout:
466
776
  - same_line
467
777
 
468
778
  Layout/MultilineAssignmentLayout:
779
+ Description: 'Check for a newline after the assignment operator in multi-line assignments.'
780
+ StyleGuide: '#indent-conditional-assignment'
781
+ Enabled: false
782
+ VersionAdded: '0.49'
469
783
  # The types of assignments which are subject to this rule.
470
784
  SupportedTypes:
471
785
  - block
@@ -483,7 +797,18 @@ Layout/MultilineAssignmentLayout:
483
797
  # for the set of supported types.
484
798
  - new_line
485
799
 
800
+ Layout/MultilineBlockLayout:
801
+ Description: 'Ensures newlines after multiline block do statements.'
802
+ Enabled: true
803
+ VersionAdded: '0.49'
804
+
486
805
  Layout/MultilineHashBraceLayout:
806
+ Description: >-
807
+ Checks that the closing brace in a hash literal is
808
+ either on the same line as the last hash element, or
809
+ a new line.
810
+ Enabled: true
811
+ VersionAdded: '0.49'
487
812
  EnforcedStyle: symmetrical
488
813
  SupportedStyles:
489
814
  # symmetrical: closing brace is positioned in same way as opening brace
@@ -494,6 +819,12 @@ Layout/MultilineHashBraceLayout:
494
819
  - same_line
495
820
 
496
821
  Layout/MultilineMethodCallBraceLayout:
822
+ Description: >-
823
+ Checks that the closing brace in a method call is
824
+ either on the same line as the last method argument, or
825
+ a new line.
826
+ Enabled: true
827
+ VersionAdded: '0.49'
497
828
  EnforcedStyle: symmetrical
498
829
  SupportedStyles:
499
830
  # symmetrical: closing brace is positioned in same way as opening brace
@@ -504,6 +835,11 @@ Layout/MultilineMethodCallBraceLayout:
504
835
  - same_line
505
836
 
506
837
  Layout/MultilineMethodCallIndentation:
838
+ Description: >-
839
+ Checks indentation of method calls with the dot operator
840
+ that span more than one line.
841
+ Enabled: true
842
+ VersionAdded: '0.49'
507
843
  EnforcedStyle: aligned
508
844
  SupportedStyles:
509
845
  - aligned
@@ -514,6 +850,12 @@ Layout/MultilineMethodCallIndentation:
514
850
  IndentationWidth: ~
515
851
 
516
852
  Layout/MultilineMethodDefinitionBraceLayout:
853
+ Description: >-
854
+ Checks that the closing brace in a method definition is
855
+ either on the same line as the last method parameter, or
856
+ a new line.
857
+ Enabled: true
858
+ VersionAdded: '0.49'
517
859
  EnforcedStyle: symmetrical
518
860
  SupportedStyles:
519
861
  # symmetrical: closing brace is positioned in same way as opening brace
@@ -524,6 +866,11 @@ Layout/MultilineMethodDefinitionBraceLayout:
524
866
  - same_line
525
867
 
526
868
  Layout/MultilineOperationIndentation:
869
+ Description: >-
870
+ Checks indentation of binary operations that span more than
871
+ one line.
872
+ Enabled: true
873
+ VersionAdded: '0.49'
527
874
  EnforcedStyle: aligned
528
875
  SupportedStyles:
529
876
  - aligned
@@ -532,25 +879,86 @@ Layout/MultilineOperationIndentation:
532
879
  # But it can be overridden by setting this parameter
533
880
  IndentationWidth: ~
534
881
 
882
+ Layout/RescueEnsureAlignment:
883
+ Description: 'Align rescues and ensures correctly.'
884
+ Enabled: true
885
+ VersionAdded: '0.49'
886
+
887
+ Layout/SpaceAfterColon:
888
+ Description: 'Use spaces after colons.'
889
+ StyleGuide: '#spaces-operators'
890
+ Enabled: true
891
+ VersionAdded: '0.49'
892
+
893
+ Layout/SpaceAfterComma:
894
+ Description: 'Use spaces after commas.'
895
+ StyleGuide: '#spaces-operators'
896
+ Enabled: true
897
+ VersionAdded: '0.49'
898
+
899
+ Layout/SpaceAfterMethodName:
900
+ Description: >-
901
+ Do not put a space between a method name and the opening
902
+ parenthesis in a method definition.
903
+ StyleGuide: '#parens-no-spaces'
904
+ Enabled: true
905
+ VersionAdded: '0.49'
906
+
907
+ Layout/SpaceAfterNot:
908
+ Description: Tracks redundant space after the ! operator.
909
+ StyleGuide: '#no-space-bang'
910
+ Enabled: true
911
+ VersionAdded: '0.49'
912
+
913
+ Layout/SpaceAfterSemicolon:
914
+ Description: 'Use spaces after semicolons.'
915
+ StyleGuide: '#spaces-operators'
916
+ Enabled: true
917
+ VersionAdded: '0.49'
918
+
535
919
  Layout/SpaceAroundBlockParameters:
920
+ Description: 'Checks the spacing inside and after block parameters pipes.'
921
+ Enabled: true
922
+ VersionAdded: '0.49'
536
923
  EnforcedStyleInsidePipes: no_space
537
924
  SupportedStylesInsidePipes:
538
925
  - space
539
926
  - no_space
540
927
 
541
928
  Layout/SpaceAroundEqualsInParameterDefault:
929
+ Description: >-
930
+ Checks that the equals signs in parameter default assignments
931
+ have or don't have surrounding space depending on
932
+ configuration.
933
+ StyleGuide: '#spaces-around-equals'
934
+ Enabled: true
935
+ VersionAdded: '0.49'
542
936
  EnforcedStyle: space
543
937
  SupportedStyles:
544
938
  - space
545
939
  - no_space
546
940
 
941
+ Layout/SpaceAroundKeyword:
942
+ Description: 'Use a space around keywords if appropriate.'
943
+ Enabled: true
944
+ VersionAdded: '0.49'
945
+
547
946
  Layout/SpaceAroundOperators:
947
+ Description: 'Use a single space around operators.'
948
+ StyleGuide: '#spaces-operators'
949
+ Enabled: true
950
+ VersionAdded: '0.49'
548
951
  # When `true`, allows most uses of extra spacing if the intent is to align
549
952
  # with an operator on the previous or next line, not counting empty lines
550
953
  # or comment lines.
551
954
  AllowForAlignment: true
552
955
 
553
956
  Layout/SpaceBeforeBlockBraces:
957
+ Description: >-
958
+ Checks that the left block brace has or doesn't have space
959
+ before it.
960
+ Enabled: true
961
+ VersionAdded: '0.49'
554
962
  EnforcedStyle: space
555
963
  SupportedStyles:
556
964
  - space
@@ -559,14 +967,49 @@ Layout/SpaceBeforeBlockBraces:
559
967
  SupportedStylesForEmptyBraces:
560
968
  - space
561
969
  - no_space
970
+ VersionChanged: '0.52.1'
971
+
972
+ Layout/SpaceBeforeComma:
973
+ Description: 'No spaces before commas.'
974
+ Enabled: true
975
+ VersionAdded: '0.49'
976
+
977
+ Layout/SpaceBeforeComment:
978
+ Description: >-
979
+ Checks for missing space between code and a comment on the
980
+ same line.
981
+ Enabled: true
982
+ VersionAdded: '0.49'
562
983
 
563
984
  Layout/SpaceBeforeFirstArg:
985
+ Description: >-
986
+ Checks that exactly one space is used between a method name
987
+ and the first argument for method calls without parentheses.
988
+ Enabled: true
989
+ VersionAdded: '0.49'
564
990
  # When `true`, allows most uses of extra spacing if the intent is to align
565
991
  # things with the previous or next line, not counting empty lines or comment
566
992
  # lines.
567
993
  AllowForAlignment: true
568
994
 
995
+ Layout/SpaceBeforeSemicolon:
996
+ Description: 'No spaces before semicolons.'
997
+ Enabled: true
998
+ VersionAdded: '0.49'
999
+
1000
+ Layout/SpaceInLambdaLiteral:
1001
+ Description: 'Checks for spaces in lambda literals.'
1002
+ Enabled: true
1003
+ VersionAdded: '0.49'
1004
+ EnforcedStyle: require_no_space
1005
+ SupportedStyles:
1006
+ - require_no_space
1007
+ - require_space
1008
+
569
1009
  Layout/SpaceInsideArrayLiteralBrackets:
1010
+ Description: 'Checks the spacing inside array literal brackets.'
1011
+ Enabled: true
1012
+ VersionAdded: '0.52'
570
1013
  EnforcedStyle: no_space
571
1014
  SupportedStyles:
572
1015
  - space
@@ -579,7 +1022,18 @@ Layout/SpaceInsideArrayLiteralBrackets:
579
1022
  - space
580
1023
  - no_space
581
1024
 
1025
+ Layout/SpaceInsideArrayPercentLiteral:
1026
+ Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
1027
+ Enabled: true
1028
+ VersionAdded: '0.49'
1029
+
582
1030
  Layout/SpaceInsideBlockBraces:
1031
+ Description: >-
1032
+ Checks that block braces have or don't have surrounding space.
1033
+ For blocks taking parameters, checks that the left brace has
1034
+ or doesn't have trailing space.
1035
+ Enabled: true
1036
+ VersionAdded: '0.49'
583
1037
  EnforcedStyle: space
584
1038
  SupportedStyles:
585
1039
  - space
@@ -592,6 +1046,10 @@ Layout/SpaceInsideBlockBraces:
592
1046
  SpaceBeforeBlockParameters: true
593
1047
 
594
1048
  Layout/SpaceInsideHashLiteralBraces:
1049
+ Description: "Use spaces inside hash literal braces - or don't."
1050
+ StyleGuide: '#spaces-operators'
1051
+ Enabled: true
1052
+ VersionAdded: '0.49'
595
1053
  EnforcedStyle: space
596
1054
  SupportedStyles:
597
1055
  - space
@@ -604,13 +1062,34 @@ Layout/SpaceInsideHashLiteralBraces:
604
1062
  - space
605
1063
  - no_space
606
1064
 
1065
+
607
1066
  Layout/SpaceInsideParens:
1067
+ Description: 'No spaces after ( or before ).'
1068
+ StyleGuide: '#spaces-braces'
1069
+ Enabled: true
1070
+ VersionAdded: '0.49'
1071
+ VersionChanged: '0.55'
608
1072
  EnforcedStyle: no_space
609
1073
  SupportedStyles:
610
1074
  - space
611
1075
  - no_space
612
1076
 
1077
+ Layout/SpaceInsidePercentLiteralDelimiters:
1078
+ Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
1079
+ Enabled: true
1080
+ VersionAdded: '0.49'
1081
+
1082
+ Layout/SpaceInsideRangeLiteral:
1083
+ Description: 'No spaces inside range literals.'
1084
+ StyleGuide: '#no-space-inside-range-literals'
1085
+ Enabled: true
1086
+ VersionAdded: '0.49'
1087
+
613
1088
  Layout/SpaceInsideReferenceBrackets:
1089
+ Description: 'Checks the spacing inside referential brackets.'
1090
+ Enabled: true
1091
+ VersionAdded: '0.52'
1092
+ VersionChanged: '0.53'
614
1093
  EnforcedStyle: no_space
615
1094
  SupportedStyles:
616
1095
  - space
@@ -621,27 +1100,21 @@ Layout/SpaceInsideReferenceBrackets:
621
1100
  - no_space
622
1101
 
623
1102
  Layout/SpaceInsideStringInterpolation:
1103
+ Description: 'Checks for padding/surrounding spaces inside string interpolation.'
1104
+ StyleGuide: '#string-interpolation'
1105
+ Enabled: true
1106
+ VersionAdded: '0.49'
624
1107
  EnforcedStyle: no_space
625
1108
  SupportedStyles:
626
1109
  - space
627
1110
  - no_space
628
1111
 
629
- Layout/ClassStructure:
630
- Categories:
631
- module_inclusion:
632
- - include
633
- - prepend
634
- - extend
635
- ExpectedOrder:
636
- - module_inclusion
637
- - constants
638
- - public_class_methods
639
- - initializer
640
- - public_methods
641
- - protected_methods
642
- - private_methods
643
-
644
1112
  Layout/Tab:
1113
+ Description: 'No hard tabs.'
1114
+ StyleGuide: '#spaces-indentation'
1115
+ Enabled: true
1116
+ VersionAdded: '0.49'
1117
+ VersionChanged: '0.51'
645
1118
  # By default, the indentation width from Layout/IndentationWidth is used
646
1119
  # But it can be overridden by setting this parameter
647
1120
  # It is used during auto-correction to determine how many spaces should
@@ -649,19 +1122,649 @@ Layout/Tab:
649
1122
  IndentationWidth: ~
650
1123
 
651
1124
  Layout/TrailingBlankLines:
1125
+ Description: 'Checks trailing blank lines and final newline.'
1126
+ StyleGuide: '#newline-eof'
1127
+ Enabled: true
1128
+ VersionAdded: '0.49'
652
1129
  EnforcedStyle: final_newline
653
1130
  SupportedStyles:
654
1131
  - final_newline
655
1132
  - final_blank_line
656
1133
 
657
1134
  Layout/TrailingWhitespace:
1135
+ Description: 'Avoid trailing whitespace.'
1136
+ StyleGuide: '#no-trailing-whitespace'
1137
+ Enabled: true
1138
+ VersionAdded: '0.49'
1139
+ VersionChanged: '0.55'
658
1140
  AllowInHeredoc: false
659
1141
 
660
- #################### Naming ##########################
1142
+ #################### Lint ##################################
1143
+ ### Warnings
1144
+
1145
+ Lint/AmbiguousBlockAssociation:
1146
+ Description: >-
1147
+ Checks for ambiguous block association with method when param passed without
1148
+ parentheses.
1149
+ StyleGuide: '#syntax'
1150
+ Enabled: true
1151
+ VersionAdded: '0.48'
1152
+
1153
+ Lint/AmbiguousOperator:
1154
+ Description: >-
1155
+ Checks for ambiguous operators in the first argument of a
1156
+ method invocation without parentheses.
1157
+ StyleGuide: '#method-invocation-parens'
1158
+ Enabled: true
1159
+ VersionAdded: '0.17'
1160
+
1161
+ Lint/AmbiguousRegexpLiteral:
1162
+ Description: >-
1163
+ Checks for ambiguous regexp literals in the first argument of
1164
+ a method invocation without parentheses.
1165
+ Enabled: true
1166
+ VersionAdded: '0.17'
1167
+
1168
+ Lint/AssignmentInCondition:
1169
+ Description: "Don't use assignment in conditions."
1170
+ StyleGuide: '#safe-assignment-in-condition'
1171
+ Enabled: true
1172
+ VersionAdded: '0.9'
1173
+ AllowSafeAssignment: true
1174
+
1175
+ Lint/BigDecimalNew:
1176
+ Description: '`BigDecimal.new()` is deprecated. Use `BigDecimal()` instead.'
1177
+ Enabled: true
1178
+ VersionAdded: '0.53'
1179
+
1180
+ Lint/BooleanSymbol:
1181
+ Description: 'Check for `:true` and `:false` symbols.'
1182
+ Enabled: true
1183
+ VersionAdded: '0.50'
1184
+
1185
+ Lint/CircularArgumentReference:
1186
+ Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
1187
+ Enabled: true
1188
+ VersionAdded: '0.33'
1189
+
1190
+ Lint/Debugger:
1191
+ Description: 'Check for debugger calls.'
1192
+ Enabled: true
1193
+ VersionAdded: '0.14'
1194
+ VersionChanged: '0.49'
1195
+
1196
+ Lint/DeprecatedClassMethods:
1197
+ Description: 'Check for deprecated class method calls.'
1198
+ Enabled: true
1199
+ VersionAdded: '0.19'
1200
+
1201
+ Lint/DuplicateCaseCondition:
1202
+ Description: 'Do not repeat values in case conditionals.'
1203
+ Enabled: true
1204
+ VersionAdded: '0.45'
1205
+
1206
+ Lint/DuplicateMethods:
1207
+ Description: 'Check for duplicate method definitions.'
1208
+ Enabled: true
1209
+ VersionAdded: '0.29'
1210
+
1211
+ Lint/DuplicatedKey:
1212
+ Description: 'Check for duplicate keys in hash literals.'
1213
+ Enabled: true
1214
+ VersionAdded: '0.34'
1215
+
1216
+ Lint/EachWithObjectArgument:
1217
+ Description: 'Check for immutable argument given to each_with_object.'
1218
+ Enabled: true
1219
+ VersionAdded: '0.31'
1220
+
1221
+ Lint/ElseLayout:
1222
+ Description: 'Check for odd code arrangement in an else block.'
1223
+ Enabled: true
1224
+ VersionAdded: '0.17'
1225
+
1226
+ Lint/EmptyEnsure:
1227
+ Description: 'Checks for empty ensure block.'
1228
+ Enabled: true
1229
+ VersionAdded: '0.10'
1230
+ VersionChanged: '0.48'
1231
+ AutoCorrect: false
1232
+
1233
+ Lint/EmptyExpression:
1234
+ Description: 'Checks for empty expressions.'
1235
+ Enabled: true
1236
+ VersionAdded: '0.45'
1237
+
1238
+ Lint/EmptyInterpolation:
1239
+ Description: 'Checks for empty string interpolation.'
1240
+ Enabled: true
1241
+ VersionAdded: '0.20'
1242
+ VersionChanged: '0.45'
1243
+
1244
+ Lint/EmptyWhen:
1245
+ Description: 'Checks for `when` branches with empty bodies.'
1246
+ Enabled: true
1247
+ VersionAdded: '0.45'
1248
+
1249
+ Lint/EndInMethod:
1250
+ Description: 'END blocks should not be placed inside method definitions.'
1251
+ Enabled: true
1252
+ VersionAdded: '0.9'
1253
+
1254
+ Lint/EnsureReturn:
1255
+ Description: 'Do not use return in an ensure block.'
1256
+ StyleGuide: '#no-return-ensure'
1257
+ Enabled: true
1258
+ VersionAdded: '0.9'
1259
+
1260
+ Lint/ErbNewArguments:
1261
+ Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
1262
+ Enabled: true
1263
+ VersionAdded: '0.56'
1264
+
1265
+ Lint/FloatOutOfRange:
1266
+ Description: >-
1267
+ Catches floating-point literals too large or small for Ruby to
1268
+ represent.
1269
+ Enabled: true
1270
+ VersionAdded: '0.36'
1271
+
1272
+ Lint/FormatParameterMismatch:
1273
+ Description: 'The number of parameters to format/sprint must match the fields.'
1274
+ Enabled: true
1275
+ VersionAdded: '0.33'
1276
+
1277
+ Lint/HandleExceptions:
1278
+ Description: "Don't suppress exception."
1279
+ StyleGuide: '#dont-hide-exceptions'
1280
+ Enabled: true
1281
+ VersionAdded: '0.9'
1282
+
1283
+ Lint/ImplicitStringConcatenation:
1284
+ Description: >-
1285
+ Checks for adjacent string literals on the same line, which
1286
+ could better be represented as a single string literal.
1287
+ Enabled: true
1288
+ VersionAdded: '0.36'
1289
+
1290
+ Lint/IneffectiveAccessModifier:
1291
+ Description: >-
1292
+ Checks for attempts to use `private` or `protected` to set
1293
+ the visibility of a class method, which does not work.
1294
+ Enabled: true
1295
+ VersionAdded: '0.36'
1296
+
1297
+ Lint/InheritException:
1298
+ Description: 'Avoid inheriting from the `Exception` class.'
1299
+ Enabled: true
1300
+ VersionAdded: '0.41'
1301
+ # The default base class in favour of `Exception`.
1302
+ EnforcedStyle: runtime_error
1303
+ SupportedStyles:
1304
+ - runtime_error
1305
+ - standard_error
1306
+
1307
+ Lint/InterpolationCheck:
1308
+ Description: 'Raise warning for interpolation in single q strs'
1309
+ Enabled: true
1310
+ VersionAdded: '0.50'
1311
+
1312
+ Lint/LiteralAsCondition:
1313
+ Description: 'Checks of literals used in conditions.'
1314
+ Enabled: true
1315
+ VersionAdded: '0.51'
1316
+
1317
+ Lint/LiteralInInterpolation:
1318
+ Description: 'Checks for literals used in interpolation.'
1319
+ Enabled: true
1320
+ VersionAdded: '0.19'
1321
+ VersionChanged: '0.32'
1322
+
1323
+ Lint/Loop:
1324
+ Description: >-
1325
+ Use Kernel#loop with break rather than begin/end/until or
1326
+ begin/end/while for post-loop tests.
1327
+ StyleGuide: '#loop-with-break'
1328
+ Enabled: true
1329
+ VersionAdded: '0.9'
1330
+
1331
+ Lint/MissingCopEnableDirective:
1332
+ Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
1333
+ Enabled: true
1334
+ VersionAdded: '0.52'
1335
+ # Maximum number of consecutive lines the cop can be disabled for.
1336
+ # 0 allows only single-line disables
1337
+ # 1 would mean the maximum allowed is the following:
1338
+ # # rubocop:disable SomeCop
1339
+ # a = 1
1340
+ # # rubocop:enable SomeCop
1341
+ # .inf for any size
1342
+ MaximumRangeSize: .inf
1343
+
1344
+ Lint/MultipleCompare:
1345
+ Description: "Use `&&` operator to compare multiple value."
1346
+ Enabled: true
1347
+ VersionAdded: '0.47'
1348
+
1349
+ Lint/NestedMethodDefinition:
1350
+ Description: 'Do not use nested method definitions.'
1351
+ StyleGuide: '#no-nested-methods'
1352
+ Enabled: true
1353
+ VersionAdded: '0.32'
1354
+
1355
+ Lint/NestedPercentLiteral:
1356
+ Description: 'Checks for nested percent literals.'
1357
+ Enabled: true
1358
+ VersionAdded: '0.52'
1359
+
1360
+ Lint/NextWithoutAccumulator:
1361
+ Description: >-
1362
+ Do not omit the accumulator when calling `next`
1363
+ in a `reduce`/`inject` block.
1364
+ Enabled: true
1365
+ VersionAdded: '0.36'
1366
+
1367
+ Lint/NonLocalExitFromIterator:
1368
+ Description: 'Do not use return in iterator to cause non-local exit.'
1369
+ Enabled: true
1370
+ VersionAdded: '0.30'
1371
+
1372
+ Lint/NumberConversion:
1373
+ Description: 'Checks unsafe usage of number conversion methods.'
1374
+ Enabled: false
1375
+ VersionAdded: '0.53'
1376
+
1377
+ Lint/OrderedMagicComments:
1378
+ Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1379
+ Enabled: true
1380
+ VersionAdded: '0.53'
1381
+
1382
+ Lint/ParenthesesAsGroupedExpression:
1383
+ Description: >-
1384
+ Checks for method calls with a space before the opening
1385
+ parenthesis.
1386
+ StyleGuide: '#parens-no-spaces'
1387
+ Enabled: true
1388
+ VersionAdded: '0.12'
1389
+
1390
+ Lint/PercentStringArray:
1391
+ Description: >-
1392
+ Checks for unwanted commas and quotes in %w/%W literals.
1393
+ Enabled: true
1394
+ VersionAdded: '0.41'
1395
+
1396
+ Lint/PercentSymbolArray:
1397
+ Description: >-
1398
+ Checks for unwanted commas and colons in %i/%I literals.
1399
+ Enabled: true
1400
+ VersionAdded: '0.41'
1401
+
1402
+ Lint/RandOne:
1403
+ Description: >-
1404
+ Checks for `rand(1)` calls. Such calls always return `0`
1405
+ and most likely a mistake.
1406
+ Enabled: true
1407
+ VersionAdded: '0.36'
1408
+
1409
+ Lint/RedundantWithIndex:
1410
+ Description: 'Checks for redundant `with_index`.'
1411
+ Enabled: true
1412
+ VersionAdded: '0.50'
1413
+
1414
+ Lint/RedundantWithObject:
1415
+ Description: 'Checks for redundant `with_object`.'
1416
+ Enabled: true
1417
+ VersionAdded: '0.51'
1418
+
1419
+ Lint/RegexpAsCondition:
1420
+ Description: >-
1421
+ Do not use regexp literal as a condition.
1422
+ The regexp literal matches `$_` implicitly.
1423
+ Enabled: true
1424
+ VersionAdded: '0.51'
1425
+
1426
+ Lint/RequireParentheses:
1427
+ Description: >-
1428
+ Use parentheses in the method call to avoid confusion
1429
+ about precedence.
1430
+ Enabled: true
1431
+ VersionAdded: '0.18'
1432
+
1433
+ Lint/RescueException:
1434
+ Description: 'Avoid rescuing the Exception class.'
1435
+ StyleGuide: '#no-blind-rescues'
1436
+ Enabled: true
1437
+ VersionAdded: '0.9'
1438
+ VersionChanged: '0.27.1'
1439
+
1440
+ Lint/RescueType:
1441
+ Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
1442
+ Enabled: true
1443
+ VersionAdded: '0.49'
1444
+
1445
+ Lint/ReturnInVoidContext:
1446
+ Description: 'Checks for return in void context.'
1447
+ Enabled: true
1448
+ VersionAdded: '0.50'
1449
+
1450
+ Lint/SafeNavigationChain:
1451
+ Description: 'Do not chain ordinary method call after safe navigation operator.'
1452
+ Enabled: true
1453
+ VersionAdded: '0.47'
1454
+ VersionChanged: '0.56'
1455
+ Whitelist:
1456
+ - present?
1457
+ - blank?
1458
+ - presence
1459
+ - try
1460
+ - try!
1461
+
1462
+ Lint/SafeNavigationConsistency:
1463
+ Description: >-
1464
+ Check to make sure that if safe navigation is used for a method
1465
+ call in an `&&` or `||` condition that safe navigation is used
1466
+ for all method calls on that same object.
1467
+ Enabled: true
1468
+ VersionAdded: '0.55'
1469
+ Whitelist:
1470
+ - present?
1471
+ - blank?
1472
+ - presence
1473
+ - try
1474
+ - try!
1475
+
1476
+
1477
+ Lint/ScriptPermission:
1478
+ Description: 'Grant script file execute permission.'
1479
+ Enabled: true
1480
+ VersionAdded: '0.49'
1481
+ VersionChanged: '0.50'
1482
+
1483
+ Lint/ShadowedArgument:
1484
+ Description: 'Avoid reassigning arguments before they were used.'
1485
+ Enabled: true
1486
+ VersionAdded: '0.52'
1487
+ IgnoreImplicitReferences: false
1488
+
1489
+
1490
+ Lint/ShadowedException:
1491
+ Description: >-
1492
+ Avoid rescuing a higher level exception
1493
+ before a lower level exception.
1494
+ Enabled: true
1495
+ VersionAdded: '0.41'
1496
+
1497
+ Lint/ShadowingOuterLocalVariable:
1498
+ Description: >-
1499
+ Do not use the same name as outer local variable
1500
+ for block arguments or block local variables.
1501
+ Enabled: true
1502
+ VersionAdded: '0.9'
1503
+
1504
+ Lint/StringConversionInInterpolation:
1505
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1506
+ StyleGuide: '#no-to-s'
1507
+ Enabled: true
1508
+ VersionAdded: '0.19'
1509
+ VersionChanged: '0.20'
1510
+
1511
+ Lint/Syntax:
1512
+ Description: 'Checks syntax error'
1513
+ Enabled: true
1514
+ VersionAdded: '0.9'
1515
+
1516
+
1517
+ Lint/UnderscorePrefixedVariableName:
1518
+ Description: 'Do not use prefix `_` for a variable that is used.'
1519
+ Enabled: true
1520
+ VersionAdded: '0.21'
1521
+
1522
+ Lint/UnifiedInteger:
1523
+ Description: 'Use Integer instead of Fixnum or Bignum'
1524
+ Enabled: true
1525
+ VersionAdded: '0.43'
1526
+
1527
+ Lint/UnneededCopDisableDirective:
1528
+ Description: >-
1529
+ Checks for rubocop:disable comments that can be removed.
1530
+ Note: this cop is not disabled when disabling all cops.
1531
+ It must be explicitly disabled.
1532
+ Enabled: true
1533
+ VersionAdded: '0.53'
1534
+
1535
+ Lint/UnneededCopEnableDirective:
1536
+ Description: Checks for rubocop:enable comments that can be removed.
1537
+ Enabled: true
1538
+ VersionAdded: '0.53'
1539
+
1540
+ Lint/UnneededRequireStatement:
1541
+ Description: 'Checks for unnecessary `require` statement.'
1542
+ Enabled: true
1543
+ VersionAdded: '0.51'
1544
+
1545
+ Lint/UnneededSplatExpansion:
1546
+ Description: 'Checks for splat unnecessarily being called on literals'
1547
+ Enabled: true
1548
+ VersionAdded: '0.43'
1549
+
1550
+ Lint/UnreachableCode:
1551
+ Description: 'Unreachable code.'
1552
+ Enabled: true
1553
+ VersionAdded: '0.9'
1554
+
1555
+ Lint/UnusedBlockArgument:
1556
+ Description: 'Checks for unused block arguments.'
1557
+ StyleGuide: '#underscore-unused-vars'
1558
+ Enabled: true
1559
+ VersionAdded: '0.21'
1560
+ VersionChanged: '0.22'
1561
+ IgnoreEmptyBlocks: true
1562
+ AllowUnusedKeywordArguments: false
1563
+
1564
+ Lint/UnusedMethodArgument:
1565
+ Description: 'Checks for unused method arguments.'
1566
+ StyleGuide: '#underscore-unused-vars'
1567
+ Enabled: true
1568
+ VersionAdded: '0.21'
1569
+ VersionChanged: '0.35'
1570
+ AllowUnusedKeywordArguments: false
1571
+ IgnoreEmptyMethods: true
1572
+
1573
+ Lint/UriEscapeUnescape:
1574
+ Description: >-
1575
+ `URI.escape` method is obsolete and should not be used. Instead, use
1576
+ `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
1577
+ depending on your specific use case.
1578
+ Also `URI.unescape` method is obsolete and should not be used. Instead, use
1579
+ `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
1580
+ depending on your specific use case.
1581
+ Enabled: true
1582
+ VersionAdded: '0.50'
1583
+
1584
+ Lint/UriRegexp:
1585
+ Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
1586
+ Enabled: true
1587
+ VersionAdded: '0.50'
1588
+
1589
+ Lint/UselessAccessModifier:
1590
+ Description: 'Checks for useless access modifiers.'
1591
+ Enabled: true
1592
+ VersionAdded: '0.20'
1593
+ VersionChanged: '0.47'
1594
+ ContextCreatingMethods: []
1595
+ MethodCreatingMethods: []
1596
+
1597
+ Lint/UselessAssignment:
1598
+ Description: 'Checks for useless assignment to a local variable.'
1599
+ StyleGuide: '#underscore-unused-vars'
1600
+ Enabled: true
1601
+ VersionAdded: '0.11'
1602
+
1603
+ Lint/UselessComparison:
1604
+ Description: 'Checks for comparison of something with itself.'
1605
+ Enabled: true
1606
+ VersionAdded: '0.11'
1607
+
1608
+ Lint/UselessElseWithoutRescue:
1609
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1610
+ Enabled: true
1611
+ VersionAdded: '0.17'
1612
+
1613
+ Lint/UselessSetterCall:
1614
+ Description: 'Checks for useless setter call to a local variable.'
1615
+ Enabled: true
1616
+ VersionAdded: '0.13'
1617
+
1618
+ Lint/Void:
1619
+ Description: 'Possible use of operator/literal/variable in void context.'
1620
+ Enabled: true
1621
+ VersionAdded: '0.9'
1622
+ CheckForMethodsWithNoSideEffects: false
1623
+
1624
+ #################### Metrics ###############################
1625
+
1626
+ Metrics/AbcSize:
1627
+ Description: >-
1628
+ A calculated magnitude based on number of assignments,
1629
+ branches, and conditions.
1630
+ Reference: 'http://c2.com/cgi/wiki?AbcMetric'
1631
+ Enabled: true
1632
+ VersionAdded: '0.27'
1633
+ # The ABC size is a calculated magnitude, so this number can be an Integer or
1634
+ # a Float.
1635
+ Max: 15
1636
+
1637
+ Metrics/BlockLength:
1638
+ Description: 'Avoid long blocks with many lines.'
1639
+ Enabled: true
1640
+ VersionAdded: '0.44'
1641
+ VersionChanged: '0.58'
1642
+ CountComments: false # count full line comments?
1643
+ Max: 25
1644
+ ExcludedMethods:
1645
+ # By default, exclude the `#refine` method, as it tends to have larger
1646
+ # associated blocks.
1647
+ - refine
1648
+
1649
+ Metrics/BlockNesting:
1650
+ Description: 'Avoid excessive block nesting'
1651
+ StyleGuide: '#three-is-the-number-thou-shalt-count'
1652
+ Enabled: true
1653
+ VersionAdded: '0.25'
1654
+ VersionChanged: '0.47'
1655
+ CountBlocks: false
1656
+ Max: 3
1657
+
1658
+ Metrics/ClassLength:
1659
+ Description: 'Avoid classes longer than 100 lines of code.'
1660
+ Enabled: true
1661
+ VersionAdded: '0.25'
1662
+ CountComments: false # count full line comments?
1663
+ Max: 100
1664
+
1665
+ # Avoid complex methods.
1666
+ Metrics/CyclomaticComplexity:
1667
+ Description: >-
1668
+ A complexity metric that is strongly correlated to the number
1669
+ of test cases needed to validate a method.
1670
+ Enabled: true
1671
+ VersionAdded: '0.25'
1672
+ Max: 6
1673
+
1674
+ Metrics/LineLength:
1675
+ Description: 'Limit lines to 80 characters.'
1676
+ StyleGuide: '#80-character-limits'
1677
+ Enabled: true
1678
+ VersionAdded: '0.25'
1679
+ VersionChanged: '0.46'
1680
+ Max: 80
1681
+ # To make it possible to copy or click on URIs in the code, we allow lines
1682
+ # containing a URI to be longer than Max.
1683
+ AllowHeredoc: true
1684
+ AllowURI: true
1685
+ URISchemes:
1686
+ - http
1687
+ - https
1688
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1689
+ # directives like '# rubocop: enable ...' when calculating a line's length.
1690
+ IgnoreCopDirectives: false
1691
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1692
+ # elements. Strings will be converted to Regexp objects. A line that matches
1693
+ # any regular expression listed in this option will be ignored by LineLength.
1694
+ IgnoredPatterns: []
1695
+
1696
+ Metrics/MethodLength:
1697
+ Description: 'Avoid methods longer than 10 lines of code.'
1698
+ StyleGuide: '#short-methods'
1699
+ Enabled: true
1700
+ VersionAdded: '0.25'
1701
+ VersionChanged: '0.59.2'
1702
+ CountComments: false # count full line comments?
1703
+ Max: 10
1704
+ ExcludedMethods: []
1705
+
1706
+ Metrics/ModuleLength:
1707
+ Description: 'Avoid modules longer than 100 lines of code.'
1708
+ Enabled: true
1709
+ VersionAdded: '0.31'
1710
+ CountComments: false # count full line comments?
1711
+ Max: 100
1712
+
1713
+ Metrics/ParameterLists:
1714
+ Description: 'Avoid parameter lists longer than three or four parameters.'
1715
+ StyleGuide: '#too-many-params'
1716
+ Enabled: true
1717
+ VersionAdded: '0.25'
1718
+ Max: 5
1719
+ CountKeywordArgs: true
1720
+
1721
+ Metrics/PerceivedComplexity:
1722
+ Description: >-
1723
+ A complexity metric geared towards measuring complexity for a
1724
+ human reader.
1725
+ Enabled: true
1726
+ VersionAdded: '0.25'
1727
+ Max: 7
1728
+
1729
+ #################### Naming ##############################
1730
+
1731
+ Naming/AccessorMethodName:
1732
+ Description: Check the naming of accessor methods for get_/set_.
1733
+ StyleGuide: '#accessor_mutator_method_names'
1734
+ Enabled: true
1735
+ VersionAdded: '0.50'
1736
+
1737
+ Naming/AsciiIdentifiers:
1738
+ Description: 'Use only ascii symbols in identifiers.'
1739
+ StyleGuide: '#english-identifiers'
1740
+ Enabled: true
1741
+ VersionAdded: '0.50'
1742
+
1743
+ Naming/BinaryOperatorParameterName:
1744
+ Description: 'When defining binary operators, name the argument other.'
1745
+ StyleGuide: '#other-arg'
1746
+ Enabled: true
1747
+ VersionAdded: '0.50'
1748
+
1749
+ Naming/ClassAndModuleCamelCase:
1750
+ Description: 'Use CamelCase for classes and modules.'
1751
+ StyleGuide: '#camelcase-classes'
1752
+ Enabled: true
1753
+ VersionAdded: '0.50'
1754
+
1755
+ Naming/ConstantName:
1756
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
1757
+ StyleGuide: '#screaming-snake-case'
1758
+ Enabled: true
1759
+ VersionAdded: '0.50'
661
1760
 
662
1761
  Naming/FileName:
663
- # File names listed in `AllCops:Include` are excluded by default. Add extra
664
- # excludes here.
1762
+ Description: 'Use snake_case for source file names.'
1763
+ StyleGuide: '#snake-case-files'
1764
+ Enabled: true
1765
+ VersionAdded: '0.50'
1766
+ # Camel case file names listed in `AllCops:Include` and all file names listed
1767
+ # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
665
1768
  Exclude: []
666
1769
  # When `true`, requires that each source file should define a class or module
667
1770
  # with a name which matches the file name (converted to ... case).
@@ -719,23 +1822,52 @@ Naming/FileName:
719
1822
  - XSRF
720
1823
  - XSS
721
1824
 
722
- Naming/HeredocDelimiterNaming:
723
- Blacklist:
724
- - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
725
-
726
1825
  Naming/HeredocDelimiterCase:
1826
+ Description: 'Use configured case for heredoc delimiters.'
1827
+ StyleGuide: '#heredoc-delimiters'
1828
+ Enabled: true
1829
+ VersionAdded: '0.50'
727
1830
  EnforcedStyle: uppercase
728
1831
  SupportedStyles:
729
1832
  - lowercase
730
1833
  - uppercase
731
1834
 
1835
+ Naming/HeredocDelimiterNaming:
1836
+ Description: 'Use descriptive heredoc delimiters.'
1837
+ StyleGuide: '#heredoc-delimiters'
1838
+ Enabled: true
1839
+ VersionAdded: '0.50'
1840
+ Blacklist:
1841
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
1842
+
1843
+ Naming/MemoizedInstanceVariableName:
1844
+ Description: >-
1845
+ Memoized method name should match memo instance variable name.
1846
+ Enabled: true
1847
+ VersionAdded: '0.53'
1848
+ VersionChanged: '0.58'
1849
+ EnforcedStyleForLeadingUnderscores: disallowed
1850
+ SupportedStylesForLeadingUnderscores:
1851
+ - disallowed
1852
+ - required
1853
+ - optional
1854
+
732
1855
  Naming/MethodName:
1856
+ Description: 'Use the configured style when naming methods.'
1857
+ StyleGuide: '#snake-case-symbols-methods-vars'
1858
+ Enabled: true
1859
+ VersionAdded: '0.50'
733
1860
  EnforcedStyle: snake_case
734
1861
  SupportedStyles:
735
1862
  - snake_case
736
1863
  - camelCase
737
1864
 
738
1865
  Naming/PredicateName:
1866
+ Description: 'Check the names of predicate methods.'
1867
+ StyleGuide: '#bool-methods-qmark'
1868
+ Enabled: true
1869
+ VersionAdded: '0.50'
1870
+ VersionChanged: '0.51'
739
1871
  # Predicate name prefixes.
740
1872
  NamePrefix:
741
1873
  - is_
@@ -760,6 +1892,11 @@ Naming/PredicateName:
760
1892
  - 'spec/**/*'
761
1893
 
762
1894
  Naming/UncommunicativeBlockParamName:
1895
+ Description: >-
1896
+ Checks for block parameter names that contain capital letters,
1897
+ end in numbers, or do not meet a minimal length.
1898
+ Enabled: true
1899
+ VersionAdded: '0.53'
763
1900
  # Parameter names may be equal to or greater than this value
764
1901
  MinNameLength: 1
765
1902
  AllowNamesEndingInNumbers: true
@@ -769,6 +1906,12 @@ Naming/UncommunicativeBlockParamName:
769
1906
  ForbiddenNames: []
770
1907
 
771
1908
  Naming/UncommunicativeMethodParamName:
1909
+ Description: >-
1910
+ Checks for method parameter names that contain capital letters,
1911
+ end in numbers, or do not meet a minimal length.
1912
+ Enabled: true
1913
+ VersionAdded: '0.53'
1914
+ VersionChanged: '0.59'
772
1915
  # Parameter names may be equal to or greater than this value
773
1916
  MinNameLength: 3
774
1917
  AllowNamesEndingInNumbers: true
@@ -781,31 +1924,747 @@ Naming/UncommunicativeMethodParamName:
781
1924
  - 'on'
782
1925
  - in
783
1926
  - at
1927
+ - ip
1928
+ - db
784
1929
  # Blacklisted names that will register an offense
785
1930
  ForbiddenNames: []
786
1931
 
1932
+
787
1933
  Naming/VariableName:
1934
+ Description: 'Use the configured style when naming variables.'
1935
+ StyleGuide: '#snake-case-symbols-methods-vars'
1936
+ Enabled: true
1937
+ VersionAdded: '0.50'
788
1938
  EnforcedStyle: snake_case
789
1939
  SupportedStyles:
790
1940
  - snake_case
791
1941
  - camelCase
792
1942
 
793
1943
  Naming/VariableNumber:
1944
+ Description: 'Use the configured style when numbering variables.'
1945
+ Enabled: true
1946
+ VersionAdded: '0.50'
794
1947
  EnforcedStyle: normalcase
795
1948
  SupportedStyles:
796
1949
  - snake_case
797
1950
  - normalcase
798
1951
  - non_integer
799
1952
 
800
- #################### Style ###########################
1953
+ #################### Performance ###########################
801
1954
 
802
- Style/Alias:
803
- EnforcedStyle: prefer_alias
804
- SupportedStyles:
805
- - prefer_alias
806
- - prefer_alias_method
1955
+ Performance/Caller:
1956
+ Description: >-
1957
+ Use `caller(n..n)` instead of `caller`.
1958
+ Enabled: true
1959
+ VersionAdded: '0.49'
1960
+
1961
+ Performance/CaseWhenSplat:
1962
+ Description: >-
1963
+ Reordering `when` conditions with a splat to the end
1964
+ of the `when` branches can improve performance.
1965
+ Enabled: false
1966
+ AutoCorrect: false
1967
+ SafeAutoCorrect: false
1968
+ VersionAdded: '0.34'
1969
+ VersionChanged: '0.59'
1970
+
1971
+ Performance/Casecmp:
1972
+ Description: >-
1973
+ Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
1974
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
1975
+ Enabled: true
1976
+ VersionAdded: '0.36'
1977
+
1978
+ Performance/ChainArrayAllocation:
1979
+ Description: >-
1980
+ Instead of chaining array methods that allocate new arrays, mutate an
1981
+ existing array.
1982
+ Reference: 'https://twitter.com/schneems/status/1034123879978029057'
1983
+ Enabled: false
1984
+ VersionAdded: '0.59'
1985
+
1986
+ Performance/CompareWithBlock:
1987
+ Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
1988
+ Enabled: true
1989
+ VersionAdded: '0.46'
1990
+
1991
+ Performance/Count:
1992
+ Description: >-
1993
+ Use `count` instead of `select...size`, `reject...size`,
1994
+ `select...count`, `reject...count`, `select...length`,
1995
+ and `reject...length`.
1996
+ # This cop has known compatibility issues with `ActiveRecord` and other
1997
+ # frameworks. ActiveRecord's `count` ignores the block that is passed to it.
1998
+ # For more information, see the documentation in the cop itself.
1999
+ # If you understand the known risk, you can disable `SafeMode`.
2000
+ SafeMode: true
2001
+ Enabled: true
2002
+ VersionAdded: '0.31'
2003
+ VersionChanged: '0.39'
2004
+
2005
+ Performance/Detect:
2006
+ Description: >-
2007
+ Use `detect` instead of `select.first`, `find_all.first`,
2008
+ `select.last`, and `find_all.last`.
2009
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
2010
+ # This cop has known compatibility issues with `ActiveRecord` and other
2011
+ # frameworks. `ActiveRecord` does not implement a `detect` method and `find`
2012
+ # has its own meaning. Correcting `ActiveRecord` methods with this cop
2013
+ # should be considered unsafe.
2014
+ SafeMode: true
2015
+ Enabled: true
2016
+ VersionAdded: '0.30'
2017
+ VersionChanged: '0.39'
2018
+
2019
+ Performance/DoubleStartEndWith:
2020
+ Description: >-
2021
+ Use `str.{start,end}_with?(x, ..., y, ...)`
2022
+ instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
2023
+ Enabled: true
2024
+ VersionAdded: '0.36'
2025
+ VersionChanged: '0.48'
2026
+ # Used to check for `starts_with?` and `ends_with?`.
2027
+ # These methods are defined by `ActiveSupport`.
2028
+ IncludeActiveSupportAliases: false
2029
+
2030
+ Performance/EndWith:
2031
+ Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
2032
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
2033
+ # This will change to a new method call which isn't guaranteed to be on the
2034
+ # object. Switching these methods has to be done with knowledge of the types
2035
+ # of the variables which rubocop doesn't have.
2036
+ SafeAutoCorrect: false
2037
+ AutoCorrect: false
2038
+ Enabled: true
2039
+ VersionAdded: '0.36'
2040
+ VersionChanged: '0.44'
2041
+
2042
+ Performance/FixedSize:
2043
+ Description: 'Do not compute the size of statically sized objects except in constants'
2044
+ Enabled: true
2045
+ VersionAdded: '0.35'
2046
+
2047
+ Performance/FlatMap:
2048
+ Description: >-
2049
+ Use `Enumerable#flat_map`
2050
+ instead of `Enumerable#map...Array#flatten(1)`
2051
+ or `Enumberable#collect..Array#flatten(1)`
2052
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
2053
+ Enabled: true
2054
+ VersionAdded: '0.30'
2055
+ EnabledForFlattenWithoutParams: false
2056
+ # If enabled, this cop will warn about usages of
2057
+ # `flatten` being called without any parameters.
2058
+ # This can be dangerous since `flat_map` will only flatten 1 level, and
2059
+ # `flatten` without any parameters can flatten multiple levels.
2060
+
2061
+ Performance/InefficientHashSearch:
2062
+ Description: 'Use `key?` or `value?` instead of `keys.include?` or `values.include?`'
2063
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code'
2064
+ Enabled: true
2065
+ VersionAdded: '0.56'
2066
+ Safe: false
2067
+
2068
+ Performance/LstripRstrip:
2069
+ Description: 'Use `strip` instead of `lstrip.rstrip`.'
2070
+ Enabled: true
2071
+ VersionAdded: '0.36'
2072
+
2073
+ Performance/OpenStruct:
2074
+ Description: 'Use `Struct` instead of `OpenStruct`.'
2075
+ Enabled: false
2076
+ VersionAdded: '0.61'
2077
+ Safe: false
2078
+
2079
+ Performance/RangeInclude:
2080
+ Description: 'Use `Range#cover?` instead of `Range#include?`.'
2081
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
2082
+ Enabled: true
2083
+ VersionAdded: '0.36'
2084
+
2085
+ Performance/RedundantBlockCall:
2086
+ Description: 'Use `yield` instead of `block.call`.'
2087
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
2088
+ Enabled: true
2089
+ VersionAdded: '0.36'
2090
+
2091
+ Performance/RedundantMatch:
2092
+ Description: >-
2093
+ Use `=~` instead of `String#match` or `Regexp#match` in a context where the
2094
+ returned `MatchData` is not needed.
2095
+ Enabled: true
2096
+ VersionAdded: '0.36'
2097
+
2098
+ Performance/RedundantMerge:
2099
+ Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
2100
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
2101
+ Enabled: true
2102
+ VersionAdded: '0.36'
2103
+ # Max number of key-value pairs to consider an offense
2104
+ MaxKeyValuePairs: 2
2105
+
2106
+ Performance/RedundantSortBy:
2107
+ Description: 'Use `sort` instead of `sort_by { |x| x }`.'
2108
+ Enabled: true
2109
+ VersionAdded: '0.36'
2110
+
2111
+ Performance/RegexpMatch:
2112
+ Description: >-
2113
+ Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
2114
+ `Regexp#===`, or `=~` when `MatchData` is not used.
2115
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
2116
+ Enabled: true
2117
+ VersionAdded: '0.47'
2118
+
2119
+ Performance/ReverseEach:
2120
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
2121
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
2122
+ Enabled: true
2123
+ VersionAdded: '0.30'
2124
+
2125
+ Performance/Sample:
2126
+ Description: >-
2127
+ Use `sample` instead of `shuffle.first`,
2128
+ `shuffle.last`, and `shuffle[Integer]`.
2129
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
2130
+ Enabled: true
2131
+ VersionAdded: '0.30'
2132
+
2133
+ Performance/Size:
2134
+ Description: >-
2135
+ Use `size` instead of `count` for counting
2136
+ the number of elements in `Array` and `Hash`.
2137
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
2138
+ Enabled: true
2139
+ VersionAdded: '0.30'
2140
+
2141
+ Performance/StartWith:
2142
+ Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
2143
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
2144
+ # This will change to a new method call which isn't guaranteed to be on the
2145
+ # object. Switching these methods has to be done with knowledge of the types
2146
+ # of the variables which rubocop doesn't have.
2147
+ SafeAutoCorrect: false
2148
+ AutoCorrect: false
2149
+ Enabled: true
2150
+ VersionAdded: '0.36'
2151
+ VersionChanged: '0.44'
2152
+
2153
+ Performance/StringReplacement:
2154
+ Description: >-
2155
+ Use `tr` instead of `gsub` when you are replacing the same
2156
+ number of characters. Use `delete` instead of `gsub` when
2157
+ you are deleting characters.
2158
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
2159
+ Enabled: true
2160
+ VersionAdded: '0.33'
2161
+
2162
+ Performance/TimesMap:
2163
+ Description: 'Checks for .times.map calls.'
2164
+ AutoCorrect: false
2165
+ Enabled: true
2166
+ VersionAdded: '0.36'
2167
+ VersionChanged: '0.50'
2168
+ SafeAutoCorrect: false # see https://github.com/rubocop-hq/rubocop/issues/4658
2169
+
2170
+ Performance/UnfreezeString:
2171
+ Description: 'Use unary plus to get an unfrozen string literal.'
2172
+ Enabled: true
2173
+ VersionAdded: '0.50'
2174
+
2175
+ Performance/UnneededSort:
2176
+ Description: >-
2177
+ Use `min` instead of `sort.first`,
2178
+ `max_by` instead of `sort_by...last`, etc.
2179
+ Enabled: true
2180
+ VersionAdded: '0.55'
2181
+
2182
+ Performance/UriDefaultParser:
2183
+ Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
2184
+ Enabled: true
2185
+ VersionAdded: '0.50'
2186
+
2187
+ #################### Rails #################################
2188
+
2189
+ # By default, the rails cops are not run. Override in project or home
2190
+ # directory .rubocop.yml files, or by giving the -R/--rails option.
2191
+ Rails:
2192
+ Enabled: false
2193
+
2194
+ Rails/ActionFilter:
2195
+ Description: 'Enforces consistent use of action filter methods.'
2196
+ Enabled: true
2197
+ VersionAdded: '0.19'
2198
+ EnforcedStyle: action
2199
+ SupportedStyles:
2200
+ - action
2201
+ - filter
2202
+ Include:
2203
+ - app/controllers/**/*.rb
2204
+
2205
+ Rails/ActiveRecordAliases:
2206
+ Description: >-
2207
+ Avoid Active Record aliases:
2208
+ Use `update` instead of `update_attributes`.
2209
+ Use `update!` instead of `update_attributes!`.
2210
+ Enabled: true
2211
+ VersionAdded: '0.53'
2212
+
2213
+ Rails/ActiveSupportAliases:
2214
+ Description: >-
2215
+ Avoid ActiveSupport aliases of standard ruby methods:
2216
+ `String#starts_with?`, `String#ends_with?`,
2217
+ `Array#append`, `Array#prepend`.
2218
+ Enabled: true
2219
+ VersionAdded: '0.48'
2220
+
2221
+ Rails/ApplicationJob:
2222
+ Description: 'Check that jobs subclass ApplicationJob.'
2223
+ Enabled: true
2224
+ VersionAdded: '0.49'
2225
+
2226
+ Rails/ApplicationRecord:
2227
+ Description: 'Check that models subclass ApplicationRecord.'
2228
+ Enabled: true
2229
+ VersionAdded: '0.49'
2230
+
2231
+ Rails/AssertNot:
2232
+ Description: 'Use `assert_not` instead of `assert !`.'
2233
+ Enabled: true
2234
+ VersionAdded: '0.56'
2235
+ Include:
2236
+ - '**/test/**/*'
2237
+
2238
+ Rails/Blank:
2239
+ Description: 'Enforces use of `blank?`.'
2240
+ Enabled: true
2241
+ VersionAdded: '0.48'
2242
+ # Convert usages of `nil? || empty?` to `blank?`
2243
+ NilOrEmpty: true
2244
+ # Convert usages of `!present?` to `blank?`
2245
+ NotPresent: true
2246
+ # Convert usages of `unless present?` to `if blank?`
2247
+ UnlessPresent: true
2248
+
2249
+ Rails/BulkChangeTable:
2250
+ Description: 'Check whether alter queries are combinable.'
2251
+ Enabled: true
2252
+ VersionAdded: '0.57'
2253
+ Database: null
2254
+ SupportedDatabases:
2255
+ - mysql
2256
+ - postgresql
2257
+ Include:
2258
+ - db/migrate/*.rb
2259
+
2260
+ Rails/CreateTableWithTimestamps:
2261
+ Description: >-
2262
+ Checks the migration for which timestamps are not included
2263
+ when creating a new table.
2264
+ Enabled: true
2265
+ VersionAdded: '0.52'
2266
+ Include:
2267
+ - db/migrate/*.rb
2268
+
2269
+ Rails/Date:
2270
+ Description: >-
2271
+ Checks the correct usage of date aware methods,
2272
+ such as Date.today, Date.current etc.
2273
+ Enabled: true
2274
+ VersionAdded: '0.30'
2275
+ VersionChanged: '0.33'
2276
+ # The value `strict` disallows usage of `Date.today`, `Date.current`,
2277
+ # `Date#to_time` etc.
2278
+ # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
2279
+ # (but not `Date.today`) which are overridden by ActiveSupport to handle current
2280
+ # time zone.
2281
+ EnforcedStyle: flexible
2282
+ SupportedStyles:
2283
+ - strict
2284
+ - flexible
2285
+
2286
+ Rails/Delegate:
2287
+ Description: 'Prefer delegate method for delegations.'
2288
+ Enabled: true
2289
+ VersionAdded: '0.21'
2290
+ VersionChanged: '0.50'
2291
+ # When set to true, using the target object as a prefix of the
2292
+ # method name without using the `delegate` method will be a
2293
+ # violation. When set to false, this case is legal.
2294
+ EnforceForPrefixed: true
2295
+
2296
+ Rails/DelegateAllowBlank:
2297
+ Description: 'Do not use allow_blank as an option to delegate.'
2298
+ Enabled: true
2299
+ VersionAdded: '0.44'
2300
+
2301
+ Rails/DynamicFindBy:
2302
+ Description: 'Use `find_by` instead of dynamic `find_by_*`.'
2303
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
2304
+ Enabled: true
2305
+ VersionAdded: '0.44'
2306
+ Whitelist:
2307
+ - find_by_sql
2308
+
2309
+ Rails/EnumUniqueness:
2310
+ Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
2311
+ Enabled: true
2312
+ VersionAdded: '0.46'
2313
+ Include:
2314
+ - app/models/**/*.rb
2315
+
2316
+ Rails/EnvironmentComparison:
2317
+ Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
2318
+ Enabled: true
2319
+ VersionAdded: '0.52'
2320
+
2321
+ Rails/Exit:
2322
+ Description: >-
2323
+ Favor `fail`, `break`, `return`, etc. over `exit` in
2324
+ application or library code outside of Rake files to avoid
2325
+ exits during unit testing or running in production.
2326
+ Enabled: true
2327
+ VersionAdded: '0.41'
2328
+ Include:
2329
+ - app/**/*.rb
2330
+ - config/**/*.rb
2331
+ - lib/**/*.rb
2332
+ Exclude:
2333
+ - lib/**/*.rake
2334
+
2335
+ Rails/FilePath:
2336
+ Description: 'Use `Rails.root.join` for file path joining.'
2337
+ Enabled: true
2338
+ VersionAdded: '0.47'
2339
+ VersionChanged: '0.57'
2340
+ EnforcedStyle: arguments
2341
+ SupportedStyles:
2342
+ - slashes
2343
+ - arguments
2344
+
2345
+ Rails/FindBy:
2346
+ Description: 'Prefer find_by over where.first.'
2347
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
2348
+ Enabled: true
2349
+ VersionAdded: '0.30'
2350
+ Include:
2351
+ - app/models/**/*.rb
2352
+
2353
+ Rails/FindEach:
2354
+ Description: 'Prefer all.find_each over all.find.'
2355
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
2356
+ Enabled: true
2357
+ VersionAdded: '0.30'
2358
+ Include:
2359
+ - app/models/**/*.rb
2360
+
2361
+ Rails/HasAndBelongsToMany:
2362
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
2363
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
2364
+ Enabled: true
2365
+ VersionAdded: '0.12'
2366
+ Include:
2367
+ - app/models/**/*.rb
2368
+
2369
+ Rails/HasManyOrHasOneDependent:
2370
+ Description: 'Define the dependent option to the has_many and has_one associations.'
2371
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
2372
+ Enabled: true
2373
+ VersionAdded: '0.50'
2374
+ Include:
2375
+ - app/models/**/*.rb
2376
+
2377
+ Rails/HttpPositionalArguments:
2378
+ Description: 'Use keyword arguments instead of positional arguments in http method calls.'
2379
+ Enabled: true
2380
+ VersionAdded: '0.44'
2381
+ Include:
2382
+ - 'spec/**/*'
2383
+ - 'test/**/*'
2384
+
2385
+ Rails/HttpStatus:
2386
+ Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
2387
+ Enabled: true
2388
+ VersionAdded: '0.54'
2389
+ EnforcedStyle: symbolic
2390
+ SupportedStyles:
2391
+ - numeric
2392
+ - symbolic
2393
+
2394
+ Rails/InverseOf:
2395
+ Description: 'Checks for associations where the inverse cannot be determined automatically.'
2396
+ Enabled: true
2397
+ VersionAdded: '0.52'
2398
+ Include:
2399
+ - app/models/**/*.rb
2400
+
2401
+ Rails/LexicallyScopedActionFilter:
2402
+ Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
2403
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
2404
+ Enabled: true
2405
+ VersionAdded: '0.52'
2406
+ Include:
2407
+ - app/controllers/**/*.rb
2408
+
2409
+ Rails/LinkToBlank:
2410
+ Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
2411
+ Reference: https://mathiasbynens.github.io/rel-noopener/
2412
+ Enabled: true
2413
+ VersionAdded: '0.62'
2414
+
2415
+ Rails/NotNullColumn:
2416
+ Description: 'Do not add a NOT NULL column without a default value'
2417
+ Enabled: true
2418
+ VersionAdded: '0.43'
2419
+ Include:
2420
+ - db/migrate/*.rb
2421
+
2422
+ Rails/Output:
2423
+ Description: 'Checks for calls to puts, print, etc.'
2424
+ Enabled: true
2425
+ VersionAdded: '0.15'
2426
+ VersionChanged: '0.19'
2427
+ Include:
2428
+ - app/**/*.rb
2429
+ - config/**/*.rb
2430
+ - db/**/*.rb
2431
+ - lib/**/*.rb
2432
+
2433
+ Rails/OutputSafety:
2434
+ Description: 'The use of `html_safe` or `raw` may be a security risk.'
2435
+ Enabled: true
2436
+ VersionAdded: '0.41'
2437
+
2438
+ Rails/PluralizationGrammar:
2439
+ Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
2440
+ Enabled: true
2441
+ VersionAdded: '0.35'
2442
+
2443
+ Rails/Presence:
2444
+ Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
2445
+ Enabled: true
2446
+ VersionAdded: '0.52'
2447
+
2448
+ Rails/Present:
2449
+ Description: 'Enforces use of `present?`.'
2450
+ Enabled: true
2451
+ VersionAdded: '0.48'
2452
+ # Convert usages of `!nil? && !empty?` to `present?`
2453
+ NotNilAndNotEmpty: true
2454
+ # Convert usages of `!blank?` to `present?`
2455
+ NotBlank: true
2456
+ # Convert usages of `unless blank?` to `if present?`
2457
+ UnlessBlank: true
2458
+
2459
+ Rails/ReadWriteAttribute:
2460
+ Description: >-
2461
+ Checks for read_attribute(:attr) and
2462
+ write_attribute(:attr, val).
2463
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
2464
+ Enabled: true
2465
+ VersionAdded: '0.20'
2466
+ VersionChanged: '0.29'
2467
+ Include:
2468
+ - app/models/**/*.rb
2469
+
2470
+ Rails/RedundantReceiverInWithOptions:
2471
+ Description: 'Checks for redundant receiver in `with_options`.'
2472
+ Enabled: true
2473
+ VersionAdded: '0.52'
2474
+
2475
+ Rails/RefuteMethods:
2476
+ Description: 'Use `assert_not` methods instead of `refute` methods.'
2477
+ Enabled: true
2478
+ VersionAdded: '0.56'
2479
+ Include:
2480
+ - '**/test/**/*'
2481
+
2482
+ Rails/RelativeDateConstant:
2483
+ Description: 'Do not assign relative date to constants.'
2484
+ Enabled: true
2485
+ VersionAdded: '0.48'
2486
+ VersionChanged: '0.59'
2487
+ AutoCorrect: false
2488
+
2489
+ Rails/RequestReferer:
2490
+ Description: 'Use consistent syntax for request.referer.'
2491
+ Enabled: true
2492
+ VersionAdded: '0.41'
2493
+ EnforcedStyle: referer
2494
+ SupportedStyles:
2495
+ - referer
2496
+ - referrer
2497
+
2498
+ Rails/ReversibleMigration:
2499
+ Description: 'Checks whether the change method of the migration file is reversible.'
2500
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
2501
+ Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
2502
+ Enabled: true
2503
+ VersionAdded: '0.47'
2504
+ Include:
2505
+ - db/migrate/*.rb
2506
+
2507
+ Rails/SafeNavigation:
2508
+ Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
2509
+ Enabled: true
2510
+ VersionAdded: '0.43'
2511
+ # This will convert usages of `try` to use safe navigation as well as `try!`.
2512
+ # `try` and `try!` work slightly differently. `try!` and safe navigation will
2513
+ # both raise a `NoMethodError` if the receiver of the method call does not
2514
+ # implement the intended method. `try` will not raise an exception for this.
2515
+ ConvertTry: false
2516
+
2517
+ Rails/SaveBang:
2518
+ Description: 'Identifies possible cases where Active Record save! or related should be used.'
2519
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
2520
+ Enabled: false
2521
+ VersionAdded: '0.42'
2522
+ VersionChanged: '0.59'
2523
+ AllowImplicitReturn: true
2524
+ AllowedReceivers: []
2525
+
2526
+ Rails/ScopeArgs:
2527
+ Description: 'Checks the arguments of ActiveRecord scopes.'
2528
+ Enabled: true
2529
+ VersionAdded: '0.19'
2530
+ Include:
2531
+ - app/models/**/*.rb
2532
+
2533
+ Rails/SkipsModelValidations:
2534
+ Description: >-
2535
+ Use methods that skips model validations with caution.
2536
+ See reference for more information.
2537
+ Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
2538
+ Enabled: true
2539
+ VersionAdded: '0.47'
2540
+ VersionChanged: '0.60'
2541
+ Blacklist:
2542
+ - decrement!
2543
+ - decrement_counter
2544
+ - increment!
2545
+ - increment_counter
2546
+ - toggle!
2547
+ - touch
2548
+ - update_all
2549
+ - update_attribute
2550
+ - update_column
2551
+ - update_columns
2552
+ - update_counters
2553
+ Whitelist: []
2554
+
2555
+ Rails/TimeZone:
2556
+ Description: 'Checks the correct usage of time zone aware methods.'
2557
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
2558
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
2559
+ Enabled: true
2560
+ VersionAdded: '0.30'
2561
+ VersionChanged: '0.33'
2562
+ # The value `strict` means that `Time` should be used with `zone`.
2563
+ # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
2564
+ EnforcedStyle: flexible
2565
+ SupportedStyles:
2566
+ - strict
2567
+ - flexible
2568
+
2569
+ Rails/UniqBeforePluck:
2570
+ Description: 'Prefer the use of uniq or distinct before pluck.'
2571
+ Enabled: true
2572
+ VersionAdded: '0.40'
2573
+ VersionChanged: '0.47'
2574
+ EnforcedStyle: conservative
2575
+ SupportedStyles:
2576
+ - conservative
2577
+ - aggressive
2578
+ AutoCorrect: false
2579
+
2580
+ Rails/UnknownEnv:
2581
+ Description: 'Use correct environment name.'
2582
+ Enabled: true
2583
+ VersionAdded: '0.51'
2584
+ Environments:
2585
+ - development
2586
+ - test
2587
+ - production
2588
+
2589
+ Rails/Validation:
2590
+ Description: 'Use validates :attribute, hash of validations.'
2591
+ Enabled: true
2592
+ VersionAdded: '0.9'
2593
+ VersionChanged: '0.41'
2594
+ Include:
2595
+ - app/models/**/*.rb
2596
+
2597
+ #################### Security ##############################
2598
+
2599
+ Security/Eval:
2600
+ Description: 'The use of eval represents a serious security risk.'
2601
+ Enabled: true
2602
+ VersionAdded: '0.47'
2603
+
2604
+ Security/JSONLoad:
2605
+ Description: >-
2606
+ Prefer usage of `JSON.parse` over `JSON.load` due to potential
2607
+ security issues. See reference for more information.
2608
+ Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2609
+ Enabled: true
2610
+ VersionAdded: '0.43'
2611
+ VersionChanged: '0.44'
2612
+ # Autocorrect here will change to a method that may cause crashes depending
2613
+ # on the value of the argument.
2614
+ AutoCorrect: false
2615
+ SafeAutoCorrect: false
2616
+
2617
+ Security/MarshalLoad:
2618
+ Description: >-
2619
+ Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2620
+ security issues. See reference for more information.
2621
+ Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2622
+ Enabled: true
2623
+ VersionAdded: '0.47'
2624
+
2625
+ Security/Open:
2626
+ Description: 'The use of Kernel#open represents a serious security risk.'
2627
+ Enabled: true
2628
+ VersionAdded: '0.53'
2629
+ Safe: false
2630
+
2631
+ Security/YAMLLoad:
2632
+ Description: >-
2633
+ Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2634
+ security issues. See reference for more information.
2635
+ Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2636
+ Enabled: true
2637
+ VersionAdded: '0.47'
2638
+ SafeAutoCorrect: false
2639
+
2640
+ #################### Style ###############################
2641
+
2642
+ Style/AccessModifierDeclarations:
2643
+ Description: 'Checks style of how access modifiers are used.'
2644
+ Enabled: true
2645
+ VersionAdded: '0.57'
2646
+ EnforcedStyle: group
2647
+ SupportedStyles:
2648
+ - inline
2649
+ - group
2650
+
2651
+ Style/Alias:
2652
+ Description: 'Use alias instead of alias_method.'
2653
+ StyleGuide: '#alias-method'
2654
+ Enabled: true
2655
+ VersionAdded: '0.9'
2656
+ VersionChanged: '0.36'
2657
+ EnforcedStyle: prefer_alias
2658
+ SupportedStyles:
2659
+ - prefer_alias
2660
+ - prefer_alias_method
807
2661
 
808
2662
  Style/AndOr:
2663
+ Description: 'Use &&/|| instead of and/or.'
2664
+ StyleGuide: '#no-and-or-or'
2665
+ Enabled: true
2666
+ VersionAdded: '0.9'
2667
+ VersionChanged: '0.25'
809
2668
  # Whether `and` and `or` are banned only in conditionals (conditionals)
810
2669
  # or completely (always).
811
2670
  EnforcedStyle: always
@@ -813,17 +2672,65 @@ Style/AndOr:
813
2672
  - always
814
2673
  - conditionals
815
2674
 
2675
+ Style/ArrayJoin:
2676
+ Description: 'Use Array#join instead of Array#*.'
2677
+ StyleGuide: '#array-join'
2678
+ Enabled: true
2679
+ VersionAdded: '0.20'
2680
+ VersionChanged: '0.31'
2681
+
816
2682
  Style/AsciiComments:
2683
+ Description: 'Use only ascii symbols in comments.'
2684
+ StyleGuide: '#english-comments'
2685
+ Enabled: true
2686
+ VersionAdded: '0.9'
2687
+ VersionChanged: '0.52'
817
2688
  AllowedChars: []
818
2689
 
819
- # Checks if usage of `%()` or `%Q()` matches configuration.
2690
+ Style/Attr:
2691
+ Description: 'Checks for uses of Module#attr.'
2692
+ StyleGuide: '#attr'
2693
+ Enabled: true
2694
+ VersionAdded: '0.9'
2695
+ VersionChanged: '0.12'
2696
+
2697
+ Style/AutoResourceCleanup:
2698
+ Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
2699
+ Enabled: false
2700
+ VersionAdded: '0.30'
2701
+
820
2702
  Style/BarePercentLiterals:
2703
+ Description: 'Checks if usage of %() or %Q() matches configuration.'
2704
+ StyleGuide: '#percent-q-shorthand'
2705
+ Enabled: true
2706
+ VersionAdded: '0.25'
821
2707
  EnforcedStyle: bare_percent
822
2708
  SupportedStyles:
823
2709
  - percent_q
824
2710
  - bare_percent
825
2711
 
2712
+ Style/BeginBlock:
2713
+ Description: 'Avoid the use of BEGIN blocks.'
2714
+ StyleGuide: '#no-BEGIN-blocks'
2715
+ Enabled: true
2716
+ VersionAdded: '0.9'
2717
+
2718
+ Style/BlockComments:
2719
+ Description: 'Do not use block comments.'
2720
+ StyleGuide: '#no-block-comments'
2721
+ Enabled: true
2722
+ VersionAdded: '0.9'
2723
+ VersionChanged: '0.23'
2724
+
826
2725
  Style/BlockDelimiters:
2726
+ Description: >-
2727
+ Avoid using {...} for multi-line blocks (multiline chaining is
2728
+ always ugly).
2729
+ Prefer {...} over do...end for single-line blocks.
2730
+ StyleGuide: '#single-line-blocks'
2731
+ Enabled: true
2732
+ VersionAdded: '0.30'
2733
+ VersionChanged: '0.35'
827
2734
  EnforcedStyle: line_count_based
828
2735
  SupportedStyles:
829
2736
  # The `line_count_based` style enforces braces around single line blocks and
@@ -895,6 +2802,10 @@ Style/BlockDelimiters:
895
2802
  - it
896
2803
 
897
2804
  Style/BracesAroundHashParameters:
2805
+ Description: 'Enforce braces style around hash parameters.'
2806
+ Enabled: true
2807
+ VersionAdded: '0.14.1'
2808
+ VersionChanged: '0.28'
898
2809
  EnforcedStyle: no_braces
899
2810
  SupportedStyles:
900
2811
  # The `braces` style enforces braces around all method parameters that are
@@ -908,8 +2819,30 @@ Style/BracesAroundHashParameters:
908
2819
  # also a hash literal.
909
2820
  - context_dependent
910
2821
 
2822
+ Style/CaseEquality:
2823
+ Description: 'Avoid explicit use of the case equality operator(===).'
2824
+ StyleGuide: '#no-case-equality'
2825
+ Enabled: true
2826
+ VersionAdded: '0.9'
2827
+
2828
+ Style/CharacterLiteral:
2829
+ Description: 'Checks for uses of character literals.'
2830
+ StyleGuide: '#no-character-literals'
2831
+ Enabled: true
2832
+ VersionAdded: '0.9'
2833
+
911
2834
  Style/ClassAndModuleChildren:
912
- # Checks the style of children definitions at classes and modules.
2835
+ Description: 'Checks style of children classes and modules.'
2836
+ StyleGuide: '#namespace-definition'
2837
+ # Moving from compact to nested children requires knowledge of whether the
2838
+ # outer parent is a module or a class. Moving from nested to compact requires
2839
+ # verification that the outer parent is defined elsewhere. Rubocop does not
2840
+ # have the knowledge to perform either operation safely and thus requires
2841
+ # manual oversight.
2842
+ SafeAutoCorrect: false
2843
+ AutoCorrect: false
2844
+ Enabled: true
2845
+ VersionAdded: '0.19'
913
2846
  #
914
2847
  # Basically there are two different styles:
915
2848
  #
@@ -930,17 +2863,39 @@ Style/ClassAndModuleChildren:
930
2863
  - compact
931
2864
 
932
2865
  Style/ClassCheck:
2866
+ Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
2867
+ Enabled: true
2868
+ VersionAdded: '0.24'
933
2869
  EnforcedStyle: is_a?
934
2870
  SupportedStyles:
935
2871
  - is_a?
936
2872
  - kind_of?
937
2873
 
2874
+ Style/ClassMethods:
2875
+ Description: 'Use self when defining module/class methods.'
2876
+ StyleGuide: '#def-self-class-methods'
2877
+ Enabled: true
2878
+ VersionAdded: '0.9'
2879
+ VersionChanged: '0.20'
2880
+
2881
+ Style/ClassVars:
2882
+ Description: 'Avoid the use of class variables.'
2883
+ StyleGuide: '#no-class-vars'
2884
+ Enabled: true
2885
+ VersionAdded: '0.13'
2886
+
938
2887
  # Align with the style guide.
939
2888
  Style/CollectionMethods:
940
- # Mapping from undesired method to desired_method
2889
+ Description: 'Preferred collection methods.'
2890
+ StyleGuide: '#map-find-select-reduce-size'
2891
+ Enabled: false
2892
+ VersionAdded: '0.9'
2893
+ VersionChanged: '0.27'
2894
+ Safe: false
2895
+ # Mapping from undesired method to desired method
941
2896
  # e.g. to use `detect` over `find`:
942
2897
  #
943
- # CollectionMethods:
2898
+ # Style/CollectionMethods:
944
2899
  # PreferredMethods:
945
2900
  # find: detect
946
2901
  PreferredMethods:
@@ -950,8 +2905,23 @@ Style/CollectionMethods:
950
2905
  detect: 'find'
951
2906
  find_all: 'select'
952
2907
 
953
- # Use '`' or '%x' around command literals.
2908
+ Style/ColonMethodCall:
2909
+ Description: 'Do not use :: for method call.'
2910
+ StyleGuide: '#double-colons'
2911
+ Enabled: true
2912
+ VersionAdded: '0.9'
2913
+
2914
+ Style/ColonMethodDefinition:
2915
+ Description: 'Do not use :: for defining class methods.'
2916
+ StyleGuide: '#colon-method-definition'
2917
+ Enabled: true
2918
+ VersionAdded: '0.52'
2919
+
954
2920
  Style/CommandLiteral:
2921
+ Description: 'Use `` or %x around command literals.'
2922
+ StyleGuide: '#percent-x'
2923
+ Enabled: true
2924
+ VersionAdded: '0.30'
955
2925
  EnforcedStyle: backticks
956
2926
  # backticks: Always use backticks.
957
2927
  # percent_x: Always use `%x`.
@@ -966,6 +2936,13 @@ Style/CommandLiteral:
966
2936
 
967
2937
  # Checks formatting of special comments
968
2938
  Style/CommentAnnotation:
2939
+ Description: >-
2940
+ Checks formatting of special comments
2941
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
2942
+ StyleGuide: '#annotate-keywords'
2943
+ Enabled: true
2944
+ VersionAdded: '0.10'
2945
+ VersionChanged: '0.31'
969
2946
  Keywords:
970
2947
  - TODO
971
2948
  - FIXME
@@ -973,7 +2950,19 @@ Style/CommentAnnotation:
973
2950
  - HACK
974
2951
  - REVIEW
975
2952
 
2953
+ Style/CommentedKeyword:
2954
+ Description: 'Do not place comments on the same line as certain keywords.'
2955
+ Enabled: true
2956
+ VersionAdded: '0.51'
2957
+
976
2958
  Style/ConditionalAssignment:
2959
+ Description: >-
2960
+ Use the return value of `if` and `case` statements for
2961
+ assignment to a variable and variable comparison instead
2962
+ of assigning that variable inside of each branch.
2963
+ Enabled: true
2964
+ VersionAdded: '0.36'
2965
+ VersionChanged: '0.47'
977
2966
  EnforcedStyle: assign_to_condition
978
2967
  SupportedStyles:
979
2968
  - assign_to_condition
@@ -992,7 +2981,7 @@ Style/ConditionalAssignment:
992
2981
  # You can override the default Notice in your .rubocop.yml file.
993
2982
  #
994
2983
  # In order to use autocorrect, you must supply a value for the
995
- # `AutocorrectNotice` key that matches the regexp Notice. A blank
2984
+ # `AutocorrectNotice` key that matches the regexp Notice. A blank
996
2985
  # `AutocorrectNotice` will cause an error during autocorrect.
997
2986
  #
998
2987
  # Autocorrect will add a copyright notice in a comment at the top
@@ -1006,46 +2995,178 @@ Style/ConditionalAssignment:
1006
2995
  # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
1007
2996
  #
1008
2997
  Style/Copyright:
2998
+ Description: 'Include a copyright notice in each file before any code.'
2999
+ Enabled: false
3000
+ VersionAdded: '0.30'
1009
3001
  Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
1010
3002
  AutocorrectNotice: ''
1011
3003
 
3004
+ Style/DateTime:
3005
+ Description: 'Use Time over DateTime.'
3006
+ StyleGuide: '#date--time'
3007
+ Enabled: false
3008
+ VersionAdded: '0.51'
3009
+ VersionChanged: '0.59'
3010
+ AllowCoercion: false
3011
+
3012
+ Style/DefWithParentheses:
3013
+ Description: 'Use def with parentheses when there are arguments.'
3014
+ StyleGuide: '#method-parens'
3015
+ Enabled: true
3016
+ VersionAdded: '0.9'
3017
+ VersionChanged: '0.12'
3018
+
3019
+ Style/Dir:
3020
+ Description: >-
3021
+ Use the `__dir__` method to retrieve the canonicalized
3022
+ absolute path to the current file.
3023
+ Enabled: true
3024
+ VersionAdded: '0.50'
3025
+
3026
+ Style/Documentation:
3027
+ Description: 'Document classes and non-namespace modules.'
3028
+ Enabled: true
3029
+ VersionAdded: '0.9'
3030
+ Exclude:
3031
+ - 'spec/**/*'
3032
+ - 'test/**/*'
3033
+
1012
3034
  Style/DocumentationMethod:
3035
+ Description: 'Checks for missing documentation comment for public methods.'
3036
+ Enabled: false
3037
+ VersionAdded: '0.43'
3038
+ Exclude:
3039
+ - 'spec/**/*'
3040
+ - 'test/**/*'
1013
3041
  RequireForNonPublicMethods: false
1014
3042
 
1015
- # Warn on empty else statements
1016
- # empty - warn only on empty `else`
1017
- # nil - warn on `else` with nil in it
1018
- # both - warn on empty `else` and `else` with `nil` in it
3043
+ Style/DoubleNegation:
3044
+ Description: 'Checks for uses of double negation (!!).'
3045
+ StyleGuide: '#no-bang-bang'
3046
+ Enabled: true
3047
+ VersionAdded: '0.19'
3048
+
3049
+ Style/EachForSimpleLoop:
3050
+ Description: >-
3051
+ Use `Integer#times` for a simple loop which iterates a fixed
3052
+ number of times.
3053
+ Enabled: true
3054
+ VersionAdded: '0.41'
3055
+
3056
+ Style/EachWithObject:
3057
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
3058
+ Enabled: true
3059
+ VersionAdded: '0.22'
3060
+ VersionChanged: '0.42'
3061
+
3062
+ Style/EmptyBlockParameter:
3063
+ Description: 'Omit pipes for empty block parameters.'
3064
+ Enabled: true
3065
+ VersionAdded: '0.52'
3066
+
3067
+ Style/EmptyCaseCondition:
3068
+ Description: 'Avoid empty condition in case statements.'
3069
+ Enabled: true
3070
+ VersionAdded: '0.40'
3071
+
1019
3072
  Style/EmptyElse:
3073
+ Description: 'Avoid empty else-clauses.'
3074
+ Enabled: true
3075
+ VersionAdded: '0.28'
3076
+ VersionChanged: '0.32'
1020
3077
  EnforcedStyle: both
3078
+ # empty - warn only on empty `else`
3079
+ # nil - warn on `else` with nil in it
3080
+ # both - warn on empty `else` and `else` with `nil` in it
1021
3081
  SupportedStyles:
1022
3082
  - empty
1023
3083
  - nil
1024
3084
  - both
1025
3085
 
3086
+ Style/EmptyLambdaParameter:
3087
+ Description: 'Omit parens for empty lambda parameters.'
3088
+ Enabled: true
3089
+ VersionAdded: '0.52'
3090
+
3091
+ Style/EmptyLiteral:
3092
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
3093
+ StyleGuide: '#literal-array-hash'
3094
+ Enabled: true
3095
+ VersionAdded: '0.9'
3096
+ VersionChanged: '0.12'
3097
+
1026
3098
  Style/EmptyMethod:
3099
+ Description: 'Checks the formatting of empty method definitions.'
3100
+ StyleGuide: '#no-single-line-methods'
3101
+ Enabled: true
3102
+ VersionAdded: '0.46'
1027
3103
  EnforcedStyle: compact
1028
3104
  SupportedStyles:
1029
3105
  - compact
1030
3106
  - expanded
1031
3107
 
1032
- # Checks use of for or each in multiline loops.
3108
+ Style/Encoding:
3109
+ Description: 'Use UTF-8 as the source file encoding.'
3110
+ StyleGuide: '#utf-8'
3111
+ Enabled: true
3112
+ VersionAdded: '0.9'
3113
+ VersionChanged: '0.50'
3114
+
3115
+ Style/EndBlock:
3116
+ Description: 'Avoid the use of END blocks.'
3117
+ StyleGuide: '#no-END-blocks'
3118
+ Enabled: true
3119
+ VersionAdded: '0.9'
3120
+
3121
+ Style/EvalWithLocation:
3122
+ Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3123
+ Enabled: true
3124
+ VersionAdded: '0.52'
3125
+
3126
+ Style/EvenOdd:
3127
+ Description: 'Favor the use of Integer#even? && Integer#odd?'
3128
+ StyleGuide: '#predicate-methods'
3129
+ Enabled: true
3130
+ VersionAdded: '0.12'
3131
+ VersionChanged: '0.29'
3132
+
3133
+ Style/ExpandPathArguments:
3134
+ Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3135
+ Enabled: true
3136
+ VersionAdded: '0.53'
3137
+
3138
+ Style/FlipFlop:
3139
+ Description: 'Checks for flip flops'
3140
+ StyleGuide: '#no-flip-flops'
3141
+ Enabled: true
3142
+ VersionAdded: '0.16'
3143
+
1033
3144
  Style/For:
3145
+ Description: 'Checks use of for or each in multiline loops.'
3146
+ StyleGuide: '#no-for-loops'
3147
+ Enabled: true
3148
+ VersionAdded: '0.13'
3149
+ VersionChanged: '0.59'
1034
3150
  EnforcedStyle: each
1035
3151
  SupportedStyles:
1036
3152
  - each
1037
3153
  - for
1038
3154
 
1039
- # Enforce the method used for string formatting.
1040
3155
  Style/FormatString:
3156
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
3157
+ StyleGuide: '#sprintf'
3158
+ Enabled: true
3159
+ VersionAdded: '0.19'
3160
+ VersionChanged: '0.49'
1041
3161
  EnforcedStyle: format
1042
3162
  SupportedStyles:
1043
3163
  - format
1044
3164
  - sprintf
1045
3165
  - percent
1046
3166
 
1047
- # Enforce using either `%<token>s` or `%{token}`
1048
3167
  Style/FormatStringToken:
3168
+ Description: 'Use a consistent style for format string tokens.'
3169
+ Enabled: true
1049
3170
  EnforcedStyle: annotated
1050
3171
  SupportedStyles:
1051
3172
  # Prefer tokens which contain a sprintf like type annotation like
@@ -1054,8 +3175,16 @@ Style/FormatStringToken:
1054
3175
  # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
1055
3176
  - template
1056
3177
  - unannotated
3178
+ VersionAdded: '0.49'
3179
+ VersionChanged: '0.52'
1057
3180
 
1058
3181
  Style/FrozenStringLiteralComment:
3182
+ Description: >-
3183
+ Add the frozen_string_literal comment to the top of files
3184
+ to help transition from Ruby 2.3.0 to Ruby 3.0.
3185
+ Enabled: true
3186
+ VersionAdded: '0.36'
3187
+ VersionChanged: '0.47'
1059
3188
  EnforcedStyle: when_needed
1060
3189
  SupportedStyles:
1061
3190
  # `when_needed` will add the frozen string literal comment to files
@@ -1070,16 +3199,33 @@ Style/FrozenStringLiteralComment:
1070
3199
  # exist in a file.
1071
3200
  - never
1072
3201
 
1073
- # Built-in global variables are allowed by default.
1074
3202
  Style/GlobalVars:
3203
+ Description: 'Do not introduce global variables.'
3204
+ StyleGuide: '#instance-vars'
3205
+ Reference: 'https://www.zenspider.com/ruby/quickref.html'
3206
+ Enabled: true
3207
+ VersionAdded: '0.13'
3208
+ # Built-in global variables are allowed by default.
1075
3209
  AllowedVariables: []
1076
3210
 
1077
- # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
1078
- # needs to have to trigger this cop
1079
3211
  Style/GuardClause:
3212
+ Description: 'Check for conditionals that can be replaced with guard clauses'
3213
+ StyleGuide: '#no-nested-conditionals'
3214
+ Enabled: true
3215
+ VersionAdded: '0.20'
3216
+ VersionChanged: '0.22'
3217
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3218
+ # needs to have to trigger this cop
1080
3219
  MinBodyLength: 1
1081
3220
 
1082
3221
  Style/HashSyntax:
3222
+ Description: >-
3223
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
3224
+ { :a => 1, :b => 2 }.
3225
+ StyleGuide: '#hash-literals'
3226
+ Enabled: true
3227
+ VersionAdded: '0.9'
3228
+ VersionChanged: '0.43'
1083
3229
  EnforcedStyle: ruby19
1084
3230
  SupportedStyles:
1085
3231
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -1095,7 +3241,67 @@ Style/HashSyntax:
1095
3241
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
1096
3242
  PreferHashRocketsForNonAlnumEndingSymbols: false
1097
3243
 
3244
+ Style/IdenticalConditionalBranches:
3245
+ Description: >-
3246
+ Checks that conditional statements do not have an identical
3247
+ line at the end of each branch, which can validly be moved
3248
+ out of the conditional.
3249
+ Enabled: true
3250
+ VersionAdded: '0.36'
3251
+
3252
+ Style/IfInsideElse:
3253
+ Description: 'Finds if nodes inside else, which can be converted to elsif.'
3254
+ Enabled: true
3255
+ VersionAdded: '0.36'
3256
+
3257
+ Style/IfUnlessModifier:
3258
+ Description: >-
3259
+ Favor modifier if/unless usage when you have a
3260
+ single-line body.
3261
+ StyleGuide: '#if-as-a-modifier'
3262
+ Enabled: true
3263
+ VersionAdded: '0.9'
3264
+ VersionChanged: '0.30'
3265
+
3266
+ Style/IfUnlessModifierOfIfUnless:
3267
+ Description: >-
3268
+ Avoid modifier if/unless usage on conditionals.
3269
+ Enabled: true
3270
+ VersionAdded: '0.39'
3271
+
3272
+ Style/IfWithSemicolon:
3273
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
3274
+ StyleGuide: '#no-semicolon-ifs'
3275
+ Enabled: true
3276
+ VersionAdded: '0.9'
3277
+
3278
+ Style/ImplicitRuntimeError:
3279
+ Description: >-
3280
+ Use `raise` or `fail` with an explicit exception class and
3281
+ message, rather than just a message.
3282
+ Enabled: false
3283
+ VersionAdded: '0.41'
3284
+
3285
+ Style/InfiniteLoop:
3286
+ Description: 'Use Kernel#loop for infinite loops.'
3287
+ StyleGuide: '#infinite-loop'
3288
+ Enabled: true
3289
+ VersionAdded: '0.26'
3290
+ VersionChanged: '0.61'
3291
+ SafeAutoCorrect: true
3292
+
3293
+ Style/InlineComment:
3294
+ Description: 'Avoid trailing inline comments.'
3295
+ Enabled: false
3296
+ VersionAdded: '0.23'
3297
+
1098
3298
  Style/InverseMethods:
3299
+ Description: >-
3300
+ Use the inverse method instead of `!.method`
3301
+ if an inverse method is defined.
3302
+ Enabled: true
3303
+ Safe: false
3304
+ VersionAdded: '0.48'
1099
3305
  # `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
1100
3306
  # The relationship of inverse methods only needs to be defined in one direction.
1101
3307
  # Keys and values both need to be defined as symbols.
@@ -1116,7 +3322,21 @@ Style/InverseMethods:
1116
3322
  :select: :reject
1117
3323
  :select!: :reject!
1118
3324
 
3325
+ Style/IpAddresses:
3326
+ Description: "Don't include literal IP addresses in code."
3327
+ Enabled: false
3328
+ VersionAdded: '0.58'
3329
+ # Allow strings to be whitelisted
3330
+ Whitelist:
3331
+ - "::"
3332
+ # :: is a valid IPv6 address, but could potentially be legitimately in code
3333
+
1119
3334
  Style/Lambda:
3335
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
3336
+ StyleGuide: '#lambda-multi-line'
3337
+ Enabled: true
3338
+ VersionAdded: '0.9'
3339
+ VersionChanged: '0.40'
1120
3340
  EnforcedStyle: line_count_dependent
1121
3341
  SupportedStyles:
1122
3342
  - line_count_dependent
@@ -1124,26 +3344,89 @@ Style/Lambda:
1124
3344
  - literal
1125
3345
 
1126
3346
  Style/LambdaCall:
3347
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
3348
+ StyleGuide: '#proc-call'
3349
+ Enabled: true
3350
+ VersionAdded: '0.13.1'
3351
+ VersionChanged: '0.14'
1127
3352
  EnforcedStyle: call
1128
3353
  SupportedStyles:
1129
3354
  - call
1130
3355
  - braces
1131
3356
 
3357
+ Style/LineEndConcatenation:
3358
+ Description: >-
3359
+ Use \ instead of + or << to concatenate two string literals at
3360
+ line end.
3361
+ Enabled: true
3362
+ VersionAdded: '0.18'
3363
+
1132
3364
  Style/MethodCallWithArgsParentheses:
3365
+ Description: 'Use parentheses for method calls with arguments.'
3366
+ StyleGuide: '#method-invocation-parens'
3367
+ Enabled: false
3368
+ VersionAdded: '0.47'
3369
+ VersionChanged: '0.61'
1133
3370
  IgnoreMacros: true
1134
3371
  IgnoredMethods: []
3372
+ AllowParenthesesInMultilineCall: false
3373
+ AllowParenthesesInChaining: false
3374
+ EnforcedStyle: require_parentheses
3375
+ SupportedStyles:
3376
+ - require_parentheses
3377
+ - omit_parentheses
1135
3378
 
1136
3379
  Style/MethodCallWithoutArgsParentheses:
3380
+ Description: 'Do not use parentheses for method calls with no arguments.'
3381
+ StyleGuide: '#method-invocation-parens'
3382
+ Enabled: true
1137
3383
  IgnoredMethods: []
3384
+ VersionAdded: '0.47'
3385
+ VersionChanged: '0.55'
3386
+
3387
+ Style/MethodCalledOnDoEndBlock:
3388
+ Description: 'Avoid chaining a method call on a do...end block.'
3389
+ StyleGuide: '#single-line-blocks'
3390
+ Enabled: false
3391
+ VersionAdded: '0.14'
1138
3392
 
1139
3393
  Style/MethodDefParentheses:
3394
+ Description: >-
3395
+ Checks if the method definitions have or don't have
3396
+ parentheses.
3397
+ StyleGuide: '#method-parens'
3398
+ Enabled: true
3399
+ VersionAdded: '0.16'
3400
+ VersionChanged: '0.35'
1140
3401
  EnforcedStyle: require_parentheses
1141
3402
  SupportedStyles:
1142
3403
  - require_parentheses
1143
3404
  - require_no_parentheses
1144
3405
  - require_no_parentheses_except_multiline
1145
3406
 
3407
+ Style/MethodMissingSuper:
3408
+ Description: Checks for `method_missing` to call `super`.
3409
+ StyleGuide: '#no-method-missing'
3410
+ Enabled: true
3411
+ VersionAdded: '0.56'
3412
+
3413
+ Style/MinMax:
3414
+ Description: >-
3415
+ Use `Enumerable#minmax` instead of `Enumerable#min`
3416
+ and `Enumerable#max` in conjunction.'
3417
+ Enabled: true
3418
+ VersionAdded: '0.50'
3419
+
1146
3420
  Style/MissingElse:
3421
+ Description: >-
3422
+ Require if/case expressions to have an else branches.
3423
+ If enabled, it is recommended that
3424
+ Style/UnlessElse and Style/EmptyElse be enabled.
3425
+ This will conflict with Style/EmptyElse if
3426
+ Style/EmptyElse is configured to style "both"
3427
+ Enabled: false
3428
+ VersionAdded: '0.30'
3429
+ VersionChanged: '0.38'
1147
3430
  EnforcedStyle: both
1148
3431
  SupportedStyles:
1149
3432
  # if - warn when an if expression is missing an else branch
@@ -1153,9 +3436,20 @@ Style/MissingElse:
1153
3436
  - case
1154
3437
  - both
1155
3438
 
1156
- # Checks the grouping of mixins (`include`, `extend`, `prepend`) in `class` and
1157
- # `module` bodies.
3439
+ Style/MissingRespondToMissing:
3440
+ Description: >-
3441
+ Checks if `method_missing` is implemented
3442
+ without implementing `respond_to_missing`.
3443
+ StyleGuide: '#no-method-missing'
3444
+ Enabled: true
3445
+ VersionAdded: '0.56'
3446
+
1158
3447
  Style/MixinGrouping:
3448
+ Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
3449
+ StyleGuide: '#mixin-grouping'
3450
+ Enabled: true
3451
+ VersionAdded: '0.48'
3452
+ VersionChanged: '0.49'
1159
3453
  EnforcedStyle: separated
1160
3454
  SupportedStyles:
1161
3455
  # separated: each mixed in module goes in a separate statement.
@@ -1163,19 +3457,84 @@ Style/MixinGrouping:
1163
3457
  - separated
1164
3458
  - grouped
1165
3459
 
3460
+ Style/MixinUsage:
3461
+ Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
3462
+ Enabled: true
3463
+ VersionAdded: '0.51'
3464
+
1166
3465
  Style/ModuleFunction:
3466
+ Description: 'Checks for usage of `extend self` in modules.'
3467
+ StyleGuide: '#module-function'
3468
+ Enabled: true
3469
+ VersionAdded: '0.11'
3470
+ VersionChanged: '0.53'
1167
3471
  EnforcedStyle: module_function
1168
3472
  SupportedStyles:
1169
3473
  - module_function
1170
3474
  - extend_self
1171
3475
 
3476
+ Style/MultilineBlockChain:
3477
+ Description: 'Avoid multi-line chains of blocks.'
3478
+ StyleGuide: '#single-line-blocks'
3479
+ Enabled: true
3480
+ VersionAdded: '0.13'
3481
+
3482
+ Style/MultilineIfModifier:
3483
+ Description: 'Only use if/unless modifiers on single line statements.'
3484
+ StyleGuide: '#no-multiline-if-modifiers'
3485
+ Enabled: true
3486
+ VersionAdded: '0.45'
3487
+
3488
+ Style/MultilineIfThen:
3489
+ Description: 'Do not use then for multi-line if/unless.'
3490
+ StyleGuide: '#no-then'
3491
+ Enabled: true
3492
+ VersionAdded: '0.9'
3493
+ VersionChanged: '0.26'
3494
+
1172
3495
  Style/MultilineMemoization:
3496
+ Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3497
+ Enabled: true
3498
+ VersionAdded: '0.44'
3499
+ VersionChanged: '0.48'
1173
3500
  EnforcedStyle: keyword
1174
3501
  SupportedStyles:
1175
3502
  - keyword
1176
3503
  - braces
1177
3504
 
3505
+ Style/MultilineMethodSignature:
3506
+ Description: 'Avoid multi-line method signatures.'
3507
+ Enabled: false
3508
+ VersionAdded: '0.59'
3509
+
3510
+ Style/MultilineTernaryOperator:
3511
+ Description: >-
3512
+ Avoid multi-line ?: (the ternary operator);
3513
+ use if/unless instead.
3514
+ StyleGuide: '#no-multiline-ternary'
3515
+ Enabled: true
3516
+ VersionAdded: '0.9'
3517
+
3518
+ Style/MultipleComparison:
3519
+ Description: >-
3520
+ Avoid comparing a variable with multiple items in a conditional,
3521
+ use Array#include? instead.
3522
+ Enabled: true
3523
+ VersionAdded: '0.49'
3524
+
3525
+ Style/MutableConstant:
3526
+ Description: 'Do not assign mutable objects to constants.'
3527
+ Enabled: true
3528
+ VersionAdded: '0.34'
3529
+
1178
3530
  Style/NegatedIf:
3531
+ Description: >-
3532
+ Favor unless over if for negative conditions
3533
+ (or control flow or).
3534
+ StyleGuide: '#unless-for-negatives'
3535
+ Enabled: true
3536
+ VersionAdded: '0.20'
3537
+ VersionChanged: '0.48'
1179
3538
  EnforcedStyle: both
1180
3539
  SupportedStyles:
1181
3540
  # both: prefix and postfix negated `if` should both use `unless`
@@ -1185,7 +3544,25 @@ Style/NegatedIf:
1185
3544
  - prefix
1186
3545
  - postfix
1187
3546
 
3547
+ Style/NegatedWhile:
3548
+ Description: 'Favor until over while for negative conditions.'
3549
+ StyleGuide: '#until-for-negatives'
3550
+ Enabled: true
3551
+ VersionAdded: '0.20'
3552
+
3553
+ Style/NestedModifier:
3554
+ Description: 'Avoid using nested modifiers.'
3555
+ StyleGuide: '#no-nested-modifiers'
3556
+ Enabled: true
3557
+ VersionAdded: '0.35'
3558
+
1188
3559
  Style/NestedParenthesizedCalls:
3560
+ Description: >-
3561
+ Parenthesize method calls which are nested inside the
3562
+ argument list of another parenthesized method call.
3563
+ Enabled: true
3564
+ VersionAdded: '0.36'
3565
+ VersionChanged: '0.50'
1189
3566
  Whitelist:
1190
3567
  - be
1191
3568
  - be_a
@@ -1205,7 +3582,18 @@ Style/NestedParenthesizedCalls:
1205
3582
  - respond_to
1206
3583
  - start_with
1207
3584
 
3585
+ Style/NestedTernaryOperator:
3586
+ Description: 'Use one expression per branch in a ternary operator.'
3587
+ StyleGuide: '#no-nested-ternary'
3588
+ Enabled: true
3589
+ VersionAdded: '0.9'
3590
+
1208
3591
  Style/Next:
3592
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
3593
+ StyleGuide: '#no-nested-conditionals'
3594
+ Enabled: true
3595
+ VersionAdded: '0.22'
3596
+ VersionChanged: '0.35'
1209
3597
  # With `always` all conditions at the end of an iteration needs to be
1210
3598
  # replaced by next - with `skip_modifier_ifs` the modifier if like this one
1211
3599
  # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
@@ -1217,7 +3605,23 @@ Style/Next:
1217
3605
  - skip_modifier_ifs
1218
3606
  - always
1219
3607
 
3608
+ Style/NilComparison:
3609
+ Description: 'Prefer x.nil? to x == nil.'
3610
+ StyleGuide: '#predicate-methods'
3611
+ Enabled: true
3612
+ VersionAdded: '0.12'
3613
+ VersionChanged: '0.59'
3614
+ EnforcedStyle: predicate
3615
+ SupportedStyles:
3616
+ - predicate
3617
+ - comparison
3618
+
1220
3619
  Style/NonNilCheck:
3620
+ Description: 'Checks for redundant nil checks.'
3621
+ StyleGuide: '#no-non-nil-checks'
3622
+ Enabled: true
3623
+ VersionAdded: '0.20'
3624
+ VersionChanged: '0.22'
1221
3625
  # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
1222
3626
  # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
1223
3627
  # **usually** OK, but might change behavior.
@@ -1226,27 +3630,73 @@ Style/NonNilCheck:
1226
3630
  # offenses for `!x.nil?` and does no changes that might change behavior.
1227
3631
  IncludeSemanticChanges: false
1228
3632
 
1229
- Style/NumericLiterals:
1230
- MinDigits: 5
1231
- Strict: false
3633
+ Style/Not:
3634
+ Description: 'Use ! instead of not.'
3635
+ StyleGuide: '#bang-not-not'
3636
+ Enabled: true
3637
+ VersionAdded: '0.9'
3638
+ VersionChanged: '0.20'
1232
3639
 
1233
3640
  Style/NumericLiteralPrefix:
3641
+ Description: 'Use smallcase prefixes for numeric literals.'
3642
+ StyleGuide: '#numeric-literal-prefixes'
3643
+ Enabled: true
3644
+ VersionAdded: '0.41'
1234
3645
  EnforcedOctalStyle: zero_with_o
1235
3646
  SupportedOctalStyles:
1236
3647
  - zero_with_o
1237
3648
  - zero_only
1238
3649
 
3650
+
3651
+ Style/NumericLiterals:
3652
+ Description: >-
3653
+ Add underscores to large numeric literals to improve their
3654
+ readability.
3655
+ StyleGuide: '#underscores-in-numerics'
3656
+ Enabled: true
3657
+ VersionAdded: '0.9'
3658
+ VersionChanged: '0.48'
3659
+ MinDigits: 5
3660
+ Strict: false
3661
+
1239
3662
  Style/NumericPredicate:
3663
+ Description: >-
3664
+ Checks for the use of predicate- or comparison methods for
3665
+ numeric comparisons.
3666
+ StyleGuide: '#predicate-methods'
3667
+ Safe: false
3668
+ # This will change to a new method call which isn't guaranteed to be on the
3669
+ # object. Switching these methods has to be done with knowledge of the types
3670
+ # of the variables which rubocop doesn't have.
3671
+ SafeAutoCorrect: false
3672
+ AutoCorrect: false
3673
+ Enabled: true
3674
+ VersionAdded: '0.42'
3675
+ VersionChanged: '0.59'
1240
3676
  EnforcedStyle: predicate
1241
3677
  SupportedStyles:
1242
3678
  - predicate
1243
3679
  - comparison
3680
+ IgnoredMethods: []
1244
3681
  # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
1245
3682
  # false positives.
1246
3683
  Exclude:
1247
3684
  - 'spec/**/*'
1248
3685
 
3686
+ Style/OneLineConditional:
3687
+ Description: >-
3688
+ Favor the ternary operator(?:) over
3689
+ if/then/else/end constructs.
3690
+ StyleGuide: '#ternary-operator'
3691
+ Enabled: true
3692
+ VersionAdded: '0.9'
3693
+ VersionChanged: '0.38'
3694
+
1249
3695
  Style/OptionHash:
3696
+ Description: "Don't use option hashes when you can use keyword arguments."
3697
+ Enabled: false
3698
+ VersionAdded: '0.33'
3699
+ VersionChanged: '0.34'
1250
3700
  # A list of parameter names that will be flagged by this cop.
1251
3701
  SuspiciousParamNames:
1252
3702
  - options
@@ -1255,11 +3705,45 @@ Style/OptionHash:
1255
3705
  - params
1256
3706
  - parameters
1257
3707
 
1258
- # Allow safe assignment in conditions.
3708
+ Style/OptionalArguments:
3709
+ Description: >-
3710
+ Checks for optional arguments that do not appear at the end
3711
+ of the argument list
3712
+ StyleGuide: '#optional-arguments'
3713
+ Enabled: true
3714
+ VersionAdded: '0.33'
3715
+
3716
+ Style/OrAssignment:
3717
+ Description: 'Recommend usage of double pipe equals (||=) where applicable.'
3718
+ StyleGuide: '#double-pipe-for-uninit'
3719
+ Enabled: true
3720
+ VersionAdded: '0.50'
3721
+
3722
+ Style/ParallelAssignment:
3723
+ Description: >-
3724
+ Check for simple usages of parallel assignment.
3725
+ It will only warn when the number of variables
3726
+ matches on both sides of the assignment.
3727
+ StyleGuide: '#parallel-assignment'
3728
+ Enabled: true
3729
+ VersionAdded: '0.32'
3730
+
1259
3731
  Style/ParenthesesAroundCondition:
3732
+ Description: >-
3733
+ Don't use parentheses around the condition of an
3734
+ if/unless/while.
3735
+ StyleGuide: '#no-parens-around-condition'
3736
+ Enabled: true
3737
+ VersionAdded: '0.9'
3738
+ VersionChanged: '0.56'
1260
3739
  AllowSafeAssignment: true
3740
+ AllowInMultilineConditions: false
1261
3741
 
1262
3742
  Style/PercentLiteralDelimiters:
3743
+ Description: 'Use `%`-literal delimiters consistently'
3744
+ StyleGuide: '#percent-literal-braces'
3745
+ Enabled: true
3746
+ VersionAdded: '0.19'
1263
3747
  # Specify the default preferred delimiter for all types with the 'default' key
1264
3748
  # Override individual delimiters (even with default specified) by specifying
1265
3749
  # an individual key
@@ -1270,31 +3754,111 @@ Style/PercentLiteralDelimiters:
1270
3754
  '%r': '{}'
1271
3755
  '%w': '[]'
1272
3756
  '%W': '[]'
3757
+ VersionChanged: '0.48.1'
1273
3758
 
1274
3759
  Style/PercentQLiterals:
3760
+ Description: 'Checks if uses of %Q/%q match the configured preference.'
3761
+ Enabled: true
3762
+ VersionAdded: '0.25'
1275
3763
  EnforcedStyle: lower_case_q
1276
3764
  SupportedStyles:
1277
3765
  - lower_case_q # Use `%q` when possible, `%Q` when necessary
1278
3766
  - upper_case_q # Always use `%Q`
1279
3767
 
3768
+ Style/PerlBackrefs:
3769
+ Description: 'Avoid Perl-style regex back references.'
3770
+ StyleGuide: '#no-perl-regexp-last-matchers'
3771
+ Enabled: true
3772
+ VersionAdded: '0.13'
3773
+
1280
3774
  Style/PreferredHashMethods:
3775
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
3776
+ StyleGuide: '#hash-key'
3777
+ Enabled: true
3778
+ VersionAdded: '0.41'
3779
+ VersionChanged: '0.44'
1281
3780
  EnforcedStyle: short
1282
3781
  SupportedStyles:
1283
3782
  - short
1284
3783
  - verbose
1285
3784
 
3785
+ Style/Proc:
3786
+ Description: 'Use proc instead of Proc.new.'
3787
+ StyleGuide: '#proc'
3788
+ Enabled: true
3789
+ VersionAdded: '0.9'
3790
+ VersionChanged: '0.18'
3791
+
1286
3792
  Style/RaiseArgs:
3793
+ Description: 'Checks the arguments passed to raise/fail.'
3794
+ StyleGuide: '#exception-class-messages'
3795
+ Enabled: true
3796
+ VersionAdded: '0.14'
3797
+ VersionChanged: '0.40'
1287
3798
  EnforcedStyle: exploded
1288
3799
  SupportedStyles:
1289
3800
  - compact # raise Exception.new(msg)
1290
3801
  - exploded # raise Exception, msg
1291
3802
 
3803
+ Style/RandomWithOffset:
3804
+ Description: >-
3805
+ Prefer to use ranges when generating random numbers instead of
3806
+ integers with offsets.
3807
+ StyleGuide: '#random-numbers'
3808
+ Enabled: true
3809
+ VersionAdded: '0.52'
3810
+
3811
+ Style/RedundantBegin:
3812
+ Description: "Don't use begin blocks when they are not needed."
3813
+ StyleGuide: '#begin-implicit'
3814
+ Enabled: true
3815
+ VersionAdded: '0.10'
3816
+ VersionChanged: '0.21'
3817
+
3818
+ Style/RedundantConditional:
3819
+ Description: "Don't return true/false from a conditional."
3820
+ Enabled: true
3821
+ VersionAdded: '0.50'
3822
+
3823
+ Style/RedundantException:
3824
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
3825
+ StyleGuide: '#no-explicit-runtimeerror'
3826
+ Enabled: true
3827
+ VersionAdded: '0.14'
3828
+ VersionChanged: '0.29'
3829
+
3830
+ Style/RedundantFreeze:
3831
+ Description: "Checks usages of Object#freeze on immutable objects."
3832
+ Enabled: true
3833
+ VersionAdded: '0.34'
3834
+
3835
+ Style/RedundantParentheses:
3836
+ Description: "Checks for parentheses that seem not to serve any purpose."
3837
+ Enabled: true
3838
+ VersionAdded: '0.36'
3839
+
1292
3840
  Style/RedundantReturn:
3841
+ Description: "Don't use return where it's not required."
3842
+ StyleGuide: '#no-explicit-return'
3843
+ Enabled: true
3844
+ VersionAdded: '0.10'
3845
+ VersionChanged: '0.14'
1293
3846
  # When `true` allows code like `return x, y`.
1294
3847
  AllowMultipleReturnValues: false
1295
3848
 
1296
- # Use `/` or `%r` around regular expressions.
3849
+ Style/RedundantSelf:
3850
+ Description: "Don't use self where it's not needed."
3851
+ StyleGuide: '#no-self-unless-required'
3852
+ Enabled: true
3853
+ VersionAdded: '0.10'
3854
+ VersionChanged: '0.13'
3855
+
1297
3856
  Style/RegexpLiteral:
3857
+ Description: 'Use / or %r around regular expressions.'
3858
+ StyleGuide: '#percent-r'
3859
+ Enabled: true
3860
+ VersionAdded: '0.9'
3861
+ VersionChanged: '0.30'
1298
3862
  EnforcedStyle: slashes
1299
3863
  # slashes: Always use slashes.
1300
3864
  # percent_r: Always use `%r`.
@@ -1307,7 +3871,17 @@ Style/RegexpLiteral:
1307
3871
  # are found in the regexp string.
1308
3872
  AllowInnerSlashes: false
1309
3873
 
3874
+ Style/RescueModifier:
3875
+ Description: 'Avoid using rescue in its modifier form.'
3876
+ StyleGuide: '#no-rescue-modifiers'
3877
+ Enabled: true
3878
+ VersionAdded: '0.9'
3879
+ VersionChanged: '0.34'
3880
+
1310
3881
  Style/RescueStandardError:
3882
+ Description: 'Avoid rescuing without specifying an error class.'
3883
+ Enabled: true
3884
+ VersionAdded: '0.52'
1311
3885
  EnforcedStyle: explicit
1312
3886
  # implicit: Do not include the error class, `rescue`
1313
3887
  # explicit: Require an error class `rescue StandardError`
@@ -1316,12 +3890,22 @@ Style/RescueStandardError:
1316
3890
  - explicit
1317
3891
 
1318
3892
  Style/ReturnNil:
3893
+ Description: 'Use return instead of return nil.'
3894
+ Enabled: false
1319
3895
  EnforcedStyle: return
1320
3896
  SupportedStyles:
1321
3897
  - return
1322
3898
  - return_nil
3899
+ VersionAdded: '0.50'
1323
3900
 
1324
3901
  Style/SafeNavigation:
3902
+ Description: >-
3903
+ This cop transforms usages of a method call safeguarded by
3904
+ a check for the existence of the object to
3905
+ safe navigation (`&.`).
3906
+ Enabled: true
3907
+ VersionAdded: '0.43'
3908
+ VersionChanged: '0.44'
1325
3909
  # Safe navigation may cause a statement to start returning `nil` in addition
1326
3910
  # to whatever it used to return.
1327
3911
  ConvertCodeThatCanStartToReturnNil: false
@@ -1330,12 +3914,39 @@ Style/SafeNavigation:
1330
3914
  - blank?
1331
3915
  - presence
1332
3916
  - try
3917
+ - try!
3918
+ VersionChanged: '0.56'
3919
+
3920
+ Style/SelfAssignment:
3921
+ Description: >-
3922
+ Checks for places where self-assignment shorthand should have
3923
+ been used.
3924
+ StyleGuide: '#self-assignment'
3925
+ Enabled: true
3926
+ VersionAdded: '0.19'
3927
+ VersionChanged: '0.29'
1333
3928
 
1334
3929
  Style/Semicolon:
3930
+ Description: "Don't use semicolons to terminate expressions."
3931
+ StyleGuide: '#no-semicolon'
3932
+ Enabled: true
3933
+ VersionAdded: '0.9'
3934
+ VersionChanged: '0.19'
1335
3935
  # Allow `;` to separate several expressions on the same line.
1336
3936
  AllowAsExpressionSeparator: false
1337
3937
 
3938
+ Style/Send:
3939
+ Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
3940
+ StyleGuide: '#prefer-public-send'
3941
+ Enabled: false
3942
+ VersionAdded: '0.33'
3943
+
1338
3944
  Style/SignalException:
3945
+ Description: 'Checks for proper usage of fail and raise.'
3946
+ StyleGuide: '#prefer-raise-over-fail'
3947
+ Enabled: true
3948
+ VersionAdded: '0.11'
3949
+ VersionChanged: '0.37'
1339
3950
  EnforcedStyle: only_raise
1340
3951
  SupportedStyles:
1341
3952
  - only_raise
@@ -1343,6 +3954,10 @@ Style/SignalException:
1343
3954
  - semantic
1344
3955
 
1345
3956
  Style/SingleLineBlockParams:
3957
+ Description: 'Enforces the names of some block params.'
3958
+ Enabled: false
3959
+ VersionAdded: '0.16'
3960
+ VersionChanged: '0.47'
1346
3961
  Methods:
1347
3962
  - reduce:
1348
3963
  - acc
@@ -1352,21 +3967,53 @@ Style/SingleLineBlockParams:
1352
3967
  - elem
1353
3968
 
1354
3969
  Style/SingleLineMethods:
3970
+ Description: 'Avoid single-line methods.'
3971
+ StyleGuide: '#no-single-line-methods'
3972
+ Enabled: true
3973
+ VersionAdded: '0.9'
3974
+ VersionChanged: '0.19'
1355
3975
  AllowIfMethodIsEmpty: true
1356
3976
 
1357
3977
  Style/SpecialGlobalVars:
3978
+ Description: 'Avoid Perl-style global variables.'
3979
+ StyleGuide: '#no-cryptic-perlisms'
3980
+ Enabled: true
3981
+ VersionAdded: '0.13'
3982
+ VersionChanged: '0.36'
3983
+ SafeAutoCorrect: false
1358
3984
  EnforcedStyle: use_english_names
1359
3985
  SupportedStyles:
1360
3986
  - use_perl_names
1361
3987
  - use_english_names
1362
3988
 
1363
3989
  Style/StabbyLambdaParentheses:
3990
+ Description: 'Check for the usage of parentheses around stabby lambda arguments.'
3991
+ StyleGuide: '#stabby-lambda-with-args'
3992
+ Enabled: true
3993
+ VersionAdded: '0.35'
1364
3994
  EnforcedStyle: require_parentheses
1365
3995
  SupportedStyles:
1366
3996
  - require_parentheses
1367
3997
  - require_no_parentheses
1368
3998
 
3999
+ Style/StderrPuts:
4000
+ Description: 'Use `warn` instead of `$stderr.puts`.'
4001
+ StyleGuide: '#warn'
4002
+ Enabled: true
4003
+ VersionAdded: '0.51'
4004
+
4005
+ Style/StringHashKeys:
4006
+ Description: 'Prefer symbols instead of strings as hash keys.'
4007
+ StyleGuide: '#symbols-as-keys'
4008
+ Enabled: false
4009
+ VersionAdded: '0.52'
4010
+
1369
4011
  Style/StringLiterals:
4012
+ Description: 'Checks if uses of quotes match the configured preference.'
4013
+ StyleGuide: '#consistent-string-literals'
4014
+ Enabled: true
4015
+ VersionAdded: '0.9'
4016
+ VersionChanged: '0.36'
1370
4017
  EnforcedStyle: single_quotes
1371
4018
  SupportedStyles:
1372
4019
  - single_quotes
@@ -1376,12 +4023,21 @@ Style/StringLiterals:
1376
4023
  ConsistentQuotesInMultiline: false
1377
4024
 
1378
4025
  Style/StringLiteralsInInterpolation:
4026
+ Description: >-
4027
+ Checks if uses of quotes inside expressions in interpolated
4028
+ strings match the configured preference.
4029
+ Enabled: true
4030
+ VersionAdded: '0.27'
1379
4031
  EnforcedStyle: single_quotes
1380
4032
  SupportedStyles:
1381
4033
  - single_quotes
1382
4034
  - double_quotes
1383
4035
 
1384
4036
  Style/StringMethods:
4037
+ Description: 'Checks if configured preferred methods are used over non-preferred.'
4038
+ Enabled: false
4039
+ VersionAdded: '0.34'
4040
+ VersionChanged: '0.34.2'
1385
4041
  # Mapping from undesired method to desired_method
1386
4042
  # e.g. to use `to_sym` over `intern`:
1387
4043
  #
@@ -1391,14 +4047,34 @@ Style/StringMethods:
1391
4047
  PreferredMethods:
1392
4048
  intern: to_sym
1393
4049
 
4050
+ Style/StructInheritance:
4051
+ Description: 'Checks for inheritance from Struct.new.'
4052
+ StyleGuide: '#no-extend-struct-new'
4053
+ Enabled: true
4054
+ VersionAdded: '0.29'
4055
+
1394
4056
  Style/SymbolArray:
4057
+ Description: 'Use %i or %I for arrays of symbols.'
4058
+ StyleGuide: '#percent-i'
4059
+ Enabled: true
4060
+ VersionAdded: '0.9'
4061
+ VersionChanged: '0.49'
1395
4062
  EnforcedStyle: percent
1396
- MinSize: 0
4063
+ MinSize: 2
1397
4064
  SupportedStyles:
1398
4065
  - percent
1399
4066
  - brackets
1400
4067
 
4068
+ Style/SymbolLiteral:
4069
+ Description: 'Use plain symbols instead of string symbols when possible.'
4070
+ Enabled: true
4071
+ VersionAdded: '0.30'
4072
+
1401
4073
  Style/SymbolProc:
4074
+ Description: 'Use symbols as procs instead of blocks when possible.'
4075
+ Enabled: true
4076
+ VersionAdded: '0.26'
4077
+ VersionChanged: '0.40'
1402
4078
  # A list of method names to be ignored by the check.
1403
4079
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
1404
4080
  IgnoredMethods:
@@ -1406,6 +4082,10 @@ Style/SymbolProc:
1406
4082
  - define_method
1407
4083
 
1408
4084
  Style/TernaryParentheses:
4085
+ Description: 'Checks for use of parentheses around ternary conditions.'
4086
+ Enabled: true
4087
+ VersionAdded: '0.42'
4088
+ VersionChanged: '0.46'
1409
4089
  EnforcedStyle: require_no_parentheses
1410
4090
  SupportedStyles:
1411
4091
  - require_parentheses
@@ -1413,7 +4093,26 @@ Style/TernaryParentheses:
1413
4093
  - require_parentheses_when_complex
1414
4094
  AllowSafeAssignment: true
1415
4095
 
4096
+ Style/TrailingBodyOnClass:
4097
+ Description: 'Class body goes below class statement.'
4098
+ Enabled: true
4099
+ VersionAdded: '0.53'
4100
+
4101
+ Style/TrailingBodyOnMethodDefinition:
4102
+ Description: 'Method body goes below definition.'
4103
+ Enabled: true
4104
+ VersionAdded: '0.52'
4105
+
4106
+ Style/TrailingBodyOnModule:
4107
+ Description: 'Module body goes below module statement.'
4108
+ Enabled: true
4109
+ VersionAdded: '0.53'
4110
+
1416
4111
  Style/TrailingCommaInArguments:
4112
+ Description: 'Checks for trailing comma in argument lists.'
4113
+ StyleGuide: '#no-trailing-params-comma'
4114
+ Enabled: true
4115
+ VersionAdded: '0.36'
1417
4116
  # If `comma`, the cop requires a comma after the last argument, but only for
1418
4117
  # parenthesized method calls where each argument is on its own line.
1419
4118
  # If `consistent_comma`, the cop requires a comma after the last argument,
@@ -1425,7 +4124,10 @@ Style/TrailingCommaInArguments:
1425
4124
  - no_comma
1426
4125
 
1427
4126
  Style/TrailingCommaInArrayLiteral:
1428
- # If `comma`, the cop requires a comma after the last item in an array,
4127
+ Description: 'Checks for trailing comma in array literals.'
4128
+ StyleGuide: '#no-trailing-array-commas'
4129
+ Enabled: true
4130
+ VersionAdded: '0.53'
1429
4131
  # but only when each item is on its own line.
1430
4132
  # If `consistent_comma`, the cop requires a comma after the last item of all
1431
4133
  # non-empty array literals.
@@ -1436,6 +4138,8 @@ Style/TrailingCommaInArrayLiteral:
1436
4138
  - no_comma
1437
4139
 
1438
4140
  Style/TrailingCommaInHashLiteral:
4141
+ Description: 'Checks for trailing comma in hash literals.'
4142
+ Enabled: true
1439
4143
  # If `comma`, the cop requires a comma after the last item in a hash,
1440
4144
  # but only when each item is on its own line.
1441
4145
  # If `consistent_comma`, the cop requires a comma after the last item of all
@@ -1445,10 +4149,30 @@ Style/TrailingCommaInHashLiteral:
1445
4149
  - comma
1446
4150
  - consistent_comma
1447
4151
  - no_comma
4152
+ VersionAdded: '0.53'
4153
+
4154
+ Style/TrailingMethodEndStatement:
4155
+ Description: 'Checks for trailing end statement on line of method body.'
4156
+ Enabled: true
4157
+ VersionAdded: '0.52'
4158
+
4159
+ Style/TrailingUnderscoreVariable:
4160
+ Description: >-
4161
+ Checks for the usage of unneeded trailing underscores at the
4162
+ end of parallel variable assignment.
4163
+ AllowNamedUnderscoreVariables: true
4164
+ Enabled: true
4165
+ VersionAdded: '0.31'
4166
+ VersionChanged: '0.35'
1448
4167
 
1449
4168
  # `TrivialAccessors` requires exact name matches and doesn't allow
1450
4169
  # predicated methods by default.
1451
4170
  Style/TrivialAccessors:
4171
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
4172
+ StyleGuide: '#attr_family'
4173
+ Enabled: true
4174
+ VersionAdded: '0.9'
4175
+ VersionChanged: '0.38'
1452
4176
  # When set to `false` the cop will suggest the use of accessor methods
1453
4177
  # in situations like:
1454
4178
  #
@@ -1488,8 +4212,79 @@ Style/TrivialAccessors:
1488
4212
  - to_s
1489
4213
  - to_sym
1490
4214
 
1491
- # `WordArray` enforces how array literals of word-like strings should be expressed.
4215
+ Style/UnlessElse:
4216
+ Description: >-
4217
+ Do not use unless with else. Rewrite these with the positive
4218
+ case first.
4219
+ StyleGuide: '#no-else-with-unless'
4220
+ Enabled: true
4221
+ VersionAdded: '0.9'
4222
+
4223
+ Style/UnneededCapitalW:
4224
+ Description: 'Checks for %W when interpolation is not needed.'
4225
+ Enabled: true
4226
+ VersionAdded: '0.21'
4227
+ VersionChanged: '0.24'
4228
+
4229
+ Style/UnneededCondition:
4230
+ Description: 'Checks for unnecessary conditional expressions.'
4231
+ Enabled: true
4232
+ VersionAdded: '0.57'
4233
+
4234
+ Style/UnneededInterpolation:
4235
+ Description: 'Checks for strings that are just an interpolated expression.'
4236
+ Enabled: true
4237
+ VersionAdded: '0.36'
4238
+
4239
+ Style/UnneededPercentQ:
4240
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
4241
+ StyleGuide: '#percent-q'
4242
+ Enabled: true
4243
+ VersionAdded: '0.24'
4244
+
4245
+ Style/UnpackFirst:
4246
+ Description: >-
4247
+ Checks for accessing the first element of `String#unpack`
4248
+ instead of using `unpack1`
4249
+ Enabled: true
4250
+ VersionAdded: '0.54'
4251
+
4252
+ Style/VariableInterpolation:
4253
+ Description: >-
4254
+ Don't interpolate global, instance and class variables
4255
+ directly in strings.
4256
+ StyleGuide: '#curlies-interpolate'
4257
+ Enabled: true
4258
+ VersionAdded: '0.9'
4259
+ VersionChanged: '0.20'
4260
+
4261
+ Style/WhenThen:
4262
+ Description: 'Use when x then ... for one-line cases.'
4263
+ StyleGuide: '#one-line-cases'
4264
+ Enabled: true
4265
+ VersionAdded: '0.9'
4266
+
4267
+ Style/WhileUntilDo:
4268
+ Description: 'Checks for redundant do after while or until.'
4269
+ StyleGuide: '#no-multiline-while-do'
4270
+ Enabled: true
4271
+ VersionAdded: '0.9'
4272
+
4273
+ Style/WhileUntilModifier:
4274
+ Description: >-
4275
+ Favor modifier while/until usage when you have a
4276
+ single-line body.
4277
+ StyleGuide: '#while-as-a-modifier'
4278
+ Enabled: true
4279
+ VersionAdded: '0.9'
4280
+ VersionChanged: '0.30'
4281
+
1492
4282
  Style/WordArray:
4283
+ Description: 'Use %w or %W for arrays of words.'
4284
+ StyleGuide: '#percent-w'
4285
+ Enabled: true
4286
+ VersionAdded: '0.9'
4287
+ VersionChanged: '0.36'
1493
4288
  EnforcedStyle: percent
1494
4289
  SupportedStyles:
1495
4290
  # percent style: %w(word1 word2)
@@ -1497,288 +4292,28 @@ Style/WordArray:
1497
4292
  # bracket style: ['word1', 'word2']
1498
4293
  - brackets
1499
4294
  # The `MinSize` option causes the `WordArray` rule to be ignored for arrays
1500
- # smaller than a certain size. The rule is only applied to arrays
4295
+ # smaller than a certain size. The rule is only applied to arrays
1501
4296
  # whose element count is greater than or equal to `MinSize`.
1502
- MinSize: 0
4297
+ MinSize: 2
1503
4298
  # The regular expression `WordRegex` decides what is considered a word.
1504
4299
  WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
1505
4300
 
1506
4301
  Style/YodaCondition:
4302
+ Description: 'Do not use literals as the first operand of a comparison.'
4303
+ Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
4304
+ Enabled: true
1507
4305
  EnforcedStyle: all_comparison_operators
1508
4306
  SupportedStyles:
1509
4307
  # check all comparison operators
1510
4308
  - all_comparison_operators
1511
4309
  # check only equality operators: `!=` and `==`
1512
4310
  - equality_operators_only
1513
-
1514
- #################### Metrics ###############################
1515
-
1516
- Metrics/AbcSize:
1517
- # The ABC size is a calculated magnitude, so this number can be an Integer or
1518
- # a Float.
1519
- Max: 15
1520
-
1521
- Metrics/BlockLength:
1522
- CountComments: false # count full line comments?
1523
- Max: 25
1524
- ExcludedMethods: []
1525
-
1526
- Metrics/BlockNesting:
1527
- CountBlocks: false
1528
- Max: 3
1529
-
1530
- Metrics/ClassLength:
1531
- CountComments: false # count full line comments?
1532
- Max: 100
1533
-
1534
- # Avoid complex methods.
1535
- Metrics/CyclomaticComplexity:
1536
- Max: 6
1537
-
1538
- Metrics/LineLength:
1539
- Max: 80
1540
- # To make it possible to copy or click on URIs in the code, we allow lines
1541
- # containing a URI to be longer than Max.
1542
- AllowHeredoc: true
1543
- AllowURI: true
1544
- URISchemes:
1545
- - http
1546
- - https
1547
- # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1548
- # directives like '# rubocop: enable ...' when calculating a line's length.
1549
- IgnoreCopDirectives: false
1550
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1551
- # elements. Strings will be converted to Regexp objects. A line that matches
1552
- # any regular expression listed in this option will be ignored by LineLength.
1553
- IgnoredPatterns: []
1554
-
1555
- Metrics/MethodLength:
1556
- CountComments: false # count full line comments?
1557
- Max: 10
1558
-
1559
- Metrics/ModuleLength:
1560
- CountComments: false # count full line comments?
1561
- Max: 100
1562
-
1563
- Metrics/ParameterLists:
1564
- Max: 5
1565
- CountKeywordArgs: true
1566
-
1567
- Metrics/PerceivedComplexity:
1568
- Max: 7
1569
-
1570
- #################### Lint ##################################
1571
-
1572
- # Allow safe assignment in conditions.
1573
- Lint/AssignmentInCondition:
1574
- AllowSafeAssignment: true
1575
-
1576
- Lint/InheritException:
1577
- # The default base class in favour of `Exception`.
1578
- EnforcedStyle: runtime_error
1579
- SupportedStyles:
1580
- - runtime_error
1581
- - standard_error
1582
-
1583
- Lint/MissingCopEnableDirective:
1584
- # Maximum number of consecutive lines the cop can be disabled for.
1585
- # 0 allows only single-line disables
1586
- # 1 would mean the maximum allowed is the following:
1587
- # # rubocop:disable SomeCop
1588
- # a = 1
1589
- # # rubocop:enable SomeCop
1590
- # .inf for any size
1591
- MaximumRangeSize: .inf
1592
-
1593
- Lint/SafeNavigationChain:
1594
- Whitelist:
1595
- - present?
1596
- - blank?
1597
- - presence
1598
- - try
1599
-
1600
- # Checks for shadowed arguments
1601
- Lint/ShadowedArgument:
1602
- IgnoreImplicitReferences: false
1603
-
1604
- # Checks for unused block arguments
1605
- Lint/UnusedBlockArgument:
1606
- IgnoreEmptyBlocks: true
1607
- AllowUnusedKeywordArguments: false
1608
-
1609
- # Checks for unused method arguments.
1610
- Lint/UnusedMethodArgument:
1611
- AllowUnusedKeywordArguments: false
1612
- IgnoreEmptyMethods: true
1613
-
1614
- Lint/Void:
1615
- CheckForMethodsWithNoSideEffects: false
1616
-
1617
- #################### Performance ###########################
1618
-
1619
- Performance/DoubleStartEndWith:
1620
- # Used to check for `starts_with?` and `ends_with?`.
1621
- # These methods are defined by `ActiveSupport`.
1622
- IncludeActiveSupportAliases: false
1623
-
1624
- Performance/RedundantMerge:
1625
- # Max number of key-value pairs to consider an offense
1626
- MaxKeyValuePairs: 2
1627
-
1628
- #################### Rails #################################
1629
-
1630
- Rails/ActionFilter:
1631
- EnforcedStyle: action
1632
- SupportedStyles:
1633
- - action
1634
- - filter
1635
- Include:
1636
- - app/controllers/**/*.rb
1637
-
1638
- Rails/CreateTableWithTimestamps:
1639
- Include:
1640
- - db/migrate/*.rb
1641
-
1642
- Rails/Date:
1643
- # The value `strict` disallows usage of `Date.today`, `Date.current`,
1644
- # `Date#to_time` etc.
1645
- # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
1646
- # (but not `Date.today`) which are overridden by ActiveSupport to handle current
1647
- # time zone.
1648
- EnforcedStyle: flexible
1649
- SupportedStyles:
1650
- - strict
1651
- - flexible
1652
-
1653
- Rails/Delegate:
1654
- # When set to true, using the target object as a prefix of the
1655
- # method name without using the `delegate` method will be a
1656
- # violation. When set to false, this case is legal.
1657
- EnforceForPrefixed: true
1658
-
1659
- Rails/DynamicFindBy:
1660
- Whitelist:
1661
- - find_by_sql
1662
-
1663
- Rails/EnumUniqueness:
1664
- Include:
1665
- - app/models/**/*.rb
1666
-
1667
- Rails/Exit:
1668
- Include:
1669
- - app/**/*.rb
1670
- - config/**/*.rb
1671
- - lib/**/*.rb
1672
- Exclude:
1673
- - lib/**/*.rake
1674
-
1675
- Rails/FindBy:
1676
- Include:
1677
- - app/models/**/*.rb
1678
-
1679
- Rails/FindEach:
1680
- Include:
1681
- - app/models/**/*.rb
1682
-
1683
- Rails/HasAndBelongsToMany:
1684
- Include:
1685
- - app/models/**/*.rb
1686
-
1687
- Rails/HasManyOrHasOneDependent:
1688
- Include:
1689
- - app/models/**/*.rb
1690
-
1691
- Rails/HttpStatus:
1692
- EnforcedStyle: symbolic
1693
- SupportedStyles:
1694
- - numeric
1695
- - symbolic
1696
-
1697
- Rails/InverseOf:
1698
- Include:
1699
- - app/models/**/*.rb
1700
-
1701
- Rails/LexicallyScopedActionFilter:
1702
- Include:
1703
- - app/controllers/**/*.rb
1704
-
1705
- Rails/NotNullColumn:
1706
- Include:
1707
- - db/migrate/*.rb
1708
-
1709
- Rails/Output:
1710
- Include:
1711
- - app/**/*.rb
1712
- - config/**/*.rb
1713
- - db/**/*.rb
1714
- - lib/**/*.rb
1715
-
1716
- Rails/ReadWriteAttribute:
1717
- Include:
1718
- - app/models/**/*.rb
1719
-
1720
- Rails/RequestReferer:
1721
- EnforcedStyle: referer
1722
- SupportedStyles:
1723
- - referer
1724
- - referrer
1725
-
1726
- Rails/ReversibleMigration:
1727
- Include:
1728
- - db/migrate/*.rb
1729
-
1730
- Rails/SafeNavigation:
1731
- # This will convert usages of `try` to use safe navigation as well as `try!`.
1732
- # `try` and `try!` work slightly differently. `try!` and safe navigation will
1733
- # both raise a `NoMethodError` if the receiver of the method call does not
1734
- # implement the intended method. `try` will not raise an exception for this.
1735
- ConvertTry: false
1736
-
1737
- Rails/ScopeArgs:
1738
- Include:
1739
- - app/models/**/*.rb
1740
-
1741
- Rails/TimeZone:
1742
- # The value `strict` means that `Time` should be used with `zone`.
1743
- # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
1744
- EnforcedStyle: flexible
1745
- SupportedStyles:
1746
- - strict
1747
- - flexible
1748
-
1749
- Rails/UniqBeforePluck:
1750
- EnforcedStyle: conservative
1751
- SupportedStyles:
1752
- - conservative
1753
- - aggressive
1754
- AutoCorrect: false
1755
-
1756
- Rails/UnknownEnv:
1757
- Environments:
1758
- - development
1759
- - test
1760
- - production
1761
-
1762
- Rails/SkipsModelValidations:
1763
- Blacklist:
1764
- - decrement!
1765
- - decrement_counter
1766
- - increment!
1767
- - increment_counter
1768
- - toggle!
1769
- - touch
1770
- - update_all
1771
- - update_attribute
1772
- - update_column
1773
- - update_columns
1774
- - update_counters
1775
-
1776
- Rails/Validation:
1777
- Include:
1778
- - app/models/**/*.rb
1779
-
1780
- Bundler/OrderedGems:
1781
- TreatCommentsAsGroupSeparators: true
1782
-
1783
- Gemspec/OrderedDependencies:
1784
- TreatCommentsAsGroupSeparators: true
4311
+ VersionAdded: '0.49'
4312
+ VersionChanged: '0.50'
4313
+
4314
+ Style/ZeroLengthPredicate:
4315
+ Description: 'Use #empty? when testing for objects of length 0.'
4316
+ Enabled: true
4317
+ Safe: false
4318
+ VersionAdded: '0.37'
4319
+ VersionChanged: '0.39'