rubocop 1.39.0 → 1.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -2
  4. data/config/default.yml +91 -10
  5. data/exe/rubocop +1 -1
  6. data/lib/rubocop/cli.rb +1 -1
  7. data/lib/rubocop/comment_config.rb +5 -0
  8. data/lib/rubocop/config.rb +39 -15
  9. data/lib/rubocop/config_loader.rb +14 -5
  10. data/lib/rubocop/config_loader_resolver.rb +6 -2
  11. data/lib/rubocop/config_validator.rb +1 -1
  12. data/lib/rubocop/cop/badge.rb +9 -4
  13. data/lib/rubocop/cop/base.rb +84 -74
  14. data/lib/rubocop/cop/commissioner.rb +8 -3
  15. data/lib/rubocop/cop/cop.rb +29 -29
  16. data/lib/rubocop/cop/corrector.rb +23 -11
  17. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +22 -6
  18. data/lib/rubocop/cop/gemspec/dependency_version.rb +16 -18
  19. data/lib/rubocop/cop/internal_affairs/cop_description.rb +3 -1
  20. data/lib/rubocop/cop/internal_affairs/lambda_or_proc.rb +46 -0
  21. data/lib/rubocop/cop/internal_affairs.rb +1 -0
  22. data/lib/rubocop/cop/layout/class_structure.rb +32 -11
  23. data/lib/rubocop/cop/layout/comment_indentation.rb +3 -1
  24. data/lib/rubocop/cop/layout/empty_lines.rb +2 -0
  25. data/lib/rubocop/cop/layout/extra_spacing.rb +10 -6
  26. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +38 -2
  27. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +49 -2
  28. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +61 -2
  29. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +52 -2
  30. data/lib/rubocop/cop/layout/indentation_style.rb +7 -2
  31. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +5 -0
  32. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +11 -5
  33. data/lib/rubocop/cop/layout/line_length.rb +2 -0
  34. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +51 -2
  35. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
  36. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +49 -2
  37. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +53 -2
  38. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +58 -2
  39. data/lib/rubocop/cop/layout/redundant_line_break.rb +2 -2
  40. data/lib/rubocop/cop/layout/space_around_keyword.rb +1 -1
  41. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +1 -1
  42. data/lib/rubocop/cop/layout/trailing_whitespace.rb +11 -4
  43. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
  44. data/lib/rubocop/cop/lint/assignment_in_condition.rb +11 -1
  45. data/lib/rubocop/cop/lint/constant_resolution.rb +4 -0
  46. data/lib/rubocop/cop/lint/debugger.rb +3 -1
  47. data/lib/rubocop/cop/lint/deprecated_constants.rb +8 -1
  48. data/lib/rubocop/cop/lint/duplicate_branch.rb +0 -2
  49. data/lib/rubocop/cop/lint/duplicate_methods.rb +19 -8
  50. data/lib/rubocop/cop/lint/empty_block.rb +1 -5
  51. data/lib/rubocop/cop/lint/empty_conditional_body.rb +1 -1
  52. data/lib/rubocop/cop/lint/interpolation_check.rb +4 -3
  53. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +10 -5
  54. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +19 -0
  55. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +5 -0
  56. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +15 -3
  57. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +1 -1
  58. data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -0
  59. data/lib/rubocop/cop/lint/require_parentheses.rb +3 -1
  60. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +10 -12
  61. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +5 -4
  62. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +4 -3
  63. data/lib/rubocop/cop/lint/unused_method_argument.rb +2 -1
  64. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +5 -3
  65. data/lib/rubocop/cop/lint/void.rb +6 -6
  66. data/lib/rubocop/cop/metrics/block_length.rb +9 -4
  67. data/lib/rubocop/cop/metrics/class_length.rb +10 -5
  68. data/lib/rubocop/cop/metrics/method_length.rb +9 -4
  69. data/lib/rubocop/cop/metrics/module_length.rb +10 -5
  70. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  71. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +4 -4
  72. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +6 -3
  73. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  74. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +2 -2
  75. data/lib/rubocop/cop/mixin/annotation_comment.rb +13 -6
  76. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +21 -9
  77. data/lib/rubocop/cop/mixin/first_element_line_break.rb +11 -7
  78. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +28 -5
  79. data/lib/rubocop/cop/mixin/line_length_help.rb +8 -1
  80. data/lib/rubocop/cop/mixin/method_complexity.rb +5 -3
  81. data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +5 -3
  82. data/lib/rubocop/cop/mixin/percent_array.rb +3 -5
  83. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
  84. data/lib/rubocop/cop/mixin/require_library.rb +2 -0
  85. data/lib/rubocop/cop/mixin/rescue_node.rb +3 -3
  86. data/lib/rubocop/cop/mixin/statement_modifier.rb +15 -1
  87. data/lib/rubocop/cop/naming/block_forwarding.rb +1 -1
  88. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +2 -0
  89. data/lib/rubocop/cop/naming/inclusive_language.rb +4 -1
  90. data/lib/rubocop/cop/registry.rb +51 -36
  91. data/lib/rubocop/cop/security/compound_hash.rb +2 -1
  92. data/lib/rubocop/cop/style/alias.rb +9 -1
  93. data/lib/rubocop/cop/style/array_intersect.rb +111 -0
  94. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  95. data/lib/rubocop/cop/style/concat_array_literals.rb +86 -0
  96. data/lib/rubocop/cop/style/documentation.rb +11 -5
  97. data/lib/rubocop/cop/style/guard_clause.rb +44 -9
  98. data/lib/rubocop/cop/style/hash_syntax.rb +10 -7
  99. data/lib/rubocop/cop/style/identical_conditional_branches.rb +15 -0
  100. data/lib/rubocop/cop/style/if_with_semicolon.rb +4 -4
  101. data/lib/rubocop/cop/style/inverse_methods.rb +2 -0
  102. data/lib/rubocop/cop/style/line_end_concatenation.rb +4 -1
  103. data/lib/rubocop/cop/style/map_to_set.rb +61 -0
  104. data/lib/rubocop/cop/style/method_def_parentheses.rb +11 -4
  105. data/lib/rubocop/cop/style/min_max_comparison.rb +73 -0
  106. data/lib/rubocop/cop/style/nil_lambda.rb +1 -1
  107. data/lib/rubocop/cop/style/redundant_argument.rb +3 -0
  108. data/lib/rubocop/cop/style/redundant_constant_base.rb +85 -0
  109. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +39 -0
  110. data/lib/rubocop/cop/style/redundant_return.rb +7 -0
  111. data/lib/rubocop/cop/style/redundant_sort.rb +1 -1
  112. data/lib/rubocop/cop/style/redundant_string_escape.rb +6 -3
  113. data/lib/rubocop/cop/style/require_order.rb +142 -0
  114. data/lib/rubocop/cop/style/safe_navigation.rb +35 -6
  115. data/lib/rubocop/cop/style/select_by_regexp.rb +13 -5
  116. data/lib/rubocop/cop/style/semicolon.rb +2 -1
  117. data/lib/rubocop/cop/style/signal_exception.rb +8 -6
  118. data/lib/rubocop/cop/style/string_literals.rb +1 -5
  119. data/lib/rubocop/cop/style/symbol_proc.rb +2 -4
  120. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +4 -4
  121. data/lib/rubocop/cop/style/word_array.rb +41 -0
  122. data/lib/rubocop/cop/style/yoda_expression.rb +74 -0
  123. data/lib/rubocop/cop/style/zero_length_predicate.rb +31 -14
  124. data/lib/rubocop/cop/team.rb +30 -30
  125. data/lib/rubocop/cop/util.rb +32 -5
  126. data/lib/rubocop/cop/variable_force/assignment.rb +1 -1
  127. data/lib/rubocop/cop/variable_force.rb +17 -29
  128. data/lib/rubocop/cops_documentation_generator.rb +33 -11
  129. data/lib/rubocop/directive_comment.rb +1 -1
  130. data/lib/rubocop/file_patterns.rb +43 -0
  131. data/lib/rubocop/formatter/disabled_config_formatter.rb +17 -6
  132. data/lib/rubocop/formatter/html_formatter.rb +1 -1
  133. data/lib/rubocop/formatter.rb +5 -1
  134. data/lib/rubocop/options.rb +8 -0
  135. data/lib/rubocop/path_util.rb +39 -16
  136. data/lib/rubocop/result_cache.rb +2 -2
  137. data/lib/rubocop/rspec/cop_helper.rb +4 -1
  138. data/lib/rubocop/rspec/support.rb +2 -2
  139. data/lib/rubocop/runner.rb +10 -3
  140. data/lib/rubocop/server/core.rb +1 -1
  141. data/lib/rubocop/target_finder.rb +1 -1
  142. data/lib/rubocop/target_ruby.rb +1 -2
  143. data/lib/rubocop/version.rb +1 -1
  144. data/lib/rubocop.rb +19 -6
  145. metadata +19 -9
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.39.0
4
+ version: 1.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-11-14 00:00:00.000000000 Z
13
+ date: 2023-01-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -120,7 +120,7 @@ dependencies:
120
120
  requirements:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 1.23.0
123
+ version: 1.24.1
124
124
  - - "<"
125
125
  - !ruby/object:Gem::Version
126
126
  version: '2.0'
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: 1.23.0
133
+ version: 1.24.1
134
134
  - - "<"
135
135
  - !ruby/object:Gem::Version
136
136
  version: '2.0'
@@ -291,6 +291,7 @@ files:
291
291
  - lib/rubocop/cop/internal_affairs/example_description.rb
292
292
  - lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
293
293
  - lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
294
+ - lib/rubocop/cop/internal_affairs/lambda_or_proc.rb
294
295
  - lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb
295
296
  - lib/rubocop/cop/internal_affairs/method_name_end_with.rb
296
297
  - lib/rubocop/cop/internal_affairs/method_name_equal.rb
@@ -662,6 +663,7 @@ files:
662
663
  - lib/rubocop/cop/style/and_or.rb
663
664
  - lib/rubocop/cop/style/arguments_forwarding.rb
664
665
  - lib/rubocop/cop/style/array_coercion.rb
666
+ - lib/rubocop/cop/style/array_intersect.rb
665
667
  - lib/rubocop/cop/style/array_join.rb
666
668
  - lib/rubocop/cop/style/ascii_comments.rb
667
669
  - lib/rubocop/cop/style/attr.rb
@@ -689,6 +691,7 @@ files:
689
691
  - lib/rubocop/cop/style/command_literal.rb
690
692
  - lib/rubocop/cop/style/comment_annotation.rb
691
693
  - lib/rubocop/cop/style/commented_keyword.rb
694
+ - lib/rubocop/cop/style/concat_array_literals.rb
692
695
  - lib/rubocop/cop/style/conditional_assignment.rb
693
696
  - lib/rubocop/cop/style/constant_visibility.rb
694
697
  - lib/rubocop/cop/style/copyright.rb
@@ -757,6 +760,7 @@ files:
757
760
  - lib/rubocop/cop/style/magic_comment_format.rb
758
761
  - lib/rubocop/cop/style/map_compact_with_conditional_block.rb
759
762
  - lib/rubocop/cop/style/map_to_hash.rb
763
+ - lib/rubocop/cop/style/map_to_set.rb
760
764
  - lib/rubocop/cop/style/method_call_with_args_parentheses.rb
761
765
  - lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb
762
766
  - lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb
@@ -764,6 +768,7 @@ files:
764
768
  - lib/rubocop/cop/style/method_called_on_do_end_block.rb
765
769
  - lib/rubocop/cop/style/method_def_parentheses.rb
766
770
  - lib/rubocop/cop/style/min_max.rb
771
+ - lib/rubocop/cop/style/min_max_comparison.rb
767
772
  - lib/rubocop/cop/style/missing_else.rb
768
773
  - lib/rubocop/cop/style/missing_respond_to_missing.rb
769
774
  - lib/rubocop/cop/style/mixin_grouping.rb
@@ -821,6 +826,8 @@ files:
821
826
  - lib/rubocop/cop/style/redundant_capital_w.rb
822
827
  - lib/rubocop/cop/style/redundant_condition.rb
823
828
  - lib/rubocop/cop/style/redundant_conditional.rb
829
+ - lib/rubocop/cop/style/redundant_constant_base.rb
830
+ - lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb
824
831
  - lib/rubocop/cop/style/redundant_each.rb
825
832
  - lib/rubocop/cop/style/redundant_exception.rb
826
833
  - lib/rubocop/cop/style/redundant_fetch_block.rb
@@ -840,6 +847,7 @@ files:
840
847
  - lib/rubocop/cop/style/redundant_sort_by.rb
841
848
  - lib/rubocop/cop/style/redundant_string_escape.rb
842
849
  - lib/rubocop/cop/style/regexp_literal.rb
850
+ - lib/rubocop/cop/style/require_order.rb
843
851
  - lib/rubocop/cop/style/rescue_modifier.rb
844
852
  - lib/rubocop/cop/style/rescue_standard_error.rb
845
853
  - lib/rubocop/cop/style/return_nil.rb
@@ -892,6 +900,7 @@ files:
892
900
  - lib/rubocop/cop/style/while_until_modifier.rb
893
901
  - lib/rubocop/cop/style/word_array.rb
894
902
  - lib/rubocop/cop/style/yoda_condition.rb
903
+ - lib/rubocop/cop/style/yoda_expression.rb
895
904
  - lib/rubocop/cop/style/zero_length_predicate.rb
896
905
  - lib/rubocop/cop/team.rb
897
906
  - lib/rubocop/cop/util.rb
@@ -914,6 +923,7 @@ files:
914
923
  - lib/rubocop/ext/regexp_parser.rb
915
924
  - lib/rubocop/feature_loader.rb
916
925
  - lib/rubocop/file_finder.rb
926
+ - lib/rubocop/file_patterns.rb
917
927
  - lib/rubocop/formatter.rb
918
928
  - lib/rubocop/formatter/auto_gen_config_formatter.rb
919
929
  - lib/rubocop/formatter/base_formatter.rb
@@ -985,10 +995,10 @@ metadata:
985
995
  homepage_uri: https://rubocop.org/
986
996
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
987
997
  source_code_uri: https://github.com/rubocop/rubocop/
988
- documentation_uri: https://docs.rubocop.org/rubocop/1.39/
998
+ documentation_uri: https://docs.rubocop.org/rubocop/1.42/
989
999
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
990
1000
  rubygems_mfa_required: 'true'
991
- post_install_message:
1001
+ post_install_message:
992
1002
  rdoc_options: []
993
1003
  require_paths:
994
1004
  - lib
@@ -1003,8 +1013,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1003
1013
  - !ruby/object:Gem::Version
1004
1014
  version: '0'
1005
1015
  requirements: []
1006
- rubygems_version: 3.1.2
1007
- signing_key:
1016
+ rubygems_version: 3.3.7
1017
+ signing_key:
1008
1018
  specification_version: 4
1009
1019
  summary: Automatic Ruby code style checking tool.
1010
1020
  test_files: []