rubocop 1.69.2 → 1.71.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -2
  4. data/config/default.yml +36 -2
  5. data/lib/rubocop/cli/command/execute_runner.rb +3 -3
  6. data/lib/rubocop/cli/command/show_cops.rb +24 -2
  7. data/lib/rubocop/comment_config.rb +1 -1
  8. data/lib/rubocop/config.rb +13 -4
  9. data/lib/rubocop/config_loader.rb +4 -0
  10. data/lib/rubocop/config_loader_resolver.rb +14 -3
  11. data/lib/rubocop/config_validator.rb +18 -8
  12. data/lib/rubocop/cop/base.rb +6 -0
  13. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  14. data/lib/rubocop/cop/internal_affairs/cop_enabled.rb +85 -0
  15. data/lib/rubocop/cop/internal_affairs/location_expression.rb +2 -1
  16. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +3 -2
  17. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +4 -3
  18. data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +90 -0
  19. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +2 -1
  20. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +5 -4
  21. data/lib/rubocop/cop/internal_affairs.rb +2 -0
  22. data/lib/rubocop/cop/layout/argument_alignment.rb +2 -8
  23. data/lib/rubocop/cop/layout/class_structure.rb +7 -7
  24. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +1 -0
  25. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +1 -1
  26. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
  27. data/lib/rubocop/cop/layout/first_argument_indentation.rb +2 -7
  28. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -7
  29. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -7
  30. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
  31. data/lib/rubocop/cop/layout/hash_alignment.rb +6 -4
  32. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -0
  33. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +7 -1
  34. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +1 -1
  35. data/lib/rubocop/cop/layout/line_length.rb +1 -0
  36. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
  37. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +25 -0
  38. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -0
  39. data/lib/rubocop/cop/layout/redundant_line_break.rb +1 -1
  40. data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
  41. data/lib/rubocop/cop/layout/space_around_keyword.rb +1 -0
  42. data/lib/rubocop/cop/layout/space_around_operators.rb +3 -3
  43. data/lib/rubocop/cop/layout/trailing_whitespace.rb +5 -3
  44. data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +119 -0
  45. data/lib/rubocop/cop/lint/constant_reassignment.rb +152 -0
  46. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -1
  47. data/lib/rubocop/cop/lint/duplicate_set_element.rb +20 -7
  48. data/lib/rubocop/cop/lint/float_comparison.rb +5 -2
  49. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  50. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +23 -5
  51. data/lib/rubocop/cop/lint/mixed_case_range.rb +1 -1
  52. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
  53. data/lib/rubocop/cop/lint/nested_method_definition.rb +5 -1
  54. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +4 -3
  55. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +17 -30
  56. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +2 -1
  57. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +1 -1
  58. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -2
  59. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  60. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +7 -0
  61. data/lib/rubocop/cop/lint/shared_mutable_default.rb +65 -0
  62. data/lib/rubocop/cop/lint/syntax.rb +4 -1
  63. data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +1 -4
  64. data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
  65. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +2 -1
  66. data/lib/rubocop/cop/lint/void.rb +3 -2
  67. data/lib/rubocop/cop/metrics/collection_literal_length.rb +7 -0
  68. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
  69. data/lib/rubocop/cop/metrics/method_length.rb +8 -1
  70. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  71. data/lib/rubocop/cop/mixin/check_line_breakable.rb +7 -7
  72. data/lib/rubocop/cop/mixin/comments_help.rb +2 -0
  73. data/lib/rubocop/cop/mixin/dig_help.rb +1 -1
  74. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -1
  75. data/lib/rubocop/cop/mixin/hash_subset.rb +170 -0
  76. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +26 -16
  77. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
  78. data/lib/rubocop/cop/mixin/statement_modifier.rb +8 -3
  79. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
  80. data/lib/rubocop/cop/mixin/trailing_comma.rb +2 -2
  81. data/lib/rubocop/cop/naming/block_forwarding.rb +1 -1
  82. data/lib/rubocop/cop/security/compound_hash.rb +1 -0
  83. data/lib/rubocop/cop/style/access_modifier_declarations.rb +32 -1
  84. data/lib/rubocop/cop/style/and_or.rb +1 -1
  85. data/lib/rubocop/cop/style/arguments_forwarding.rb +1 -4
  86. data/lib/rubocop/cop/style/array_first_last.rb +18 -2
  87. data/lib/rubocop/cop/style/block_delimiters.rb +6 -19
  88. data/lib/rubocop/cop/style/class_and_module_children.rb +5 -2
  89. data/lib/rubocop/cop/style/collection_methods.rb +1 -1
  90. data/lib/rubocop/cop/style/conditional_assignment.rb +3 -1
  91. data/lib/rubocop/cop/style/each_for_simple_loop.rb +4 -7
  92. data/lib/rubocop/cop/style/empty_else.rb +4 -2
  93. data/lib/rubocop/cop/style/empty_literal.rb +1 -1
  94. data/lib/rubocop/cop/style/empty_method.rb +1 -1
  95. data/lib/rubocop/cop/style/exact_regexp_match.rb +3 -10
  96. data/lib/rubocop/cop/style/exponential_notation.rb +1 -1
  97. data/lib/rubocop/cop/style/fetch_env_var.rb +1 -1
  98. data/lib/rubocop/cop/style/float_division.rb +8 -4
  99. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
  100. data/lib/rubocop/cop/style/hash_each_methods.rb +1 -1
  101. data/lib/rubocop/cop/style/hash_except.rb +9 -148
  102. data/lib/rubocop/cop/style/hash_slice.rb +65 -0
  103. data/lib/rubocop/cop/style/hash_syntax.rb +5 -2
  104. data/lib/rubocop/cop/style/it_assignment.rb +36 -0
  105. data/lib/rubocop/cop/style/map_to_set.rb +3 -2
  106. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +11 -1
  107. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +2 -0
  108. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +2 -1
  109. data/lib/rubocop/cop/style/missing_else.rb +2 -0
  110. data/lib/rubocop/cop/style/multiple_comparison.rb +26 -20
  111. data/lib/rubocop/cop/style/mutable_constant.rb +2 -2
  112. data/lib/rubocop/cop/style/object_then.rb +13 -15
  113. data/lib/rubocop/cop/style/open_struct_use.rb +4 -4
  114. data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
  115. data/lib/rubocop/cop/style/raise_args.rb +6 -4
  116. data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
  117. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +2 -1
  118. data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
  119. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  120. data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
  121. data/lib/rubocop/cop/style/redundant_line_continuation.rb +34 -13
  122. data/lib/rubocop/cop/style/redundant_parentheses.rb +4 -4
  123. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +3 -0
  124. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
  125. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
  126. data/lib/rubocop/cop/style/redundant_self_assignment.rb +6 -5
  127. data/lib/rubocop/cop/style/safe_navigation.rb +1 -1
  128. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +2 -1
  129. data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
  130. data/lib/rubocop/cop/style/single_line_do_end_block.rb +1 -2
  131. data/lib/rubocop/cop/style/single_line_methods.rb +2 -3
  132. data/lib/rubocop/cop/style/slicing_with_range.rb +40 -11
  133. data/lib/rubocop/cop/style/sole_nested_conditional.rb +1 -1
  134. data/lib/rubocop/cop/style/string_methods.rb +1 -1
  135. data/lib/rubocop/cop/style/super_arguments.rb +63 -15
  136. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +4 -1
  137. data/lib/rubocop/cop/style/yoda_condition.rb +8 -4
  138. data/lib/rubocop/cop/style/yoda_expression.rb +1 -0
  139. data/lib/rubocop/cop/util.rb +9 -2
  140. data/lib/rubocop/cops_documentation_generator.rb +13 -13
  141. data/lib/rubocop/directive_comment.rb +9 -8
  142. data/lib/rubocop/formatter/formatter_set.rb +1 -1
  143. data/lib/rubocop/lsp/diagnostic.rb +189 -0
  144. data/lib/rubocop/lsp/logger.rb +2 -2
  145. data/lib/rubocop/lsp/routes.rb +7 -23
  146. data/lib/rubocop/lsp/runtime.rb +15 -49
  147. data/lib/rubocop/lsp/stdin_runner.rb +83 -0
  148. data/lib/rubocop/options.rb +2 -1
  149. data/lib/rubocop/path_util.rb +11 -8
  150. data/lib/rubocop/result_cache.rb +13 -13
  151. data/lib/rubocop/rspec/expect_offense.rb +6 -2
  152. data/lib/rubocop/rspec/shared_contexts.rb +4 -1
  153. data/lib/rubocop/runner.rb +5 -6
  154. data/lib/rubocop/target_finder.rb +1 -0
  155. data/lib/rubocop/target_ruby.rb +15 -0
  156. data/lib/rubocop/version.rb +1 -1
  157. data/lib/rubocop.rb +6 -0
  158. data/lib/ruby_lsp/rubocop/addon.rb +78 -0
  159. data/lib/ruby_lsp/rubocop/wraps_built_in_lsp_runtime.rb +50 -0
  160. metadata +17 -8
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.69.2
4
+ version: 1.71.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
- autorequire:
11
10
  bindir: exe
12
11
  cert_chain: []
13
- date: 2024-12-12 00:00:00.000000000 Z
12
+ date: 2025-01-22 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: json
@@ -266,6 +265,7 @@ files:
266
265
  - lib/rubocop/cop/ignored_node.rb
267
266
  - lib/rubocop/cop/internal_affairs.rb
268
267
  - lib/rubocop/cop/internal_affairs/cop_description.rb
268
+ - lib/rubocop/cop/internal_affairs/cop_enabled.rb
269
269
  - lib/rubocop/cop/internal_affairs/create_empty_file.rb
270
270
  - lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb
271
271
  - lib/rubocop/cop/internal_affairs/example_description.rb
@@ -282,6 +282,7 @@ files:
282
282
  - lib/rubocop/cop/internal_affairs/node_type_predicate.rb
283
283
  - lib/rubocop/cop/internal_affairs/numblock_handler.rb
284
284
  - lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
285
+ - lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb
285
286
  - lib/rubocop/cop/internal_affairs/operator_keyword.rb
286
287
  - lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb
287
288
  - lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
@@ -404,6 +405,7 @@ files:
404
405
  - lib/rubocop/cop/lint/ambiguous_operator_precedence.rb
405
406
  - lib/rubocop/cop/lint/ambiguous_range.rb
406
407
  - lib/rubocop/cop/lint/ambiguous_regexp_literal.rb
408
+ - lib/rubocop/cop/lint/array_literal_in_regexp.rb
407
409
  - lib/rubocop/cop/lint/assignment_in_condition.rb
408
410
  - lib/rubocop/cop/lint/big_decimal_new.rb
409
411
  - lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb
@@ -411,6 +413,7 @@ files:
411
413
  - lib/rubocop/cop/lint/circular_argument_reference.rb
412
414
  - lib/rubocop/cop/lint/constant_definition_in_block.rb
413
415
  - lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb
416
+ - lib/rubocop/cop/lint/constant_reassignment.rb
414
417
  - lib/rubocop/cop/lint/constant_resolution.rb
415
418
  - lib/rubocop/cop/lint/debugger.rb
416
419
  - lib/rubocop/cop/lint/deprecated_class_methods.rb
@@ -510,6 +513,7 @@ files:
510
513
  - lib/rubocop/cop/lint/shadowed_argument.rb
511
514
  - lib/rubocop/cop/lint/shadowed_exception.rb
512
515
  - lib/rubocop/cop/lint/shadowing_outer_local_variable.rb
516
+ - lib/rubocop/cop/lint/shared_mutable_default.rb
513
517
  - lib/rubocop/cop/lint/struct_new_override.rb
514
518
  - lib/rubocop/cop/lint/suppressed_exception.rb
515
519
  - lib/rubocop/cop/lint/symbol_conversion.rb
@@ -592,6 +596,7 @@ files:
592
596
  - lib/rubocop/cop/mixin/gemspec_help.rb
593
597
  - lib/rubocop/cop/mixin/hash_alignment_styles.rb
594
598
  - lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
599
+ - lib/rubocop/cop/mixin/hash_subset.rb
595
600
  - lib/rubocop/cop/mixin/hash_transform_method.rb
596
601
  - lib/rubocop/cop/mixin/heredoc.rb
597
602
  - lib/rubocop/cop/mixin/integer_node.rb
@@ -754,6 +759,7 @@ files:
754
759
  - lib/rubocop/cop/style/hash_each_methods.rb
755
760
  - lib/rubocop/cop/style/hash_except.rb
756
761
  - lib/rubocop/cop/style/hash_like_case.rb
762
+ - lib/rubocop/cop/style/hash_slice.rb
757
763
  - lib/rubocop/cop/style/hash_syntax.rb
758
764
  - lib/rubocop/cop/style/hash_transform_keys.rb
759
765
  - lib/rubocop/cop/style/hash_transform_values.rb
@@ -770,6 +776,7 @@ files:
770
776
  - lib/rubocop/cop/style/inverse_methods.rb
771
777
  - lib/rubocop/cop/style/invertible_unless_condition.rb
772
778
  - lib/rubocop/cop/style/ip_addresses.rb
779
+ - lib/rubocop/cop/style/it_assignment.rb
773
780
  - lib/rubocop/cop/style/keyword_arguments_merging.rb
774
781
  - lib/rubocop/cop/style/keyword_parameters_order.rb
775
782
  - lib/rubocop/cop/style/lambda.rb
@@ -985,11 +992,13 @@ files:
985
992
  - lib/rubocop/formatter/worst_offenders_formatter.rb
986
993
  - lib/rubocop/lockfile.rb
987
994
  - lib/rubocop/lsp.rb
995
+ - lib/rubocop/lsp/diagnostic.rb
988
996
  - lib/rubocop/lsp/logger.rb
989
997
  - lib/rubocop/lsp/routes.rb
990
998
  - lib/rubocop/lsp/runtime.rb
991
999
  - lib/rubocop/lsp/server.rb
992
1000
  - lib/rubocop/lsp/severity.rb
1001
+ - lib/rubocop/lsp/stdin_runner.rb
993
1002
  - lib/rubocop/magic_comment.rb
994
1003
  - lib/rubocop/name_similarity.rb
995
1004
  - lib/rubocop/options.rb
@@ -1030,17 +1039,18 @@ files:
1030
1039
  - lib/rubocop/version.rb
1031
1040
  - lib/rubocop/warning.rb
1032
1041
  - lib/rubocop/yaml_duplication_checker.rb
1042
+ - lib/ruby_lsp/rubocop/addon.rb
1043
+ - lib/ruby_lsp/rubocop/wraps_built_in_lsp_runtime.rb
1033
1044
  homepage: https://github.com/rubocop/rubocop
1034
1045
  licenses:
1035
1046
  - MIT
1036
1047
  metadata:
1037
1048
  homepage_uri: https://rubocop.org/
1038
- changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.69.2
1049
+ changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.71.0
1039
1050
  source_code_uri: https://github.com/rubocop/rubocop/
1040
- documentation_uri: https://docs.rubocop.org/rubocop/1.69/
1051
+ documentation_uri: https://docs.rubocop.org/rubocop/1.71/
1041
1052
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
1042
1053
  rubygems_mfa_required: 'true'
1043
- post_install_message:
1044
1054
  rdoc_options: []
1045
1055
  require_paths:
1046
1056
  - lib
@@ -1055,8 +1065,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1055
1065
  - !ruby/object:Gem::Version
1056
1066
  version: '0'
1057
1067
  requirements: []
1058
- rubygems_version: 3.4.22
1059
- signing_key:
1068
+ rubygems_version: 3.6.2
1060
1069
  specification_version: 4
1061
1070
  summary: Automatic Ruby code style checking tool.
1062
1071
  test_files: []