rubocop 0.76.0 → 0.79.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/config/default.yml +290 -264
  4. data/lib/rubocop/ast/builder.rb +43 -42
  5. data/lib/rubocop/ast/node/block_node.rb +2 -0
  6. data/lib/rubocop/ast/node/def_node.rb +11 -0
  7. data/lib/rubocop/ast/node/forward_args_node.rb +18 -0
  8. data/lib/rubocop/ast/node.rb +1 -1
  9. data/lib/rubocop/ast/traversal.rb +11 -3
  10. data/lib/rubocop/cli/command/auto_genenerate_config.rb +105 -0
  11. data/lib/rubocop/cli/command/base.rb +33 -0
  12. data/lib/rubocop/cli/command/execute_runner.rb +76 -0
  13. data/lib/rubocop/cli/command/init_dotfile.rb +45 -0
  14. data/lib/rubocop/cli/command/show_cops.rb +80 -0
  15. data/lib/rubocop/cli/command/version.rb +17 -0
  16. data/lib/rubocop/cli/command.rb +21 -0
  17. data/lib/rubocop/cli/environment.rb +21 -0
  18. data/lib/rubocop/cli.rb +11 -230
  19. data/lib/rubocop/config.rb +1 -1
  20. data/lib/rubocop/config_loader.rb +19 -19
  21. data/lib/rubocop/config_obsoletion.rb +65 -12
  22. data/lib/rubocop/config_validator.rb +56 -98
  23. data/lib/rubocop/cop/autocorrect_logic.rb +7 -4
  24. data/lib/rubocop/cop/bundler/gem_comment.rb +4 -4
  25. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +2 -2
  26. data/lib/rubocop/cop/cop.rb +21 -0
  27. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -2
  28. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  29. data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
  30. data/lib/rubocop/cop/generator.rb +3 -4
  31. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +59 -0
  32. data/lib/rubocop/cop/internal_affairs.rb +1 -0
  33. data/lib/rubocop/cop/layout/{align_arguments.rb → argument_alignment.rb} +1 -1
  34. data/lib/rubocop/cop/layout/{align_array.rb → array_alignment.rb} +1 -1
  35. data/lib/rubocop/cop/layout/{indent_assignment.rb → assignment_indentation.rb} +1 -1
  36. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
  37. data/lib/rubocop/cop/layout/{indent_first_argument.rb → first_argument_indentation.rb} +5 -5
  38. data/lib/rubocop/cop/layout/{indent_first_array_element.rb → first_array_element_indentation.rb} +4 -4
  39. data/lib/rubocop/cop/layout/{indent_first_hash_element.rb → first_hash_element_indentation.rb} +3 -3
  40. data/lib/rubocop/cop/layout/{indent_first_parameter.rb → first_parameter_indentation.rb} +3 -3
  41. data/lib/rubocop/cop/layout/{align_hash.rb → hash_alignment.rb} +10 -6
  42. data/lib/rubocop/cop/layout/{indent_heredoc.rb → heredoc_indentation.rb} +5 -5
  43. data/lib/rubocop/cop/layout/{leading_blank_lines.rb → leading_empty_lines.rb} +1 -1
  44. data/lib/rubocop/cop/{metrics → layout}/line_length.rb +40 -110
  45. data/lib/rubocop/cop/layout/multiline_block_layout.rb +14 -5
  46. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -1
  47. data/lib/rubocop/cop/layout/{align_parameters.rb → parameter_alignment.rb} +1 -1
  48. data/lib/rubocop/cop/layout/space_around_keyword.rb +12 -0
  49. data/lib/rubocop/cop/layout/space_around_operators.rb +32 -7
  50. data/lib/rubocop/cop/layout/space_before_block_braces.rb +17 -0
  51. data/lib/rubocop/cop/layout/{trailing_blank_lines.rb → trailing_empty_lines.rb} +1 -1
  52. data/lib/rubocop/cop/lint/debugger.rb +2 -2
  53. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +1 -1
  54. data/lib/rubocop/cop/lint/{duplicated_key.rb → duplicate_hash_key.rb} +1 -1
  55. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  56. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
  57. data/lib/rubocop/cop/lint/{multiple_compare.rb → multiple_comparison.rb} +1 -1
  58. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +89 -0
  59. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +3 -3
  60. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +4 -4
  61. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
  62. data/lib/rubocop/cop/lint/{string_conversion_in_interpolation.rb → redundant_string_coercion.rb} +1 -1
  63. data/lib/rubocop/cop/lint/redundant_with_index.rb +2 -2
  64. data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -2
  65. data/lib/rubocop/cop/lint/{handle_exceptions.rb → suppressed_exception.rb} +1 -1
  66. data/lib/rubocop/cop/lint/useless_access_modifier.rb +57 -23
  67. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
  68. data/lib/rubocop/cop/metrics/method_length.rb +1 -1
  69. data/lib/rubocop/cop/migration/department_name.rb +16 -1
  70. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  71. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -7
  72. data/lib/rubocop/cop/mixin/{hash_alignment.rb → hash_alignment_styles.rb} +1 -1
  73. data/lib/rubocop/cop/mixin/line_length_help.rb +88 -0
  74. data/lib/rubocop/cop/mixin/nil_methods.rb +4 -4
  75. data/lib/rubocop/cop/mixin/rational_literal.rb +18 -0
  76. data/lib/rubocop/cop/mixin/statement_modifier.rb +2 -2
  77. data/lib/rubocop/cop/mixin/trailing_comma.rb +6 -3
  78. data/lib/rubocop/cop/naming/{uncommunicative_block_param_name.rb → block_parameter_name.rb} +3 -3
  79. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +5 -5
  80. data/lib/rubocop/cop/naming/{uncommunicative_method_param_name.rb → method_parameter_name.rb} +4 -4
  81. data/lib/rubocop/cop/naming/predicate_name.rb +6 -6
  82. data/lib/rubocop/cop/offense.rb +11 -0
  83. data/lib/rubocop/cop/registry.rb +7 -2
  84. data/lib/rubocop/cop/style/alias.rb +1 -1
  85. data/lib/rubocop/cop/style/array_join.rb +1 -1
  86. data/lib/rubocop/cop/style/attr.rb +8 -0
  87. data/lib/rubocop/cop/style/conditional_assignment.rb +2 -2
  88. data/lib/rubocop/cop/style/eval_with_location.rb +1 -1
  89. data/lib/rubocop/cop/style/even_odd.rb +1 -1
  90. data/lib/rubocop/cop/style/guard_clause.rb +3 -2
  91. data/lib/rubocop/cop/style/if_unless_modifier.rb +38 -3
  92. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  93. data/lib/rubocop/cop/style/ip_addresses.rb +4 -4
  94. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +168 -0
  95. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +54 -0
  96. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +4 -207
  97. data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
  98. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
  99. data/lib/rubocop/cop/style/multiline_when_then.rb +5 -1
  100. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +5 -5
  101. data/lib/rubocop/cop/style/next.rb +5 -5
  102. data/lib/rubocop/cop/style/numeric_literals.rb +7 -3
  103. data/lib/rubocop/cop/style/numeric_predicate.rb +4 -3
  104. data/lib/rubocop/cop/style/option_hash.rb +3 -3
  105. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +7 -7
  106. data/lib/rubocop/cop/style/redundant_parentheses.rb +3 -3
  107. data/lib/rubocop/cop/style/redundant_return.rb +2 -8
  108. data/lib/rubocop/cop/style/redundant_sort.rb +1 -1
  109. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +7 -1
  110. data/lib/rubocop/cop/style/trivial_accessors.rb +5 -5
  111. data/lib/rubocop/cop/style/while_until_modifier.rb +1 -1
  112. data/lib/rubocop/cop/style/yoda_condition.rb +16 -1
  113. data/lib/rubocop/cop/team.rb +5 -0
  114. data/lib/rubocop/formatter/base_formatter.rb +2 -2
  115. data/lib/rubocop/formatter/clang_style_formatter.rb +1 -3
  116. data/lib/rubocop/formatter/json_formatter.rb +6 -5
  117. data/lib/rubocop/formatter/tap_formatter.rb +1 -3
  118. data/lib/rubocop/node_pattern.rb +1 -1
  119. data/lib/rubocop/options.rb +8 -8
  120. data/lib/rubocop/processed_source.rb +1 -1
  121. data/lib/rubocop/rake_task.rb +1 -0
  122. data/lib/rubocop/result_cache.rb +23 -7
  123. data/lib/rubocop/rspec/shared_contexts.rb +5 -0
  124. data/lib/rubocop/runner.rb +18 -2
  125. data/lib/rubocop/target_ruby.rb +151 -0
  126. data/lib/rubocop/version.rb +1 -1
  127. data/lib/rubocop.rb +38 -22
  128. metadata +40 -25
  129. data/lib/rubocop/cop/mixin/safe_mode.rb +0 -24
data/config/default.yml CHANGED
@@ -59,6 +59,7 @@ AllCops:
59
59
  - '**/Vagrantfile'
60
60
  Exclude:
61
61
  - 'node_modules/**/*'
62
+ - 'tmp/**/*'
62
63
  - 'vendor/**/*'
63
64
  - '.git/**/*'
64
65
  # Default formatter will be used if no `-f/--format` option is given.
@@ -141,11 +142,12 @@ Bundler/GemComment:
141
142
  Description: 'Add a comment describing each gem.'
142
143
  Enabled: false
143
144
  VersionAdded: '0.59'
145
+ VersionChanged: '0.77'
144
146
  Include:
145
147
  - '**/*.gemfile'
146
148
  - '**/Gemfile'
147
149
  - '**/gems.rb'
148
- Whitelist: []
150
+ IgnoredGems: []
149
151
 
150
152
  Bundler/InsecureProtocolSource:
151
153
  Description: >-
@@ -195,9 +197,10 @@ Gemspec/RequiredRubyVersion:
195
197
  VersionAdded: '0.52'
196
198
  Include:
197
199
  - '**/*.gemspec'
198
- -
200
+
199
201
  Gemspec/RubyVersionGlobalsUsage:
200
202
  Description: Checks usage of RUBY_VERSION in gemspec.
203
+ StyleGuide: '#no-ruby-version-in-the-gemspec'
201
204
  Enabled: true
202
205
  VersionAdded: '0.72'
203
206
  Include:
@@ -218,13 +221,14 @@ Layout/AccessModifierIndentation:
218
221
  # But it can be overridden by setting this parameter
219
222
  IndentationWidth: ~
220
223
 
221
- Layout/AlignArguments:
224
+ Layout/ArgumentAlignment:
222
225
  Description: >-
223
226
  Align the arguments of a method call if they span more
224
227
  than one line.
225
228
  StyleGuide: '#no-double-indent'
226
229
  Enabled: true
227
230
  VersionAdded: '0.68'
231
+ VersionChanged: '0.77'
228
232
  # Alignment of arguments in multi-line method calls.
229
233
  #
230
234
  # The `with_first_argument` style aligns the following lines along the same
@@ -246,117 +250,23 @@ Layout/AlignArguments:
246
250
  # But it can be overridden by setting this parameter
247
251
  IndentationWidth: ~
248
252
 
249
- Layout/AlignArray:
253
+ Layout/ArrayAlignment:
250
254
  Description: >-
251
255
  Align the elements of an array literal if they span more than
252
256
  one line.
253
257
  StyleGuide: '#align-multiline-arrays'
254
258
  Enabled: true
255
259
  VersionAdded: '0.49'
260
+ VersionChanged: '0.77'
256
261
 
257
- Layout/AlignHash:
262
+ Layout/AssignmentIndentation:
258
263
  Description: >-
259
- Align the elements of a hash literal if they span more than
260
- one line.
264
+ Checks the indentation of the first line of the
265
+ right-hand-side of a multi-line assignment.
261
266
  Enabled: true
262
- AllowMultipleStyles: true
263
267
  VersionAdded: '0.49'
264
- # Alignment of entries using hash rocket as separator. Valid values are:
265
- #
266
- # key - left alignment of keys
267
- # 'a' => 2
268
- # 'bb' => 3
269
- # separator - alignment of hash rockets, keys are right aligned
270
- # 'a' => 2
271
- # 'bb' => 3
272
- # table - left alignment of keys, hash rockets, and values
273
- # 'a' => 2
274
- # 'bb' => 3
275
- EnforcedHashRocketStyle: key
276
- SupportedHashRocketStyles:
277
- - key
278
- - separator
279
- - table
280
- # Alignment of entries using colon as separator. Valid values are:
281
- #
282
- # key - left alignment of keys
283
- # a: 0
284
- # bb: 1
285
- # separator - alignment of colons, keys are right aligned
286
- # a: 0
287
- # bb: 1
288
- # table - left alignment of keys and values
289
- # a: 0
290
- # bb: 1
291
- EnforcedColonStyle: key
292
- SupportedColonStyles:
293
- - key
294
- - separator
295
- - table
296
- # Select whether hashes that are the last argument in a method call should be
297
- # inspected? Valid values are:
298
- #
299
- # always_inspect - Inspect both implicit and explicit hashes.
300
- # Registers an offense for:
301
- # function(a: 1,
302
- # b: 2)
303
- # Registers an offense for:
304
- # function({a: 1,
305
- # b: 2})
306
- # always_ignore - Ignore both implicit and explicit hashes.
307
- # Accepts:
308
- # function(a: 1,
309
- # b: 2)
310
- # Accepts:
311
- # function({a: 1,
312
- # b: 2})
313
- # ignore_implicit - Ignore only implicit hashes.
314
- # Accepts:
315
- # function(a: 1,
316
- # b: 2)
317
- # Registers an offense for:
318
- # function({a: 1,
319
- # b: 2})
320
- # ignore_explicit - Ignore only explicit hashes.
321
- # Accepts:
322
- # function({a: 1,
323
- # b: 2})
324
- # Registers an offense for:
325
- # function(a: 1,
326
- # b: 2)
327
- EnforcedLastArgumentHashStyle: always_inspect
328
- SupportedLastArgumentHashStyles:
329
- - always_inspect
330
- - always_ignore
331
- - ignore_implicit
332
- - ignore_explicit
333
-
334
- Layout/AlignParameters:
335
- Description: >-
336
- Align the parameters of a method definition if they span more
337
- than one line.
338
- StyleGuide: '#no-double-indent'
339
- Enabled: true
340
- VersionAdded: '0.49'
341
- VersionChanged: '0.68'
342
- # Alignment of parameters in multi-line method calls.
343
- #
344
- # The `with_first_parameter` style aligns the following lines along the same
345
- # column as the first parameter.
346
- #
347
- # def method_foo(a,
348
- # b)
349
- #
350
- # The `with_fixed_indentation` style aligns the following lines with one
351
- # level of indentation relative to the start of the line with the method call.
352
- #
353
- # def method_foo(a,
354
- # b)
355
- EnforcedStyle: with_first_parameter
356
- SupportedStyles:
357
- - with_first_parameter
358
- - with_fixed_indentation
359
- # By default, the indentation width from Layout/IndentationWidth is used
268
+ VersionChanged: '0.77'
269
+ # By default, the indentation width from `Layout/IndentationWidth` is used
360
270
  # But it can be overridden by setting this parameter
361
271
  IndentationWidth: ~
362
272
 
@@ -624,56 +534,11 @@ Layout/ExtraSpacing:
624
534
  # When true, forces the alignment of `=` in assignments on consecutive lines.
625
535
  ForceEqualSignAlignment: false
626
536
 
627
- Layout/FirstArrayElementLineBreak:
628
- Description: >-
629
- Checks for a line break before the first element in a
630
- multi-line array.
631
- Enabled: false
632
- VersionAdded: '0.49'
633
-
634
- Layout/FirstHashElementLineBreak:
635
- Description: >-
636
- Checks for a line break before the first element in a
637
- multi-line hash.
638
- Enabled: false
639
- VersionAdded: '0.49'
640
-
641
- Layout/FirstMethodArgumentLineBreak:
642
- Description: >-
643
- Checks for a line break before the first argument in a
644
- multi-line method call.
645
- Enabled: false
646
- VersionAdded: '0.49'
647
-
648
- Layout/FirstMethodParameterLineBreak:
649
- Description: >-
650
- Checks for a line break before the first parameter in a
651
- multi-line method parameter definition.
652
- Enabled: false
653
- VersionAdded: '0.49'
654
-
655
- Layout/HeredocArgumentClosingParenthesis:
656
- Description: >-
657
- Checks for the placement of the closing parenthesis in a
658
- method call that passes a HEREDOC string as an argument.
659
- Enabled: false
660
- StyleGuide: '#heredoc-argument-closing-parentheses'
661
- VersionAdded: '0.68'
662
-
663
- Layout/IndentAssignment:
664
- Description: >-
665
- Checks the indentation of the first line of the
666
- right-hand-side of a multi-line assignment.
667
- Enabled: true
668
- VersionAdded: '0.49'
669
- # By default, the indentation width from `Layout/IndentationWidth` is used
670
- # But it can be overridden by setting this parameter
671
- IndentationWidth: ~
672
-
673
- Layout/IndentFirstArgument:
537
+ Layout/FirstArgumentIndentation:
674
538
  Description: 'Checks the indentation of the first argument in a method call.'
675
539
  Enabled: true
676
540
  VersionAdded: '0.68'
541
+ VersionChanged: '0.77'
677
542
  EnforcedStyle: special_for_inner_method_call_in_parentheses
678
543
  SupportedStyles:
679
544
  # The first parameter should always be indented one step more than the
@@ -694,12 +559,13 @@ Layout/IndentFirstArgument:
694
559
  # But it can be overridden by setting this parameter
695
560
  IndentationWidth: ~
696
561
 
697
- Layout/IndentFirstArrayElement:
562
+ Layout/FirstArrayElementIndentation:
698
563
  Description: >-
699
564
  Checks the indentation of the first element in an array
700
565
  literal.
701
566
  Enabled: true
702
567
  VersionAdded: '0.68'
568
+ VersionChanged: '0.77'
703
569
  # The value `special_inside_parentheses` means that array literals with
704
570
  # brackets that have their opening bracket on the same line as a surrounding
705
571
  # opening round parenthesis, shall have their first element indented relative
@@ -720,10 +586,18 @@ Layout/IndentFirstArrayElement:
720
586
  # But it can be overridden by setting this parameter
721
587
  IndentationWidth: ~
722
588
 
723
- Layout/IndentFirstHashElement:
589
+ Layout/FirstArrayElementLineBreak:
590
+ Description: >-
591
+ Checks for a line break before the first element in a
592
+ multi-line array.
593
+ Enabled: false
594
+ VersionAdded: '0.49'
595
+
596
+ Layout/FirstHashElementIndentation:
724
597
  Description: 'Checks the indentation of the first key in a hash literal.'
725
598
  Enabled: true
726
599
  VersionAdded: '0.68'
600
+ VersionChanged: '0.77'
727
601
  # The value `special_inside_parentheses` means that hash literals with braces
728
602
  # that have their opening brace on the same line as a surrounding opening
729
603
  # round parenthesis, shall have their first key indented relative to the
@@ -744,13 +618,34 @@ Layout/IndentFirstHashElement:
744
618
  # But it can be overridden by setting this parameter
745
619
  IndentationWidth: ~
746
620
 
747
- Layout/IndentFirstParameter:
621
+ Layout/FirstHashElementLineBreak:
622
+ Description: >-
623
+ Checks for a line break before the first element in a
624
+ multi-line hash.
625
+ Enabled: false
626
+ VersionAdded: '0.49'
627
+
628
+ Layout/FirstMethodArgumentLineBreak:
629
+ Description: >-
630
+ Checks for a line break before the first argument in a
631
+ multi-line method call.
632
+ Enabled: false
633
+ VersionAdded: '0.49'
634
+
635
+ Layout/FirstMethodParameterLineBreak:
636
+ Description: >-
637
+ Checks for a line break before the first parameter in a
638
+ multi-line method parameter definition.
639
+ Enabled: false
640
+ VersionAdded: '0.49'
641
+
642
+ Layout/FirstParameterIndentation:
748
643
  Description: >-
749
644
  Checks the indentation of the first parameter in a
750
645
  method definition.
751
646
  Enabled: true
752
647
  VersionAdded: '0.49'
753
- VersionChanged: '0.68'
648
+ VersionChanged: '0.77'
754
649
  EnforcedStyle: consistent
755
650
  SupportedStyles:
756
651
  - consistent
@@ -759,12 +654,98 @@ Layout/IndentFirstParameter:
759
654
  # But it can be overridden by setting this parameter
760
655
  IndentationWidth: ~
761
656
 
762
- Layout/IndentHeredoc:
657
+ Layout/HashAlignment:
658
+ Description: >-
659
+ Align the elements of a hash literal if they span more than
660
+ one line.
661
+ Enabled: true
662
+ AllowMultipleStyles: true
663
+ VersionAdded: '0.49'
664
+ VersionChanged: '0.77'
665
+ # Alignment of entries using hash rocket as separator. Valid values are:
666
+ #
667
+ # key - left alignment of keys
668
+ # 'a' => 2
669
+ # 'bb' => 3
670
+ # separator - alignment of hash rockets, keys are right aligned
671
+ # 'a' => 2
672
+ # 'bb' => 3
673
+ # table - left alignment of keys, hash rockets, and values
674
+ # 'a' => 2
675
+ # 'bb' => 3
676
+ EnforcedHashRocketStyle: key
677
+ SupportedHashRocketStyles:
678
+ - key
679
+ - separator
680
+ - table
681
+ # Alignment of entries using colon as separator. Valid values are:
682
+ #
683
+ # key - left alignment of keys
684
+ # a: 0
685
+ # bb: 1
686
+ # separator - alignment of colons, keys are right aligned
687
+ # a: 0
688
+ # bb: 1
689
+ # table - left alignment of keys and values
690
+ # a: 0
691
+ # bb: 1
692
+ EnforcedColonStyle: key
693
+ SupportedColonStyles:
694
+ - key
695
+ - separator
696
+ - table
697
+ # Select whether hashes that are the last argument in a method call should be
698
+ # inspected? Valid values are:
699
+ #
700
+ # always_inspect - Inspect both implicit and explicit hashes.
701
+ # Registers an offense for:
702
+ # function(a: 1,
703
+ # b: 2)
704
+ # Registers an offense for:
705
+ # function({a: 1,
706
+ # b: 2})
707
+ # always_ignore - Ignore both implicit and explicit hashes.
708
+ # Accepts:
709
+ # function(a: 1,
710
+ # b: 2)
711
+ # Accepts:
712
+ # function({a: 1,
713
+ # b: 2})
714
+ # ignore_implicit - Ignore only implicit hashes.
715
+ # Accepts:
716
+ # function(a: 1,
717
+ # b: 2)
718
+ # Registers an offense for:
719
+ # function({a: 1,
720
+ # b: 2})
721
+ # ignore_explicit - Ignore only explicit hashes.
722
+ # Accepts:
723
+ # function({a: 1,
724
+ # b: 2})
725
+ # Registers an offense for:
726
+ # function(a: 1,
727
+ # b: 2)
728
+ EnforcedLastArgumentHashStyle: always_inspect
729
+ SupportedLastArgumentHashStyles:
730
+ - always_inspect
731
+ - always_ignore
732
+ - ignore_implicit
733
+ - ignore_explicit
734
+
735
+ Layout/HeredocArgumentClosingParenthesis:
736
+ Description: >-
737
+ Checks for the placement of the closing parenthesis in a
738
+ method call that passes a HEREDOC string as an argument.
739
+ Enabled: false
740
+ StyleGuide: '#heredoc-argument-closing-parentheses'
741
+ VersionAdded: '0.68'
742
+
743
+ Layout/HeredocIndentation:
763
744
  Description: 'This cop checks the indentation of the here document bodies.'
764
745
  StyleGuide: '#squiggly-heredocs'
765
746
  Enabled: true
766
747
  VersionAdded: '0.49'
767
- VersionChanged: '0.69'
748
+ VersionChanged: '0.77'
768
749
  EnforcedStyle: squiggly
769
750
  SupportedStyles:
770
751
  - squiggly
@@ -806,11 +787,6 @@ Layout/InitialIndentation:
806
787
  Enabled: true
807
788
  VersionAdded: '0.49'
808
789
 
809
- Layout/LeadingBlankLines:
810
- Description: Check for unnecessary blank lines at the beginning of a file.
811
- Enabled: true
812
- VersionAdded: '0.57'
813
-
814
790
  Layout/LeadingCommentSpace:
815
791
  Description: 'Comments should start with a space.'
816
792
  StyleGuide: '#hash-space'
@@ -819,6 +795,35 @@ Layout/LeadingCommentSpace:
819
795
  VersionChanged: '0.73'
820
796
  AllowDoxygenCommentStyle: false
821
797
 
798
+ Layout/LeadingEmptyLines:
799
+ Description: Check for unnecessary blank lines at the beginning of a file.
800
+ Enabled: true
801
+ VersionAdded: '0.57'
802
+ VersionChanged: '0.77'
803
+
804
+ Layout/LineLength:
805
+ Description: 'Limit lines to 80 characters.'
806
+ StyleGuide: '#80-character-limits'
807
+ Enabled: true
808
+ VersionAdded: '0.25'
809
+ VersionChanged: '0.78'
810
+ AutoCorrect: false
811
+ Max: 80
812
+ # To make it possible to copy or click on URIs in the code, we allow lines
813
+ # containing a URI to be longer than Max.
814
+ AllowHeredoc: true
815
+ AllowURI: true
816
+ URISchemes:
817
+ - http
818
+ - https
819
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
820
+ # directives like '# rubocop: enable ...' when calculating a line's length.
821
+ IgnoreCopDirectives: true
822
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
823
+ # elements. Strings will be converted to Regexp objects. A line that matches
824
+ # any regular expression listed in this option will be ignored by LineLength.
825
+ IgnoredPatterns: []
826
+
822
827
  Layout/MultilineArrayBraceLayout:
823
828
  Description: >-
824
829
  Checks that the closing brace in an array literal is
@@ -960,6 +965,35 @@ Layout/MultilineOperationIndentation:
960
965
  # But it can be overridden by setting this parameter
961
966
  IndentationWidth: ~
962
967
 
968
+ Layout/ParameterAlignment:
969
+ Description: >-
970
+ Align the parameters of a method definition if they span more
971
+ than one line.
972
+ StyleGuide: '#no-double-indent'
973
+ Enabled: true
974
+ VersionAdded: '0.49'
975
+ VersionChanged: '0.77'
976
+ # Alignment of parameters in multi-line method calls.
977
+ #
978
+ # The `with_first_parameter` style aligns the following lines along the same
979
+ # column as the first parameter.
980
+ #
981
+ # def method_foo(a,
982
+ # b)
983
+ #
984
+ # The `with_fixed_indentation` style aligns the following lines with one
985
+ # level of indentation relative to the start of the line with the method call.
986
+ #
987
+ # def method_foo(a,
988
+ # b)
989
+ EnforcedStyle: with_first_parameter
990
+ SupportedStyles:
991
+ - with_first_parameter
992
+ - with_fixed_indentation
993
+ # By default, the indentation width from Layout/IndentationWidth is used
994
+ # But it can be overridden by setting this parameter
995
+ IndentationWidth: ~
996
+
963
997
  Layout/RescueEnsureAlignment:
964
998
  Description: 'Align rescues and ensures correctly.'
965
999
  Enabled: true
@@ -1033,6 +1067,10 @@ Layout/SpaceAroundOperators:
1033
1067
  # with an operator on the previous or next line, not counting empty lines
1034
1068
  # or comment lines.
1035
1069
  AllowForAlignment: true
1070
+ EnforcedStyleForExponentOperator: no_space
1071
+ SupportedStylesForExponentOperator:
1072
+ - space
1073
+ - no_space
1036
1074
 
1037
1075
  Layout/SpaceBeforeBlockBraces:
1038
1076
  Description: >-
@@ -1202,11 +1240,12 @@ Layout/Tab:
1202
1240
  # replace each tab.
1203
1241
  IndentationWidth: ~
1204
1242
 
1205
- Layout/TrailingBlankLines:
1243
+ Layout/TrailingEmptyLines:
1206
1244
  Description: 'Checks trailing blank lines and final newline.'
1207
1245
  StyleGuide: '#newline-eof'
1208
1246
  Enabled: true
1209
1247
  VersionAdded: '0.49'
1248
+ VersionChanged: '0.77'
1210
1249
  EnforcedStyle: final_newline
1211
1250
  SupportedStyles:
1212
1251
  - final_newline
@@ -1290,16 +1329,17 @@ Lint/DuplicateCaseCondition:
1290
1329
  Enabled: true
1291
1330
  VersionAdded: '0.45'
1292
1331
 
1332
+ Lint/DuplicateHashKey:
1333
+ Description: 'Check for duplicate keys in hash literals.'
1334
+ Enabled: true
1335
+ VersionAdded: '0.34'
1336
+ VersionChanged: '0.77'
1337
+
1293
1338
  Lint/DuplicateMethods:
1294
1339
  Description: 'Check for duplicate method definitions.'
1295
1340
  Enabled: true
1296
1341
  VersionAdded: '0.29'
1297
1342
 
1298
- Lint/DuplicatedKey:
1299
- Description: 'Check for duplicate keys in hash literals.'
1300
- Enabled: true
1301
- VersionAdded: '0.34'
1302
-
1303
1343
  Lint/EachWithObjectArgument:
1304
1344
  Description: 'Check for immutable argument given to each_with_object.'
1305
1345
  Enabled: true
@@ -1367,14 +1407,6 @@ Lint/FormatParameterMismatch:
1367
1407
  Enabled: true
1368
1408
  VersionAdded: '0.33'
1369
1409
 
1370
- Lint/HandleExceptions:
1371
- Description: "Don't suppress exception."
1372
- StyleGuide: '#dont-hide-exceptions'
1373
- Enabled: true
1374
- AllowComments: false
1375
- VersionAdded: '0.9'
1376
- VersionChanged: '0.70'
1377
-
1378
1410
  Lint/HeredocMethodCallPosition:
1379
1411
  Description: >-
1380
1412
  Checks for the ordering of a method call where
@@ -1444,10 +1476,11 @@ Lint/MissingCopEnableDirective:
1444
1476
  # .inf for any size
1445
1477
  MaximumRangeSize: .inf
1446
1478
 
1447
- Lint/MultipleCompare:
1448
- Description: "Use `&&` operator to compare multiple value."
1479
+ Lint/MultipleComparison:
1480
+ Description: "Use `&&` operator to compare multiple values."
1449
1481
  Enabled: true
1450
1482
  VersionAdded: '0.47'
1483
+ VersionChanged: '0.77'
1451
1484
 
1452
1485
  Lint/NestedMethodDefinition:
1453
1486
  Description: 'Do not use nested method definitions.'
@@ -1467,6 +1500,12 @@ Lint/NextWithoutAccumulator:
1467
1500
  Enabled: true
1468
1501
  VersionAdded: '0.36'
1469
1502
 
1503
+ Lint/NonDeterministicRequireOrder:
1504
+ Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1505
+ Enabled: true
1506
+ VersionAdded: '0.78'
1507
+ Safe: false
1508
+
1470
1509
  Lint/NonLocalExitFromIterator:
1471
1510
  Description: 'Do not use return in iterator to cause non-local exit.'
1472
1511
  Enabled: true
@@ -1535,6 +1574,13 @@ Lint/RedundantSplatExpansion:
1535
1574
  Enabled: true
1536
1575
  VersionChanged: '0.76'
1537
1576
 
1577
+ Lint/RedundantStringCoercion:
1578
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1579
+ StyleGuide: '#no-to-s'
1580
+ Enabled: true
1581
+ VersionAdded: '0.19'
1582
+ VersionChanged: '0.77'
1583
+
1538
1584
  Lint/RedundantWithIndex:
1539
1585
  Description: 'Checks for redundant `with_index`.'
1540
1586
  Enabled: true
@@ -1580,8 +1626,8 @@ Lint/SafeNavigationChain:
1580
1626
  Description: 'Do not chain ordinary method call after safe navigation operator.'
1581
1627
  Enabled: true
1582
1628
  VersionAdded: '0.47'
1583
- VersionChanged: '0.56'
1584
- Whitelist:
1629
+ VersionChanged: '0.77'
1630
+ AllowedMethods:
1585
1631
  - present?
1586
1632
  - blank?
1587
1633
  - presence
@@ -1595,14 +1641,14 @@ Lint/SafeNavigationConsistency:
1595
1641
  for all method calls on that same object.
1596
1642
  Enabled: true
1597
1643
  VersionAdded: '0.55'
1598
- Whitelist:
1644
+ VersionChanged: '0.77'
1645
+ AllowedMethods:
1599
1646
  - present?
1600
1647
  - blank?
1601
1648
  - presence
1602
1649
  - try
1603
1650
  - try!
1604
1651
 
1605
-
1606
1652
  Lint/SafeNavigationWithEmpty:
1607
1653
  Description: 'Avoid `foo&.empty?` in conditionals.'
1608
1654
  Enabled: true
@@ -1640,12 +1686,13 @@ Lint/ShadowingOuterLocalVariable:
1640
1686
  Enabled: true
1641
1687
  VersionAdded: '0.9'
1642
1688
 
1643
- Lint/StringConversionInInterpolation:
1644
- Description: 'Checks for Object#to_s usage in string interpolation.'
1645
- StyleGuide: '#no-to-s'
1689
+ Lint/SuppressedException:
1690
+ Description: "Don't suppress exceptions."
1691
+ StyleGuide: '#dont-hide-exceptions'
1646
1692
  Enabled: true
1647
- VersionAdded: '0.19'
1648
- VersionChanged: '0.20'
1693
+ AllowComments: false
1694
+ VersionAdded: '0.9'
1695
+ VersionChanged: '0.77'
1649
1696
 
1650
1697
  Lint/Syntax:
1651
1698
  Description: 'Checks syntax error.'
@@ -1797,29 +1844,6 @@ Metrics/CyclomaticComplexity:
1797
1844
  VersionAdded: '0.25'
1798
1845
  Max: 6
1799
1846
 
1800
- Metrics/LineLength:
1801
- Description: 'Limit lines to 80 characters.'
1802
- StyleGuide: '#80-character-limits'
1803
- Enabled: true
1804
- VersionAdded: '0.25'
1805
- VersionChanged: '0.68'
1806
- AutoCorrect: false
1807
- Max: 80
1808
- # To make it possible to copy or click on URIs in the code, we allow lines
1809
- # containing a URI to be longer than Max.
1810
- AllowHeredoc: true
1811
- AllowURI: true
1812
- URISchemes:
1813
- - http
1814
- - https
1815
- # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1816
- # directives like '# rubocop: enable ...' when calculating a line's length.
1817
- IgnoreCopDirectives: true
1818
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1819
- # elements. Strings will be converted to Regexp objects. A line that matches
1820
- # any regular expression listed in this option will be ignored by LineLength.
1821
- IgnoredPatterns: []
1822
-
1823
1847
  Metrics/MethodLength:
1824
1848
  Description: 'Avoid methods longer than 10 lines of code.'
1825
1849
  StyleGuide: '#short-methods'
@@ -1881,6 +1905,21 @@ Naming/BinaryOperatorParameterName:
1881
1905
  Enabled: true
1882
1906
  VersionAdded: '0.50'
1883
1907
 
1908
+ Naming/BlockParameterName:
1909
+ Description: >-
1910
+ Checks for block 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.77'
1915
+ # Parameter names may be equal to or greater than this value
1916
+ MinNameLength: 1
1917
+ AllowNamesEndingInNumbers: true
1918
+ # Allowed names that will not register an offense
1919
+ AllowedNames: []
1920
+ # Forbidden names that will register an offense
1921
+ ForbiddenNames: []
1922
+
1884
1923
  Naming/ClassAndModuleCamelCase:
1885
1924
  Description: 'Use CamelCase for classes and modules.'
1886
1925
  StyleGuide: '#camelcase-classes'
@@ -1972,7 +2011,7 @@ Naming/HeredocDelimiterNaming:
1972
2011
  StyleGuide: '#heredoc-delimiters'
1973
2012
  Enabled: true
1974
2013
  VersionAdded: '0.50'
1975
- Blacklist:
2014
+ ForbiddenDelimiters:
1976
2015
  - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
1977
2016
 
1978
2017
  Naming/MemoizedInstanceVariableName:
@@ -2004,25 +2043,50 @@ Naming/MethodName:
2004
2043
  #
2005
2044
  IgnoredPatterns: []
2006
2045
 
2046
+ Naming/MethodParameterName:
2047
+ Description: >-
2048
+ Checks for method parameter names that contain capital letters,
2049
+ end in numbers, or do not meet a minimal length.
2050
+ Enabled: true
2051
+ VersionAdded: '0.53'
2052
+ VersionChanged: '0.77'
2053
+ # Parameter names may be equal to or greater than this value
2054
+ MinNameLength: 3
2055
+ AllowNamesEndingInNumbers: true
2056
+ # Allowed names that will not register an offense
2057
+ AllowedNames:
2058
+ - io
2059
+ - id
2060
+ - to
2061
+ - by
2062
+ - 'on'
2063
+ - in
2064
+ - at
2065
+ - ip
2066
+ - db
2067
+ - os
2068
+ # Forbidden names that will register an offense
2069
+ ForbiddenNames: []
2070
+
2007
2071
  Naming/PredicateName:
2008
2072
  Description: 'Check the names of predicate methods.'
2009
2073
  StyleGuide: '#bool-methods-qmark'
2010
2074
  Enabled: true
2011
2075
  VersionAdded: '0.50'
2012
- VersionChanged: '0.51'
2076
+ VersionChanged: '0.77'
2013
2077
  # Predicate name prefixes.
2014
2078
  NamePrefix:
2015
2079
  - is_
2016
2080
  - has_
2017
2081
  - have_
2018
2082
  # Predicate name prefixes that should be removed.
2019
- NamePrefixBlacklist:
2083
+ ForbiddenPrefixes:
2020
2084
  - is_
2021
2085
  - has_
2022
2086
  - have_
2023
- # Predicate names which, despite having a blacklisted prefix, or no `?`,
2087
+ # Predicate names which, despite having a forbidden prefix, or no `?`,
2024
2088
  # should still be accepted
2025
- NameWhitelist:
2089
+ AllowedMethods:
2026
2090
  - is_a?
2027
2091
  # Method definition macros for dynamically generated methods.
2028
2092
  MethodDefinitionMacros:
@@ -2040,46 +2104,6 @@ Naming/RescuedExceptionsVariableName:
2040
2104
  VersionChanged: '0.68'
2041
2105
  PreferredName: e
2042
2106
 
2043
- Naming/UncommunicativeBlockParamName:
2044
- Description: >-
2045
- Checks for block parameter names that contain capital letters,
2046
- end in numbers, or do not meet a minimal length.
2047
- Enabled: true
2048
- VersionAdded: '0.53'
2049
- # Parameter names may be equal to or greater than this value
2050
- MinNameLength: 1
2051
- AllowNamesEndingInNumbers: true
2052
- # Whitelisted names that will not register an offense
2053
- AllowedNames: []
2054
- # Blacklisted names that will register an offense
2055
- ForbiddenNames: []
2056
-
2057
- Naming/UncommunicativeMethodParamName:
2058
- Description: >-
2059
- Checks for method parameter names that contain capital letters,
2060
- end in numbers, or do not meet a minimal length.
2061
- Enabled: true
2062
- VersionAdded: '0.53'
2063
- VersionChanged: '0.59'
2064
- # Parameter names may be equal to or greater than this value
2065
- MinNameLength: 3
2066
- AllowNamesEndingInNumbers: true
2067
- # Whitelisted names that will not register an offense
2068
- AllowedNames:
2069
- - io
2070
- - id
2071
- - to
2072
- - by
2073
- - 'on'
2074
- - in
2075
- - at
2076
- - ip
2077
- - db
2078
- - os
2079
- # Blacklisted names that will register an offense
2080
- ForbiddenNames: []
2081
-
2082
-
2083
2107
  Naming/VariableName:
2084
2108
  Description: 'Use the configured style when naming variables.'
2085
2109
  StyleGuide: '#snake-case-symbols-methods-vars'
@@ -2734,7 +2758,7 @@ Style/FrozenStringLiteralComment:
2734
2758
  to help transition to frozen string literals by default.
2735
2759
  Enabled: true
2736
2760
  VersionAdded: '0.36'
2737
- VersionChanged: '0.69'
2761
+ VersionChanged: '0.79'
2738
2762
  EnforcedStyle: always
2739
2763
  SupportedStyles:
2740
2764
  # `always` will always add the frozen string literal comment to a file
@@ -2745,6 +2769,7 @@ Style/FrozenStringLiteralComment:
2745
2769
  # `never` will enforce that the frozen string literal comment does not
2746
2770
  # exist in a file.
2747
2771
  - never
2772
+ Safe: false
2748
2773
 
2749
2774
  Style/GlobalVars:
2750
2775
  Description: 'Do not introduce global variables.'
@@ -2874,8 +2899,9 @@ Style/IpAddresses:
2874
2899
  Description: "Don't include literal IP addresses in code."
2875
2900
  Enabled: false
2876
2901
  VersionAdded: '0.58'
2877
- # Allow strings to be whitelisted
2878
- Whitelist:
2902
+ VersionChanged: '0.77'
2903
+ # Allow addresses to be permitted
2904
+ AllowedAddresses:
2879
2905
  - "::"
2880
2906
  # :: is a valid IPv6 address, but could potentially be legitimately in code
2881
2907
 
@@ -3148,8 +3174,8 @@ Style/NestedParenthesizedCalls:
3148
3174
  argument list of another parenthesized method call.
3149
3175
  Enabled: true
3150
3176
  VersionAdded: '0.36'
3151
- VersionChanged: '0.50'
3152
- Whitelist:
3177
+ VersionChanged: '0.77'
3178
+ AllowedMethods:
3153
3179
  - be
3154
3180
  - be_a
3155
3181
  - be_an
@@ -3526,11 +3552,11 @@ Style/SafeNavigation:
3526
3552
  safe navigation (`&.`).
3527
3553
  Enabled: true
3528
3554
  VersionAdded: '0.43'
3529
- VersionChanged: '0.56'
3555
+ VersionChanged: '0.77'
3530
3556
  # Safe navigation may cause a statement to start returning `nil` in addition
3531
3557
  # to whatever it used to return.
3532
3558
  ConvertCodeThatCanStartToReturnNil: false
3533
- Whitelist:
3559
+ AllowedMethods:
3534
3560
  - present?
3535
3561
  - blank?
3536
3562
  - presence
@@ -3808,7 +3834,7 @@ Style/TrivialAccessors:
3808
3834
  StyleGuide: '#attr_family'
3809
3835
  Enabled: true
3810
3836
  VersionAdded: '0.9'
3811
- VersionChanged: '0.38'
3837
+ VersionChanged: '0.77'
3812
3838
  # When set to `false` the cop will suggest the use of accessor methods
3813
3839
  # in situations like:
3814
3840
  #
@@ -3829,7 +3855,7 @@ Style/TrivialAccessors:
3829
3855
  # Commonly used in DSLs
3830
3856
  AllowDSLWriters: false
3831
3857
  IgnoreClassMethods: false
3832
- Whitelist:
3858
+ AllowedMethods:
3833
3859
  - to_ary
3834
3860
  - to_a
3835
3861
  - to_c