rubocop 1.50.2 → 1.62.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (339) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +7 -5
  4. data/assets/output.css.erb +159 -0
  5. data/assets/output.html.erb +1 -160
  6. data/config/default.yml +196 -28
  7. data/config/obsoletion.yml +5 -0
  8. data/lib/rubocop/cli/command/auto_generate_config.rb +22 -8
  9. data/lib/rubocop/cli/command/lsp.rb +19 -0
  10. data/lib/rubocop/cli.rb +10 -2
  11. data/lib/rubocop/config.rb +8 -2
  12. data/lib/rubocop/config_finder.rb +14 -4
  13. data/lib/rubocop/config_loader.rb +0 -1
  14. data/lib/rubocop/config_loader_resolver.rb +4 -3
  15. data/lib/rubocop/config_obsoletion/parameter_rule.rb +9 -1
  16. data/lib/rubocop/config_obsoletion.rb +13 -10
  17. data/lib/rubocop/config_validator.rb +14 -7
  18. data/lib/rubocop/cop/autocorrect_logic.rb +9 -2
  19. data/lib/rubocop/cop/base.rb +23 -4
  20. data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -0
  21. data/lib/rubocop/cop/bundler/duplicated_group.rb +127 -0
  22. data/lib/rubocop/cop/bundler/gem_comment.rb +3 -3
  23. data/lib/rubocop/cop/bundler/gem_version.rb +2 -2
  24. data/lib/rubocop/cop/bundler/ordered_gems.rb +9 -1
  25. data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
  26. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +4 -8
  27. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +5 -13
  28. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +7 -4
  29. data/lib/rubocop/cop/exclude_limit.rb +1 -1
  30. data/lib/rubocop/cop/gemspec/dependency_version.rb +2 -2
  31. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +2 -2
  32. data/lib/rubocop/cop/gemspec/development_dependencies.rb +1 -1
  33. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +9 -1
  34. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -1
  35. data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
  36. data/lib/rubocop/cop/internal_affairs/cop_description.rb +32 -8
  37. data/lib/rubocop/cop/internal_affairs/example_description.rb +45 -24
  38. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -1
  39. data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +8 -6
  40. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
  41. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +53 -0
  42. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +127 -33
  43. data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
  44. data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +11 -2
  45. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -0
  46. data/lib/rubocop/cop/internal_affairs.rb +2 -0
  47. data/lib/rubocop/cop/layout/argument_alignment.rb +1 -1
  48. data/lib/rubocop/cop/layout/class_structure.rb +7 -0
  49. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -2
  50. data/lib/rubocop/cop/layout/dot_position.rb +1 -5
  51. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +42 -9
  52. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
  53. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +27 -4
  54. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -0
  55. data/lib/rubocop/cop/layout/end_alignment.rb +15 -3
  56. data/lib/rubocop/cop/layout/extra_spacing.rb +4 -10
  57. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +22 -7
  58. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +1 -1
  59. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +4 -4
  60. data/lib/rubocop/cop/layout/heredoc_indentation.rb +4 -1
  61. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  62. data/lib/rubocop/cop/layout/indentation_width.rb +3 -3
  63. data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
  64. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +17 -9
  65. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +1 -1
  66. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -0
  67. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +18 -3
  68. data/lib/rubocop/cop/layout/redundant_line_break.rb +30 -7
  69. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +4 -4
  70. data/lib/rubocop/cop/layout/single_line_block_chain.rb +5 -0
  71. data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
  72. data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
  73. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +2 -2
  74. data/lib/rubocop/cop/layout/space_around_operators.rb +53 -21
  75. data/lib/rubocop/cop/layout/space_before_block_braces.rb +19 -10
  76. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +2 -0
  77. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +1 -1
  78. data/lib/rubocop/cop/layout/space_inside_parens.rb +1 -1
  79. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
  80. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +5 -0
  81. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +13 -1
  82. data/lib/rubocop/cop/lint/assignment_in_condition.rb +4 -4
  83. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +2 -2
  84. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +1 -1
  85. data/lib/rubocop/cop/lint/debugger.rb +19 -5
  86. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -1
  87. data/lib/rubocop/cop/lint/duplicate_methods.rb +1 -1
  88. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +46 -19
  89. data/lib/rubocop/cop/lint/empty_block.rb +1 -1
  90. data/lib/rubocop/cop/lint/empty_conditional_body.rb +1 -1
  91. data/lib/rubocop/cop/lint/erb_new_arguments.rb +6 -7
  92. data/lib/rubocop/cop/lint/float_comparison.rb +10 -0
  93. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
  94. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
  95. data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
  96. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -3
  97. data/lib/rubocop/cop/lint/inherit_exception.rb +9 -0
  98. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +56 -0
  99. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
  100. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +85 -0
  101. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +1 -1
  102. data/lib/rubocop/cop/lint/missing_super.rb +34 -5
  103. data/lib/rubocop/cop/lint/mixed_case_range.rb +111 -0
  104. data/lib/rubocop/cop/lint/next_without_accumulator.rb +6 -21
  105. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +10 -7
  106. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -5
  107. data/lib/rubocop/cop/lint/number_conversion.rb +14 -4
  108. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -2
  109. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +0 -1
  110. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +2 -2
  111. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
  112. data/lib/rubocop/cop/lint/redundant_require_statement.rb +12 -3
  113. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +72 -8
  114. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -1
  115. data/lib/rubocop/cop/lint/redundant_with_index.rb +3 -2
  116. data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -2
  117. data/lib/rubocop/cop/lint/rescue_type.rb +1 -3
  118. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +14 -8
  119. data/lib/rubocop/cop/lint/script_permission.rb +3 -3
  120. data/lib/rubocop/cop/lint/self_assignment.rb +38 -0
  121. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -2
  122. data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -0
  123. data/lib/rubocop/cop/lint/shadowed_exception.rb +5 -11
  124. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +7 -1
  125. data/lib/rubocop/cop/lint/struct_new_override.rb +12 -12
  126. data/lib/rubocop/cop/lint/suppressed_exception.rb +2 -2
  127. data/lib/rubocop/cop/lint/symbol_conversion.rb +8 -3
  128. data/lib/rubocop/cop/lint/syntax.rb +6 -3
  129. data/lib/rubocop/cop/lint/to_enum_arguments.rb +12 -5
  130. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +23 -9
  131. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
  132. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +2 -2
  133. data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -2
  134. data/lib/rubocop/cop/lint/useless_assignment.rb +94 -10
  135. data/lib/rubocop/cop/lint/useless_times.rb +2 -2
  136. data/lib/rubocop/cop/lint/void.rb +97 -11
  137. data/lib/rubocop/cop/metrics/abc_size.rb +3 -3
  138. data/lib/rubocop/cop/metrics/block_length.rb +1 -1
  139. data/lib/rubocop/cop/metrics/class_length.rb +8 -3
  140. data/lib/rubocop/cop/metrics/method_length.rb +1 -1
  141. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -2
  142. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +32 -4
  143. data/lib/rubocop/cop/migration/department_name.rb +2 -2
  144. data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
  145. data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
  146. data/lib/rubocop/cop/mixin/comments_help.rb +19 -11
  147. data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
  148. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  149. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  150. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +14 -11
  151. data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
  152. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +4 -3
  153. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  154. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +6 -8
  155. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
  156. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
  157. data/lib/rubocop/cop/mixin/string_help.rb +4 -2
  158. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  159. data/lib/rubocop/cop/naming/block_forwarding.rb +13 -5
  160. data/lib/rubocop/cop/naming/constant_name.rb +2 -3
  161. data/lib/rubocop/cop/naming/file_name.rb +1 -1
  162. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -1
  163. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +26 -11
  164. data/lib/rubocop/cop/naming/predicate_name.rb +2 -2
  165. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +11 -3
  166. data/lib/rubocop/cop/naming/variable_name.rb +6 -1
  167. data/lib/rubocop/cop/registry.rb +1 -1
  168. data/lib/rubocop/cop/security/open.rb +2 -2
  169. data/lib/rubocop/cop/style/access_modifier_declarations.rb +2 -2
  170. data/lib/rubocop/cop/style/accessor_grouping.rb +6 -2
  171. data/lib/rubocop/cop/style/alias.rb +9 -8
  172. data/lib/rubocop/cop/style/arguments_forwarding.rb +411 -63
  173. data/lib/rubocop/cop/style/array_first_last.rb +64 -0
  174. data/lib/rubocop/cop/style/array_intersect.rb +13 -5
  175. data/lib/rubocop/cop/style/attr.rb +11 -1
  176. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
  177. data/lib/rubocop/cop/style/begin_block.rb +1 -2
  178. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +2 -2
  179. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  180. data/lib/rubocop/cop/style/block_delimiters.rb +5 -4
  181. data/lib/rubocop/cop/style/case_like_if.rb +5 -5
  182. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  183. data/lib/rubocop/cop/style/class_check.rb +1 -0
  184. data/lib/rubocop/cop/style/class_equality_comparison.rb +24 -39
  185. data/lib/rubocop/cop/style/class_vars.rb +3 -3
  186. data/lib/rubocop/cop/style/collection_compact.rb +32 -12
  187. data/lib/rubocop/cop/style/collection_methods.rb +2 -0
  188. data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
  189. data/lib/rubocop/cop/style/combinable_loops.rb +36 -8
  190. data/lib/rubocop/cop/style/commented_keyword.rb +5 -2
  191. data/lib/rubocop/cop/style/concat_array_literals.rb +2 -1
  192. data/lib/rubocop/cop/style/conditional_assignment.rb +11 -10
  193. data/lib/rubocop/cop/style/copyright.rb +5 -2
  194. data/lib/rubocop/cop/style/date_time.rb +5 -4
  195. data/lib/rubocop/cop/style/dir.rb +1 -1
  196. data/lib/rubocop/cop/style/dir_empty.rb +8 -14
  197. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
  198. data/lib/rubocop/cop/style/documentation.rb +1 -1
  199. data/lib/rubocop/cop/style/each_for_simple_loop.rb +7 -7
  200. data/lib/rubocop/cop/style/each_with_object.rb +2 -2
  201. data/lib/rubocop/cop/style/empty_case_condition.rb +6 -1
  202. data/lib/rubocop/cop/style/empty_literal.rb +1 -1
  203. data/lib/rubocop/cop/style/eval_with_location.rb +8 -19
  204. data/lib/rubocop/cop/style/exact_regexp_match.rb +69 -0
  205. data/lib/rubocop/cop/style/explicit_block_argument.rb +2 -2
  206. data/lib/rubocop/cop/style/file_read.rb +2 -2
  207. data/lib/rubocop/cop/style/for.rb +3 -1
  208. data/lib/rubocop/cop/style/format_string.rb +24 -3
  209. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -1
  210. data/lib/rubocop/cop/style/guard_clause.rb +28 -0
  211. data/lib/rubocop/cop/style/hash_conversion.rb +10 -0
  212. data/lib/rubocop/cop/style/hash_each_methods.rb +106 -33
  213. data/lib/rubocop/cop/style/hash_except.rb +21 -9
  214. data/lib/rubocop/cop/style/hash_syntax.rb +6 -2
  215. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  216. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  217. data/lib/rubocop/cop/style/identical_conditional_branches.rb +34 -5
  218. data/lib/rubocop/cop/style/if_inside_else.rb +6 -0
  219. data/lib/rubocop/cop/style/if_unless_modifier.rb +3 -0
  220. data/lib/rubocop/cop/style/if_with_semicolon.rb +2 -2
  221. data/lib/rubocop/cop/style/inverse_methods.rb +14 -13
  222. data/lib/rubocop/cop/style/invertible_unless_condition.rb +54 -8
  223. data/lib/rubocop/cop/style/lambda.rb +3 -3
  224. data/lib/rubocop/cop/style/lambda_call.rb +5 -0
  225. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +8 -10
  226. data/lib/rubocop/cop/style/map_to_hash.rb +17 -7
  227. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +24 -9
  228. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +2 -4
  229. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +20 -0
  230. data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
  231. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +2 -2
  232. data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
  233. data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
  234. data/lib/rubocop/cop/style/multiline_method_signature.rb +10 -1
  235. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +6 -4
  236. data/lib/rubocop/cop/style/multiple_comparison.rb +14 -0
  237. data/lib/rubocop/cop/style/nested_ternary_operator.rb +3 -11
  238. data/lib/rubocop/cop/style/next.rb +1 -1
  239. data/lib/rubocop/cop/style/nil_comparison.rb +2 -0
  240. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
  241. data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
  242. data/lib/rubocop/cop/style/object_then.rb +5 -3
  243. data/lib/rubocop/cop/style/open_struct_use.rb +1 -1
  244. data/lib/rubocop/cop/style/operator_method_call.rb +8 -2
  245. data/lib/rubocop/cop/style/parallel_assignment.rb +3 -5
  246. data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -0
  247. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  248. data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
  249. data/lib/rubocop/cop/style/raise_args.rb +4 -1
  250. data/lib/rubocop/cop/style/redundant_argument.rb +10 -4
  251. data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
  252. data/lib/rubocop/cop/style/redundant_assignment.rb +10 -2
  253. data/lib/rubocop/cop/style/redundant_begin.rb +10 -2
  254. data/lib/rubocop/cop/style/redundant_conditional.rb +2 -10
  255. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +39 -0
  256. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +93 -5
  257. data/lib/rubocop/cop/style/redundant_each.rb +7 -4
  258. data/lib/rubocop/cop/style/redundant_exception.rb +32 -12
  259. data/lib/rubocop/cop/style/redundant_fetch_block.rb +3 -3
  260. data/lib/rubocop/cop/style/redundant_filter_chain.rb +118 -0
  261. data/lib/rubocop/cop/style/redundant_line_continuation.rb +32 -8
  262. data/lib/rubocop/cop/style/redundant_parentheses.rb +72 -23
  263. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +100 -0
  264. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
  265. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +2 -1
  266. data/lib/rubocop/cop/style/redundant_return.rb +14 -3
  267. data/lib/rubocop/cop/style/redundant_self.rb +17 -2
  268. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +8 -1
  269. data/lib/rubocop/cop/style/redundant_sort.rb +10 -9
  270. data/lib/rubocop/cop/style/redundant_sort_by.rb +2 -2
  271. data/lib/rubocop/cop/style/redundant_string_escape.rb +3 -1
  272. data/lib/rubocop/cop/style/regexp_literal.rb +11 -2
  273. data/lib/rubocop/cop/style/require_order.rb +11 -5
  274. data/lib/rubocop/cop/style/rescue_modifier.rb +1 -3
  275. data/lib/rubocop/cop/style/return_nil.rb +6 -2
  276. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +95 -0
  277. data/lib/rubocop/cop/style/sample.rb +3 -4
  278. data/lib/rubocop/cop/style/select_by_regexp.rb +22 -11
  279. data/lib/rubocop/cop/style/self_assignment.rb +1 -1
  280. data/lib/rubocop/cop/style/semicolon.rb +20 -4
  281. data/lib/rubocop/cop/style/signal_exception.rb +1 -1
  282. data/lib/rubocop/cop/style/single_argument_dig.rb +7 -3
  283. data/lib/rubocop/cop/style/single_line_do_end_block.rb +67 -0
  284. data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
  285. data/lib/rubocop/cop/style/slicing_with_range.rb +76 -10
  286. data/lib/rubocop/cop/style/sole_nested_conditional.rb +6 -2
  287. data/lib/rubocop/cop/style/special_global_vars.rb +3 -4
  288. data/lib/rubocop/cop/style/string_chars.rb +1 -0
  289. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
  290. data/lib/rubocop/cop/style/strip.rb +7 -4
  291. data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
  292. data/lib/rubocop/cop/style/symbol_array.rb +35 -15
  293. data/lib/rubocop/cop/style/symbol_proc.rb +36 -0
  294. data/lib/rubocop/cop/style/unpack_first.rb +11 -14
  295. data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
  296. data/lib/rubocop/cop/style/yoda_condition.rb +4 -2
  297. data/lib/rubocop/cop/style/yoda_expression.rb +8 -7
  298. data/lib/rubocop/cop/team.rb +1 -1
  299. data/lib/rubocop/cop/util.rb +1 -1
  300. data/lib/rubocop/cop/utils/regexp_ranges.rb +113 -0
  301. data/lib/rubocop/cop/variable_force/assignment.rb +45 -4
  302. data/lib/rubocop/cop/variable_force/variable_table.rb +2 -2
  303. data/lib/rubocop/cop/variable_force.rb +1 -0
  304. data/lib/rubocop/cops_documentation_generator.rb +16 -4
  305. data/lib/rubocop/directive_comment.rb +10 -8
  306. data/lib/rubocop/ext/regexp_node.rb +9 -4
  307. data/lib/rubocop/ext/regexp_parser.rb +4 -1
  308. data/lib/rubocop/file_finder.rb +4 -7
  309. data/lib/rubocop/formatter/disabled_config_formatter.rb +17 -6
  310. data/lib/rubocop/formatter/html_formatter.rb +35 -14
  311. data/lib/rubocop/formatter/json_formatter.rb +0 -1
  312. data/lib/rubocop/formatter/junit_formatter.rb +1 -1
  313. data/lib/rubocop/formatter/offense_count_formatter.rb +12 -2
  314. data/lib/rubocop/formatter.rb +1 -1
  315. data/lib/rubocop/lsp/logger.rb +22 -0
  316. data/lib/rubocop/lsp/routes.rb +246 -0
  317. data/lib/rubocop/lsp/runtime.rb +99 -0
  318. data/lib/rubocop/lsp/server.rb +71 -0
  319. data/lib/rubocop/lsp/severity.rb +27 -0
  320. data/lib/rubocop/lsp.rb +29 -0
  321. data/lib/rubocop/magic_comment.rb +13 -11
  322. data/lib/rubocop/options.rb +22 -9
  323. data/lib/rubocop/path_util.rb +6 -2
  324. data/lib/rubocop/result_cache.rb +5 -2
  325. data/lib/rubocop/rspec/cop_helper.rb +8 -2
  326. data/lib/rubocop/rspec/expect_offense.rb +8 -8
  327. data/lib/rubocop/rspec/shared_contexts.rb +42 -18
  328. data/lib/rubocop/rspec/support.rb +2 -0
  329. data/lib/rubocop/runner.rb +15 -6
  330. data/lib/rubocop/server/cache.rb +1 -1
  331. data/lib/rubocop/server/client_command/exec.rb +3 -3
  332. data/lib/rubocop/server/server_command/exec.rb +0 -1
  333. data/lib/rubocop/string_interpreter.rb +3 -3
  334. data/lib/rubocop/target_finder.rb +91 -81
  335. data/lib/rubocop/target_ruby.rb +85 -78
  336. data/lib/rubocop/version.rb +27 -8
  337. data/lib/rubocop.rb +19 -0
  338. metadata +56 -14
  339. /data/lib/rubocop/formatter/{git_hub_actions_formatter.rb → github_actions_formatter.rb} +0 -0
data/config/default.yml CHANGED
@@ -30,6 +30,7 @@ AllCops:
30
30
  - '**/*.rbx'
31
31
  - '**/*.ru'
32
32
  - '**/*.ruby'
33
+ - '**/*.schema'
33
34
  - '**/*.spec'
34
35
  - '**/*.thor'
35
36
  - '**/*.watchr'
@@ -55,6 +56,7 @@ AllCops:
55
56
  - '**/Puppetfile'
56
57
  - '**/Rakefile'
57
58
  - '**/rakefile'
59
+ - '**/Schemafile'
58
60
  - '**/Snapfile'
59
61
  - '**/Steepfile'
60
62
  - '**/Thorfile'
@@ -140,8 +142,14 @@ AllCops:
140
142
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
141
143
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
142
144
  # Ruby version is still unresolved, RuboCop will use the oldest officially
143
- # supported Ruby version (currently Ruby 2.6).
145
+ # supported Ruby version (currently Ruby 2.7).
144
146
  TargetRubyVersion: ~
147
+ # You can specify the parser engine. There are two options available:
148
+ # - `parser_whitequark` ... https://github.com/whitequark/parser
149
+ # - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
150
+ # By default, `parser` is used. For the `TargetRubyVersion` value, `parser` can be specified for versions `2.0` and above.
151
+ # `parser_prism` can be specified for versions `3.3` and above. `parser_prism` is faster but still considered experimental.
152
+ ParserEngine: parser_whitequark
145
153
  # Determines if a notification for extension libraries should be shown when
146
154
  # rubocop is run. Keys are the name of the extension, and values are an array
147
155
  # of gems in the Gemfile that the extension is suggested for, if not already
@@ -154,6 +162,7 @@ AllCops:
154
162
  rubocop-rake: [rake]
155
163
  rubocop-graphql: [graphql]
156
164
  rubocop-capybara: [capybara]
165
+ rubocop-factory_bot: [factory_bot, factory_bot_rails]
157
166
  # Enable/Disable checking the methods extended by Active Support.
158
167
  ActiveSupportExtensionsEnabled: false
159
168
 
@@ -170,6 +179,16 @@ Bundler/DuplicatedGem:
170
179
  - '**/Gemfile'
171
180
  - '**/gems.rb'
172
181
 
182
+ Bundler/DuplicatedGroup:
183
+ Description: 'Checks for duplicate group entries in Gemfile.'
184
+ Enabled: true
185
+ Severity: warning
186
+ VersionAdded: '1.56'
187
+ Include:
188
+ - '**/*.gemfile'
189
+ - '**/Gemfile'
190
+ - '**/gems.rb'
191
+
173
192
  Bundler/GemComment:
174
193
  Description: 'Add a comment describing each gem.'
175
194
  Enabled: false
@@ -466,7 +485,9 @@ Layout/ClassStructure:
466
485
  Description: 'Enforces a configured order of definitions within a class body.'
467
486
  StyleGuide: '#consistent-classes'
468
487
  Enabled: false
488
+ SafeAutoCorrect: false
469
489
  VersionAdded: '0.52'
490
+ VersionChanged: '1.53'
470
491
  Categories:
471
492
  module_inclusion:
472
493
  - include
@@ -541,7 +562,9 @@ Layout/ElseAlignment:
541
562
  Layout/EmptyComment:
542
563
  Description: 'Checks empty comment.'
543
564
  Enabled: true
565
+ AutoCorrect: contextual
544
566
  VersionAdded: '0.53'
567
+ VersionChanged: '1.61'
545
568
  AllowBorderComment: true
546
569
  AllowMarginComment: true
547
570
 
@@ -574,6 +597,8 @@ Layout/EmptyLineBetweenDefs:
574
597
  EmptyLineBetweenMethodDefs: true
575
598
  EmptyLineBetweenClassDefs: true
576
599
  EmptyLineBetweenModuleDefs: true
600
+ # `DefLikeMacros` takes the name of any macro that you want to treat like a def.
601
+ DefLikeMacros: []
577
602
  # `AllowAdjacentOneLineDefs` means that single line method definitions don't
578
603
  # need an empty line between them. `true` by default.
579
604
  AllowAdjacentOneLineDefs: true
@@ -1334,6 +1359,10 @@ Layout/SpaceAroundOperators:
1334
1359
  SupportedStylesForExponentOperator:
1335
1360
  - space
1336
1361
  - no_space
1362
+ EnforcedStyleForRationalLiterals: no_space
1363
+ SupportedStylesForRationalLiterals:
1364
+ - space
1365
+ - no_space
1337
1366
 
1338
1367
  Layout/SpaceBeforeBlockBraces:
1339
1368
  Description: >-
@@ -1529,7 +1558,6 @@ Lint/AmbiguousBlockAssociation:
1529
1558
  Description: >-
1530
1559
  Checks for ambiguous block association with method when param passed without
1531
1560
  parentheses.
1532
- StyleGuide: '#syntax'
1533
1561
  Enabled: true
1534
1562
  VersionAdded: '0.48'
1535
1563
  VersionChanged: '1.13'
@@ -1805,16 +1833,18 @@ Lint/EmptyClass:
1805
1833
  Lint/EmptyConditionalBody:
1806
1834
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1807
1835
  Enabled: true
1836
+ AutoCorrect: contextual
1808
1837
  SafeAutoCorrect: false
1809
1838
  AllowComments: true
1810
1839
  VersionAdded: '0.89'
1811
- VersionChanged: '1.34'
1840
+ VersionChanged: '1.61'
1812
1841
 
1813
1842
  Lint/EmptyEnsure:
1814
1843
  Description: 'Checks for empty ensure block.'
1815
1844
  Enabled: true
1845
+ AutoCorrect: contextual
1816
1846
  VersionAdded: '0.10'
1817
- VersionChanged: '0.48'
1847
+ VersionChanged: '1.61'
1818
1848
 
1819
1849
  Lint/EmptyExpression:
1820
1850
  Description: 'Checks for empty expressions.'
@@ -1836,8 +1866,9 @@ Lint/EmptyInPattern:
1836
1866
  Lint/EmptyInterpolation:
1837
1867
  Description: 'Checks for empty string interpolation.'
1838
1868
  Enabled: true
1869
+ AutoCorrect: contextual
1839
1870
  VersionAdded: '0.20'
1840
- VersionChanged: '0.45'
1871
+ VersionChanged: '1.61'
1841
1872
 
1842
1873
  Lint/EmptyWhen:
1843
1874
  Description: 'Checks for `when` branches with empty bodies.'
@@ -1943,6 +1974,12 @@ Lint/InterpolationCheck:
1943
1974
  VersionAdded: '0.50'
1944
1975
  VersionChanged: '1.40'
1945
1976
 
1977
+ Lint/ItWithoutArgumentsInBlock:
1978
+ Description: 'Checks uses of `it` calls without arguments in block.'
1979
+ Reference: 'https://bugs.ruby-lang.org/issues/18980'
1980
+ Enabled: pending
1981
+ VersionAdded: '1.59'
1982
+
1946
1983
  Lint/LambdaWithoutLiteralBlock:
1947
1984
  Description: 'Checks uses of lambda without a literal block.'
1948
1985
  Enabled: pending
@@ -1953,6 +1990,11 @@ Lint/LiteralAsCondition:
1953
1990
  Enabled: true
1954
1991
  VersionAdded: '0.51'
1955
1992
 
1993
+ Lint/LiteralAssignmentInCondition:
1994
+ Description: 'Checks for literal assignments in the conditions.'
1995
+ Enabled: pending
1996
+ VersionAdded: '1.58'
1997
+
1956
1998
  Lint/LiteralInInterpolation:
1957
1999
  Description: 'Checks for literals used in interpolation.'
1958
2000
  Enabled: true
@@ -1987,9 +2029,16 @@ Lint/MissingSuper:
1987
2029
  Checks for the presence of constructors and lifecycle callbacks
1988
2030
  without calls to `super`.
1989
2031
  Enabled: true
2032
+ AllowedParentClasses: []
1990
2033
  VersionAdded: '0.89'
1991
2034
  VersionChanged: '1.4'
1992
2035
 
2036
+ Lint/MixedCaseRange:
2037
+ Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
2038
+ Enabled: pending
2039
+ SafeAutoCorrect: false
2040
+ VersionAdded: '1.53'
2041
+
1993
2042
  Lint/MixedRegexpCaptureTypes:
1994
2043
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1995
2044
  Enabled: true
@@ -2139,10 +2188,17 @@ Lint/RedundantDirGlobSort:
2139
2188
  VersionChanged: '1.26'
2140
2189
  SafeAutoCorrect: false
2141
2190
 
2191
+ Lint/RedundantRegexpQuantifiers:
2192
+ Description: 'Checks for redundant quantifiers in Regexps.'
2193
+ Enabled: pending
2194
+ VersionAdded: '1.53'
2195
+
2142
2196
  Lint/RedundantRequireStatement:
2143
2197
  Description: 'Checks for unnecessary `require` statement.'
2144
2198
  Enabled: true
2199
+ SafeAutoCorrect: false
2145
2200
  VersionAdded: '0.76'
2201
+ VersionChanged: '1.57'
2146
2202
 
2147
2203
  Lint/RedundantSafeNavigation:
2148
2204
  Description: 'Checks for redundant safe navigation calls.'
@@ -2343,11 +2399,16 @@ Lint/TopLevelReturnWithArgument:
2343
2399
  Description: 'Detects top level return statements with argument.'
2344
2400
  Enabled: true
2345
2401
  VersionAdded: '0.89'
2402
+ # These codes are `eval`-ed in method and their return values may be used.
2403
+ Exclude:
2404
+ - '**/*.jb'
2346
2405
 
2347
2406
  Lint/TrailingCommaInAttributeDeclaration:
2348
2407
  Description: 'Checks for trailing commas in attribute declarations.'
2349
2408
  Enabled: true
2409
+ AutoCorrect: contextual
2350
2410
  VersionAdded: '0.90'
2411
+ VersionChanged: '1.61'
2351
2412
 
2352
2413
  Lint/TripleQuotes:
2353
2414
  Description: 'Checks for useless triple quote constructs.'
@@ -2407,8 +2468,9 @@ Lint/UnusedBlockArgument:
2407
2468
  Description: 'Checks for unused block arguments.'
2408
2469
  StyleGuide: '#underscore-unused-vars'
2409
2470
  Enabled: true
2471
+ AutoCorrect: contextual
2410
2472
  VersionAdded: '0.21'
2411
- VersionChanged: '0.22'
2473
+ VersionChanged: '1.61'
2412
2474
  IgnoreEmptyBlocks: true
2413
2475
  AllowUnusedKeywordArguments: false
2414
2476
 
@@ -2416,8 +2478,9 @@ Lint/UnusedMethodArgument:
2416
2478
  Description: 'Checks for unused method arguments.'
2417
2479
  StyleGuide: '#underscore-unused-vars'
2418
2480
  Enabled: true
2481
+ AutoCorrect: contextual
2419
2482
  VersionAdded: '0.21'
2420
- VersionChanged: '0.81'
2483
+ VersionChanged: '1.61'
2421
2484
  AllowUnusedKeywordArguments: false
2422
2485
  IgnoreEmptyMethods: true
2423
2486
  IgnoreNotImplementedMethods: true
@@ -2441,8 +2504,9 @@ Lint/UriRegexp:
2441
2504
  Lint/UselessAccessModifier:
2442
2505
  Description: 'Checks for useless access modifiers.'
2443
2506
  Enabled: true
2507
+ AutoCorrect: contextual
2444
2508
  VersionAdded: '0.20'
2445
- VersionChanged: '0.83'
2509
+ VersionChanged: '1.61'
2446
2510
  ContextCreatingMethods: []
2447
2511
  MethodCreatingMethods: []
2448
2512
 
@@ -2450,7 +2514,10 @@ Lint/UselessAssignment:
2450
2514
  Description: 'Checks for useless assignment to a local variable.'
2451
2515
  StyleGuide: '#underscore-unused-vars'
2452
2516
  Enabled: true
2517
+ AutoCorrect: contextual
2453
2518
  VersionAdded: '0.11'
2519
+ VersionChanged: '1.61'
2520
+ SafeAutoCorrect: false
2454
2521
 
2455
2522
  Lint/UselessElseWithoutRescue:
2456
2523
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
@@ -2461,8 +2528,9 @@ Lint/UselessElseWithoutRescue:
2461
2528
  Lint/UselessMethodDefinition:
2462
2529
  Description: 'Checks for useless method definitions.'
2463
2530
  Enabled: true
2531
+ AutoCorrect: contextual
2464
2532
  VersionAdded: '0.90'
2465
- VersionChanged: '0.91'
2533
+ VersionChanged: '1.61'
2466
2534
  Safe: false
2467
2535
 
2468
2536
  Lint/UselessRescue:
@@ -2478,21 +2546,24 @@ Lint/UselessRuby2Keywords:
2478
2546
  Lint/UselessSetterCall:
2479
2547
  Description: 'Checks for useless setter call to a local variable.'
2480
2548
  Enabled: true
2481
- SafeAutoCorrect: false
2549
+ Safe: false
2482
2550
  VersionAdded: '0.13'
2483
2551
  VersionChanged: '1.2'
2484
- Safe: false
2485
2552
 
2486
2553
  Lint/UselessTimes:
2487
2554
  Description: 'Checks for useless `Integer#times` calls.'
2488
2555
  Enabled: true
2489
- VersionAdded: '0.91'
2490
2556
  Safe: false
2557
+ AutoCorrect: contextual
2558
+ VersionAdded: '0.91'
2559
+ VersionChanged: '1.61'
2491
2560
 
2492
2561
  Lint/Void:
2493
2562
  Description: 'Possible use of operator/literal/variable in void context.'
2494
2563
  Enabled: true
2564
+ AutoCorrect: contextual
2495
2565
  VersionAdded: '0.9'
2566
+ VersionChanged: '1.61'
2496
2567
  CheckForMethodsWithNoSideEffects: false
2497
2568
 
2498
2569
  #################### Metrics ###############################
@@ -2942,7 +3013,9 @@ Naming/VariableNumber:
2942
3013
  Security/CompoundHash:
2943
3014
  Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
2944
3015
  Enabled: pending
3016
+ Safe: false
2945
3017
  VersionAdded: '1.28'
3018
+ VersionChanged: '1.51'
2946
3019
 
2947
3020
  Security/Eval:
2948
3021
  Description: 'The use of eval represents a serious security risk.'
@@ -3048,7 +3121,20 @@ Style/ArgumentsForwarding:
3048
3121
  StyleGuide: '#arguments-forwarding'
3049
3122
  Enabled: pending
3050
3123
  AllowOnlyRestArgument: true
3124
+ UseAnonymousForwarding: true
3125
+ RedundantRestArgumentNames:
3126
+ - args
3127
+ - arguments
3128
+ RedundantKeywordRestArgumentNames:
3129
+ - kwargs
3130
+ - options
3131
+ - opts
3132
+ RedundantBlockArgumentNames:
3133
+ - blk
3134
+ - block
3135
+ - proc
3051
3136
  VersionAdded: '1.1'
3137
+ VersionChanged: '1.58'
3052
3138
 
3053
3139
  Style/ArrayCoercion:
3054
3140
  Description: >-
@@ -3059,6 +3145,13 @@ Style/ArrayCoercion:
3059
3145
  Enabled: false
3060
3146
  VersionAdded: '0.88'
3061
3147
 
3148
+ Style/ArrayFirstLast:
3149
+ Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3150
+ Reference: '#first-and-last'
3151
+ Enabled: false
3152
+ VersionAdded: '1.58'
3153
+ Safe: false
3154
+
3062
3155
  Style/ArrayIntersect:
3063
3156
  Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
3064
3157
  Enabled: 'pending'
@@ -3319,7 +3412,9 @@ Style/ClassEqualityComparison:
3319
3412
  Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3320
3413
  StyleGuide: '#instance-of-vs-class-comparison'
3321
3414
  Enabled: true
3415
+ SafeAutoCorrect: false
3322
3416
  VersionAdded: '0.93'
3417
+ VersionChanged: '1.57'
3323
3418
  AllowedMethods:
3324
3419
  - ==
3325
3420
  - equal?
@@ -3355,6 +3450,7 @@ Style/CollectionCompact:
3355
3450
  Safe: false
3356
3451
  VersionAdded: '1.2'
3357
3452
  VersionChanged: '1.3'
3453
+ AllowedReceivers: []
3358
3454
 
3359
3455
  # Align with the style guide.
3360
3456
  Style/CollectionMethods:
@@ -3373,6 +3469,7 @@ Style/CollectionMethods:
3373
3469
  PreferredMethods:
3374
3470
  collect: 'map'
3375
3471
  collect!: 'map!'
3472
+ collect_concat: 'flat_map'
3376
3473
  inject: 'reduce'
3377
3474
  detect: 'find'
3378
3475
  find_all: 'select'
@@ -3515,7 +3612,9 @@ Style/DataInheritance:
3515
3612
  Description: 'Checks for inheritance from Data.define.'
3516
3613
  StyleGuide: '#no-extend-data-define'
3517
3614
  Enabled: pending
3615
+ SafeAutoCorrect: false
3518
3616
  VersionAdded: '1.49'
3617
+ VersionChanged: '1.51'
3519
3618
 
3520
3619
  Style/DateTime:
3521
3620
  Description: 'Use Time over DateTime.'
@@ -3624,8 +3723,9 @@ Style/EmptyCaseCondition:
3624
3723
  Style/EmptyElse:
3625
3724
  Description: 'Avoid empty else-clauses.'
3626
3725
  Enabled: true
3726
+ AutoCorrect: contextual
3627
3727
  VersionAdded: '0.28'
3628
- VersionChanged: '0.32'
3728
+ VersionChanged: '1.61'
3629
3729
  EnforcedStyle: both
3630
3730
  # empty - warn only on empty `else`
3631
3731
  # nil - warn on `else` with nil in it
@@ -3639,7 +3739,9 @@ Style/EmptyElse:
3639
3739
  Style/EmptyHeredoc:
3640
3740
  Description: 'Checks for using empty heredoc to reduce redundancy.'
3641
3741
  Enabled: pending
3742
+ AutoCorrect: contextual
3642
3743
  VersionAdded: '1.32'
3744
+ VersionChanged: '1.61'
3643
3745
 
3644
3746
  Style/EmptyLambdaParameter:
3645
3747
  Description: 'Omit parens for empty lambda parameters.'
@@ -3657,7 +3759,9 @@ Style/EmptyMethod:
3657
3759
  Description: 'Checks the formatting of empty method definitions.'
3658
3760
  StyleGuide: '#no-single-line-methods'
3659
3761
  Enabled: true
3762
+ AutoCorrect: contextual
3660
3763
  VersionAdded: '0.46'
3764
+ VersionChanged: '1.61'
3661
3765
  EnforcedStyle: compact
3662
3766
  SupportedStyles:
3663
3767
  - compact
@@ -3706,6 +3810,11 @@ Style/EvenOdd:
3706
3810
  VersionAdded: '0.12'
3707
3811
  VersionChanged: '0.29'
3708
3812
 
3813
+ Style/ExactRegexpMatch:
3814
+ Description: 'Checks for exact regexp match inside Regexp literals.'
3815
+ Enabled: pending
3816
+ VersionAdded: '1.51'
3817
+
3709
3818
  Style/ExpandPathArguments:
3710
3819
  Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3711
3820
  Enabled: true
@@ -3884,8 +3993,9 @@ Style/HashConversion:
3884
3993
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3885
3994
  StyleGuide: '#avoid-hash-constructor'
3886
3995
  Enabled: pending
3996
+ SafeAutoCorrect: false
3887
3997
  VersionAdded: '1.10'
3888
- VersionChanged: '1.11'
3998
+ VersionChanged: '1.55'
3889
3999
  AllowSplatArgument: true
3890
4000
 
3891
4001
  Style/HashEachMethods:
@@ -4086,14 +4196,6 @@ Style/InvertibleUnlessCondition:
4086
4196
  :none?: :any?
4087
4197
  :even?: :odd?
4088
4198
  :odd?: :even?
4089
- # `ActiveSupport` defines some common inverse methods. They are listed below,
4090
- # and not enabled by default.
4091
- # :present?: :blank?
4092
- # :blank?: :present?
4093
- # :include?: :exclude?
4094
- # :exclude?: :include?
4095
- # :one?: :many?
4096
- # :many?: :one?
4097
4199
 
4098
4200
  Style/IpAddresses:
4099
4201
  Description: "Don't include literal IP addresses in code."
@@ -4370,6 +4472,7 @@ Style/MultipleComparison:
4370
4472
  VersionAdded: '0.49'
4371
4473
  VersionChanged: '1.1'
4372
4474
  AllowMethodComparison: true
4475
+ ComparisonsThreshold: 2
4373
4476
 
4374
4477
  Style/MutableConstant:
4375
4478
  Description: 'Do not assign mutable objects to constants.'
@@ -4624,7 +4727,9 @@ Style/OpenStructUse:
4624
4727
  - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4625
4728
 
4626
4729
  Enabled: pending
4730
+ Safe: false
4627
4731
  VersionAdded: '1.23'
4732
+ VersionChanged: '1.51'
4628
4733
 
4629
4734
  Style/OperatorMethodCall:
4630
4735
  Description: 'Checks for redundant dot before operator method call.'
@@ -4634,6 +4739,7 @@ Style/OperatorMethodCall:
4634
4739
 
4635
4740
  Style/OptionHash:
4636
4741
  Description: "Don't use option hashes when you can use keyword arguments."
4742
+ StyleGuide: '#keyword-arguments-vs-option-hashes'
4637
4743
  Enabled: false
4638
4744
  VersionAdded: '0.33'
4639
4745
  VersionChanged: '0.34'
@@ -4756,8 +4862,9 @@ Style/RaiseArgs:
4756
4862
  Description: 'Checks the arguments passed to raise/fail.'
4757
4863
  StyleGuide: '#exception-class-messages'
4758
4864
  Enabled: true
4865
+ Safe: false
4759
4866
  VersionAdded: '0.14'
4760
- VersionChanged: '1.2'
4867
+ VersionChanged: '1.61'
4761
4868
  EnforcedStyle: exploded
4762
4869
  SupportedStyles:
4763
4870
  - compact # raise Exception.new(msg)
@@ -4777,12 +4884,16 @@ Style/RedundantArgument:
4777
4884
  Enabled: pending
4778
4885
  Safe: false
4779
4886
  VersionAdded: '1.4'
4780
- VersionChanged: '1.40'
4887
+ VersionChanged: '1.55'
4781
4888
  Methods:
4782
4889
  # Array#join
4783
4890
  join: ''
4784
4891
  # Array#sum
4785
4892
  sum: 0
4893
+ # Kernel.#exit
4894
+ exit: true
4895
+ # Kernel.#exit!
4896
+ exit!: false
4786
4897
  # String#split
4787
4898
  split: ' '
4788
4899
  # String#chomp
@@ -4790,6 +4901,11 @@ Style/RedundantArgument:
4790
4901
  # String#chomp!
4791
4902
  chomp!: "\n"
4792
4903
 
4904
+ Style/RedundantArrayConstructor:
4905
+ Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
4906
+ Enabled: pending
4907
+ VersionAdded: '1.52'
4908
+
4793
4909
  Style/RedundantAssignment:
4794
4910
  Description: 'Checks for redundant assignment before returning.'
4795
4911
  Enabled: true
@@ -4822,6 +4938,11 @@ Style/RedundantConstantBase:
4822
4938
  Enabled: pending
4823
4939
  VersionAdded: '1.40'
4824
4940
 
4941
+ Style/RedundantCurrentDirectoryInPath:
4942
+ Description: 'Checks for uses a redundant current directory in path.'
4943
+ Enabled: pending
4944
+ VersionAdded: '1.53'
4945
+
4825
4946
  Style/RedundantDoubleSplatHashBraces:
4826
4947
  Description: 'Checks for redundant uses of double splat hash braces.'
4827
4948
  Enabled: pending
@@ -4844,7 +4965,7 @@ Style/RedundantFetchBlock:
4844
4965
  Description: >-
4845
4966
  Use `fetch(key, value)` instead of `fetch(key) { value }`
4846
4967
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4847
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4968
+ Reference: 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4848
4969
  Enabled: true
4849
4970
  Safe: false
4850
4971
  # If enabled, this cop will autocorrect usages of
@@ -4861,6 +4982,15 @@ Style/RedundantFileExtensionInRequire:
4861
4982
  Enabled: true
4862
4983
  VersionAdded: '0.88'
4863
4984
 
4985
+ Style/RedundantFilterChain:
4986
+ Description: >-
4987
+ Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
4988
+ `select`/`filter`/`find_all` and change them to use predicate method instead.
4989
+ Enabled: pending
4990
+ SafeAutoCorrect: false
4991
+ VersionAdded: '1.52'
4992
+ VersionChanged: '1.57'
4993
+
4864
4994
  Style/RedundantFreeze:
4865
4995
  Description: "Checks usages of Object#freeze on immutable objects."
4866
4996
  Enabled: true
@@ -4875,10 +5005,11 @@ Style/RedundantHeredocDelimiterQuotes:
4875
5005
  Style/RedundantInitialize:
4876
5006
  Description: 'Checks for redundant `initialize` methods.'
4877
5007
  Enabled: pending
5008
+ AutoCorrect: contextual
4878
5009
  Safe: false
4879
5010
  AllowComments: true
4880
5011
  VersionAdded: '1.27'
4881
- VersionChanged: '1.28'
5012
+ VersionChanged: '1.61'
4882
5013
 
4883
5014
  Style/RedundantInterpolation:
4884
5015
  Description: 'Checks for strings that are just an interpolated expression.'
@@ -4903,11 +5034,21 @@ Style/RedundantPercentQ:
4903
5034
  Enabled: true
4904
5035
  VersionAdded: '0.76'
4905
5036
 
5037
+ Style/RedundantRegexpArgument:
5038
+ Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
5039
+ Enabled: pending
5040
+ VersionAdded: '1.53'
5041
+
4906
5042
  Style/RedundantRegexpCharacterClass:
4907
5043
  Description: 'Checks for unnecessary single-element Regexp character classes.'
4908
5044
  Enabled: true
4909
5045
  VersionAdded: '0.85'
4910
5046
 
5047
+ Style/RedundantRegexpConstructor:
5048
+ Description: 'Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.'
5049
+ Enabled: pending
5050
+ VersionAdded: '1.52'
5051
+
4911
5052
  Style/RedundantRegexpEscape:
4912
5053
  Description: 'Checks for redundant escapes in Regexps.'
4913
5054
  Enabled: true
@@ -5010,6 +5151,15 @@ Style/ReturnNil:
5010
5151
  - return_nil
5011
5152
  VersionAdded: '0.50'
5012
5153
 
5154
+ Style/ReturnNilInPredicateMethodDefinition:
5155
+ Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
5156
+ StyleGuide: '#bool-methods-qmark'
5157
+ Enabled: pending
5158
+ SafeAutoCorrect: false
5159
+ AllowedMethods: []
5160
+ AllowedPatterns: []
5161
+ VersionAdded: '1.53'
5162
+
5013
5163
  Style/SafeNavigation:
5014
5164
  Description: >-
5015
5165
  Transforms usages of a method call safeguarded by
@@ -5037,7 +5187,7 @@ Style/Sample:
5037
5187
  Description: >-
5038
5188
  Use `sample` instead of `shuffle.first`,
5039
5189
  `shuffle.last`, and `shuffle[Integer]`.
5040
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5190
+ Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5041
5191
  Enabled: true
5042
5192
  VersionAdded: '0.30'
5043
5193
 
@@ -5102,6 +5252,12 @@ Style/SingleLineBlockParams:
5102
5252
  - acc
5103
5253
  - elem
5104
5254
 
5255
+ Style/SingleLineDoEndBlock:
5256
+ Description: 'Checks for single-line `do`...`end` blocks.'
5257
+ StyleGuide: '#single-line-do-end-block'
5258
+ Enabled: pending
5259
+ VersionAdded: '1.57'
5260
+
5105
5261
  Style/SingleLineMethods:
5106
5262
  Description: 'Avoid single-line methods.'
5107
5263
  StyleGuide: '#no-single-line-methods'
@@ -5111,7 +5267,8 @@ Style/SingleLineMethods:
5111
5267
  AllowIfMethodIsEmpty: true
5112
5268
 
5113
5269
  Style/SlicingWithRange:
5114
- Description: 'Checks array slicing is done with endless ranges when suitable.'
5270
+ Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
5271
+ StyleGuide: '#slicing-with-ranges'
5115
5272
  Enabled: true
5116
5273
  VersionAdded: '0.83'
5117
5274
  Safe: false
@@ -5238,6 +5395,12 @@ Style/StructInheritance:
5238
5395
  VersionAdded: '0.29'
5239
5396
  VersionChanged: '1.20'
5240
5397
 
5398
+ Style/SuperWithArgsParentheses:
5399
+ Description: 'Use parentheses for `super` with arguments.'
5400
+ StyleGuide: '#super-with-args'
5401
+ Enabled: pending
5402
+ VersionAdded: '1.58'
5403
+
5241
5404
  Style/SwapValues:
5242
5405
  Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
5243
5406
  StyleGuide: '#values-swapping'
@@ -5494,6 +5657,11 @@ Style/WordArray:
5494
5657
  # The regular expression `WordRegex` decides what is considered a word.
5495
5658
  WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
5496
5659
 
5660
+ Style/YAMLFileRead:
5661
+ Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
5662
+ Enabled: pending
5663
+ VersionAdded: '1.53'
5664
+
5497
5665
  Style/YodaCondition:
5498
5666
  Description: 'Forbid or enforce yoda conditions.'
5499
5667
  Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
@@ -224,6 +224,11 @@ changed_parameters:
224
224
  - AllowedMethods
225
225
  - AllowedPatterns
226
226
  severity: warning
227
+ - cops: Style/ArgumentsForwarding
228
+ parameters: AllowOnlyRestArgument
229
+ reason: "`AllowOnlyRestArgument` has no effect with TargetRubyVersion >= 3.2."
230
+ severity: warning
231
+ minimum_ruby_version: 3.2
227
232
 
228
233
  # Enforced styles that have been removed or replaced
229
234
  changed_enforced_styles: