rubocop 1.41.1 → 1.45.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -2
  4. data/config/default.yml +97 -31
  5. data/lib/rubocop/cli.rb +55 -9
  6. data/lib/rubocop/config.rb +7 -7
  7. data/lib/rubocop/config_loader.rb +12 -15
  8. data/lib/rubocop/config_loader_resolver.rb +8 -5
  9. data/lib/rubocop/cop/base.rb +89 -70
  10. data/lib/rubocop/cop/commissioner.rb +8 -2
  11. data/lib/rubocop/cop/cop.rb +51 -31
  12. data/lib/rubocop/cop/corrector.rb +30 -10
  13. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -6
  14. data/lib/rubocop/cop/gemspec/dependency_version.rb +16 -18
  15. data/lib/rubocop/cop/gemspec/development_dependencies.rb +107 -0
  16. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +11 -3
  17. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  18. data/lib/rubocop/cop/layout/block_end_newline.rb +7 -1
  19. data/lib/rubocop/cop/layout/class_structure.rb +31 -23
  20. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +2 -6
  21. data/lib/rubocop/cop/layout/comment_indentation.rb +3 -1
  22. data/lib/rubocop/cop/layout/first_argument_indentation.rb +1 -1
  23. data/lib/rubocop/cop/layout/heredoc_indentation.rb +6 -9
  24. data/lib/rubocop/cop/layout/indentation_style.rb +4 -1
  25. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +6 -6
  26. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
  27. data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
  28. data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
  29. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +11 -13
  30. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +4 -4
  31. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +5 -4
  32. data/lib/rubocop/cop/layout/trailing_whitespace.rb +5 -2
  33. data/lib/rubocop/cop/lint/ambiguous_operator.rb +4 -0
  34. data/lib/rubocop/cop/lint/debugger.rb +8 -27
  35. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +62 -112
  36. data/lib/rubocop/cop/lint/else_layout.rb +2 -6
  37. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +14 -7
  38. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +15 -17
  39. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
  40. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
  41. data/lib/rubocop/cop/lint/nested_method_definition.rb +8 -5
  42. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +19 -0
  43. data/lib/rubocop/cop/lint/redundant_require_statement.rb +11 -1
  44. data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -0
  45. data/lib/rubocop/cop/lint/require_parentheses.rb +3 -1
  46. data/lib/rubocop/cop/lint/unused_method_argument.rb +2 -1
  47. data/lib/rubocop/cop/lint/useless_access_modifier.rb +7 -4
  48. data/lib/rubocop/cop/lint/useless_method_definition.rb +3 -3
  49. data/lib/rubocop/cop/lint/useless_rescue.rb +85 -0
  50. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +14 -4
  51. data/lib/rubocop/cop/lint/void.rb +19 -10
  52. data/lib/rubocop/cop/metrics/block_length.rb +1 -1
  53. data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
  54. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
  55. data/lib/rubocop/cop/metrics/parameter_lists.rb +27 -0
  56. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  57. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +3 -6
  58. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  59. data/lib/rubocop/cop/mixin/allowed_methods.rb +3 -1
  60. data/lib/rubocop/cop/mixin/annotation_comment.rb +1 -1
  61. data/lib/rubocop/cop/mixin/comments_help.rb +5 -3
  62. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +57 -23
  63. data/lib/rubocop/cop/mixin/line_length_help.rb +3 -1
  64. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
  65. data/lib/rubocop/cop/mixin/statement_modifier.rb +1 -0
  66. data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -3
  67. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  68. data/lib/rubocop/cop/naming/block_forwarding.rb +4 -0
  69. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +1 -1
  70. data/lib/rubocop/cop/registry.rb +34 -29
  71. data/lib/rubocop/cop/security/compound_hash.rb +2 -1
  72. data/lib/rubocop/cop/style/access_modifier_declarations.rb +26 -11
  73. data/lib/rubocop/cop/style/arguments_forwarding.rb +1 -0
  74. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  75. data/lib/rubocop/cop/style/block_delimiters.rb +8 -2
  76. data/lib/rubocop/cop/style/class_and_module_children.rb +3 -10
  77. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  78. data/lib/rubocop/cop/style/comparable_clamp.rb +125 -0
  79. data/lib/rubocop/cop/style/concat_array_literals.rb +22 -2
  80. data/lib/rubocop/cop/style/conditional_assignment.rb +0 -6
  81. data/lib/rubocop/cop/style/documentation.rb +1 -1
  82. data/lib/rubocop/cop/style/documentation_method.rb +6 -0
  83. data/lib/rubocop/cop/style/guard_clause.rb +11 -7
  84. data/lib/rubocop/cop/style/hash_each_methods.rb +13 -1
  85. data/lib/rubocop/cop/style/hash_syntax.rb +11 -7
  86. data/lib/rubocop/cop/style/identical_conditional_branches.rb +15 -0
  87. data/lib/rubocop/cop/style/infinite_loop.rb +2 -5
  88. data/lib/rubocop/cop/style/invertible_unless_condition.rb +114 -0
  89. data/lib/rubocop/cop/style/map_to_set.rb +61 -0
  90. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +23 -14
  91. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +2 -0
  92. data/lib/rubocop/cop/style/method_def_parentheses.rb +11 -4
  93. data/lib/rubocop/cop/style/min_max_comparison.rb +83 -0
  94. data/lib/rubocop/cop/style/missing_else.rb +13 -1
  95. data/lib/rubocop/cop/style/multiline_if_modifier.rb +0 -4
  96. data/lib/rubocop/cop/style/multiline_memoization.rb +2 -2
  97. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +18 -3
  98. data/lib/rubocop/cop/style/negated_if_else_condition.rb +1 -5
  99. data/lib/rubocop/cop/style/numbered_parameters_limit.rb +11 -3
  100. data/lib/rubocop/cop/style/one_line_conditional.rb +3 -6
  101. data/lib/rubocop/cop/style/operator_method_call.rb +16 -2
  102. data/lib/rubocop/cop/style/parallel_assignment.rb +3 -1
  103. data/lib/rubocop/cop/style/redundant_condition.rb +16 -1
  104. data/lib/rubocop/cop/style/redundant_conditional.rb +0 -4
  105. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +16 -10
  106. data/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb +58 -0
  107. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +2 -1
  108. data/lib/rubocop/cop/style/redundant_string_escape.rb +4 -2
  109. data/lib/rubocop/cop/style/require_order.rb +6 -11
  110. data/lib/rubocop/cop/style/select_by_regexp.rb +6 -2
  111. data/lib/rubocop/cop/style/self_assignment.rb +2 -2
  112. data/lib/rubocop/cop/style/semicolon.rb +24 -2
  113. data/lib/rubocop/cop/style/signal_exception.rb +8 -6
  114. data/lib/rubocop/cop/style/string_hash_keys.rb +4 -1
  115. data/lib/rubocop/cop/style/symbol_array.rb +1 -1
  116. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +4 -4
  117. data/lib/rubocop/cop/style/word_array.rb +42 -1
  118. data/lib/rubocop/cop/style/yoda_condition.rb +12 -5
  119. data/lib/rubocop/cop/style/yoda_expression.rb +90 -0
  120. data/lib/rubocop/cop/style/zero_length_predicate.rb +31 -14
  121. data/lib/rubocop/cop/team.rb +48 -43
  122. data/lib/rubocop/cop/variable_force/scope.rb +3 -3
  123. data/lib/rubocop/cop/variable_force/variable_table.rb +3 -1
  124. data/lib/rubocop/cop/variable_force.rb +1 -4
  125. data/lib/rubocop/formatter.rb +0 -1
  126. data/lib/rubocop/options.rb +22 -1
  127. data/lib/rubocop/path_util.rb +17 -7
  128. data/lib/rubocop/result_cache.rb +1 -1
  129. data/lib/rubocop/rspec/expect_offense.rb +6 -4
  130. data/lib/rubocop/runner.rb +50 -7
  131. data/lib/rubocop/server/cache.rb +10 -3
  132. data/lib/rubocop/server/cli.rb +37 -18
  133. data/lib/rubocop/server/client_command/exec.rb +1 -1
  134. data/lib/rubocop/server/client_command/start.rb +6 -1
  135. data/lib/rubocop/server/core.rb +23 -8
  136. data/lib/rubocop/target_ruby.rb +0 -1
  137. data/lib/rubocop/version.rb +1 -1
  138. data/lib/rubocop.rb +8 -0
  139. metadata +21 -33
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.41.1
4
+ version: 1.45.1
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-12-22 00:00:00.000000000 Z
13
+ date: 2023-02-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 3.1.2.1
49
+ version: 3.2.0.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 3.1.2.1
56
+ version: 3.2.0.0
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rainbow
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -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'
@@ -154,7 +154,7 @@ dependencies:
154
154
  requirements:
155
155
  - - ">="
156
156
  - !ruby/object:Gem::Version
157
- version: 1.4.0
157
+ version: 2.4.0
158
158
  - - "<"
159
159
  - !ruby/object:Gem::Version
160
160
  version: '3.0'
@@ -164,27 +164,7 @@ dependencies:
164
164
  requirements:
165
165
  - - ">="
166
166
  - !ruby/object:Gem::Version
167
- version: 1.4.0
168
- - - "<"
169
- - !ruby/object:Gem::Version
170
- version: '3.0'
171
- - !ruby/object:Gem::Dependency
172
- name: bundler
173
- requirement: !ruby/object:Gem::Requirement
174
- requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- version: 1.15.0
178
- - - "<"
179
- - !ruby/object:Gem::Version
180
- version: '3.0'
181
- type: :development
182
- prerelease: false
183
- version_requirements: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: 1.15.0
167
+ version: 2.4.0
188
168
  - - "<"
189
169
  - !ruby/object:Gem::Version
190
170
  version: '3.0'
@@ -275,6 +255,7 @@ files:
275
255
  - lib/rubocop/cop/force.rb
276
256
  - lib/rubocop/cop/gemspec/dependency_version.rb
277
257
  - lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb
258
+ - lib/rubocop/cop/gemspec/development_dependencies.rb
278
259
  - lib/rubocop/cop/gemspec/duplicated_assignment.rb
279
260
  - lib/rubocop/cop/gemspec/ordered_dependencies.rb
280
261
  - lib/rubocop/cop/gemspec/require_mfa.rb
@@ -539,6 +520,7 @@ files:
539
520
  - lib/rubocop/cop/lint/useless_assignment.rb
540
521
  - lib/rubocop/cop/lint/useless_else_without_rescue.rb
541
522
  - lib/rubocop/cop/lint/useless_method_definition.rb
523
+ - lib/rubocop/cop/lint/useless_rescue.rb
542
524
  - lib/rubocop/cop/lint/useless_ruby2_keywords.rb
543
525
  - lib/rubocop/cop/lint/useless_setter_call.rb
544
526
  - lib/rubocop/cop/lint/useless_times.rb
@@ -691,6 +673,7 @@ files:
691
673
  - lib/rubocop/cop/style/command_literal.rb
692
674
  - lib/rubocop/cop/style/comment_annotation.rb
693
675
  - lib/rubocop/cop/style/commented_keyword.rb
676
+ - lib/rubocop/cop/style/comparable_clamp.rb
694
677
  - lib/rubocop/cop/style/concat_array_literals.rb
695
678
  - lib/rubocop/cop/style/conditional_assignment.rb
696
679
  - lib/rubocop/cop/style/constant_visibility.rb
@@ -752,6 +735,7 @@ files:
752
735
  - lib/rubocop/cop/style/infinite_loop.rb
753
736
  - lib/rubocop/cop/style/inline_comment.rb
754
737
  - lib/rubocop/cop/style/inverse_methods.rb
738
+ - lib/rubocop/cop/style/invertible_unless_condition.rb
755
739
  - lib/rubocop/cop/style/ip_addresses.rb
756
740
  - lib/rubocop/cop/style/keyword_parameters_order.rb
757
741
  - lib/rubocop/cop/style/lambda.rb
@@ -760,6 +744,7 @@ files:
760
744
  - lib/rubocop/cop/style/magic_comment_format.rb
761
745
  - lib/rubocop/cop/style/map_compact_with_conditional_block.rb
762
746
  - lib/rubocop/cop/style/map_to_hash.rb
747
+ - lib/rubocop/cop/style/map_to_set.rb
763
748
  - lib/rubocop/cop/style/method_call_with_args_parentheses.rb
764
749
  - lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb
765
750
  - lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb
@@ -767,6 +752,7 @@ files:
767
752
  - lib/rubocop/cop/style/method_called_on_do_end_block.rb
768
753
  - lib/rubocop/cop/style/method_def_parentheses.rb
769
754
  - lib/rubocop/cop/style/min_max.rb
755
+ - lib/rubocop/cop/style/min_max_comparison.rb
770
756
  - lib/rubocop/cop/style/missing_else.rb
771
757
  - lib/rubocop/cop/style/missing_respond_to_missing.rb
772
758
  - lib/rubocop/cop/style/mixin_grouping.rb
@@ -831,6 +817,7 @@ files:
831
817
  - lib/rubocop/cop/style/redundant_fetch_block.rb
832
818
  - lib/rubocop/cop/style/redundant_file_extension_in_require.rb
833
819
  - lib/rubocop/cop/style/redundant_freeze.rb
820
+ - lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb
834
821
  - lib/rubocop/cop/style/redundant_initialize.rb
835
822
  - lib/rubocop/cop/style/redundant_interpolation.rb
836
823
  - lib/rubocop/cop/style/redundant_parentheses.rb
@@ -898,6 +885,7 @@ files:
898
885
  - lib/rubocop/cop/style/while_until_modifier.rb
899
886
  - lib/rubocop/cop/style/word_array.rb
900
887
  - lib/rubocop/cop/style/yoda_condition.rb
888
+ - lib/rubocop/cop/style/yoda_expression.rb
901
889
  - lib/rubocop/cop/style/zero_length_predicate.rb
902
890
  - lib/rubocop/cop/team.rb
903
891
  - lib/rubocop/cop/util.rb
@@ -992,10 +980,10 @@ metadata:
992
980
  homepage_uri: https://rubocop.org/
993
981
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
994
982
  source_code_uri: https://github.com/rubocop/rubocop/
995
- documentation_uri: https://docs.rubocop.org/rubocop/1.41/
983
+ documentation_uri: https://docs.rubocop.org/rubocop/1.45/
996
984
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
997
985
  rubygems_mfa_required: 'true'
998
- post_install_message:
986
+ post_install_message:
999
987
  rdoc_options: []
1000
988
  require_paths:
1001
989
  - lib
@@ -1010,8 +998,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1010
998
  - !ruby/object:Gem::Version
1011
999
  version: '0'
1012
1000
  requirements: []
1013
- rubygems_version: 3.1.2
1014
- signing_key:
1001
+ rubygems_version: 3.3.7
1002
+ signing_key:
1015
1003
  specification_version: 4
1016
1004
  summary: Automatic Ruby code style checking tool.
1017
1005
  test_files: []