rubocop 1.50.2 → 1.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (494) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +73 -72
  4. data/assets/output.css.erb +159 -0
  5. data/assets/output.html.erb +1 -160
  6. data/config/default.yml +316 -38
  7. data/config/internal_affairs.yml +11 -0
  8. data/config/obsoletion.yml +5 -0
  9. data/exe/rubocop +4 -3
  10. data/lib/rubocop/cached_data.rb +21 -5
  11. data/lib/rubocop/cli/command/auto_generate_config.rb +28 -15
  12. data/lib/rubocop/cli/command/execute_runner.rb +1 -1
  13. data/lib/rubocop/cli/command/lsp.rb +19 -0
  14. data/lib/rubocop/cli/command/show_docs_url.rb +2 -2
  15. data/lib/rubocop/cli/command/version.rb +2 -2
  16. data/lib/rubocop/cli.rb +14 -2
  17. data/lib/rubocop/comment_config.rb +1 -1
  18. data/lib/rubocop/config.rb +45 -13
  19. data/lib/rubocop/config_finder.rb +14 -4
  20. data/lib/rubocop/config_loader.rb +15 -10
  21. data/lib/rubocop/config_loader_resolver.rb +17 -11
  22. data/lib/rubocop/config_obsoletion/parameter_rule.rb +9 -1
  23. data/lib/rubocop/config_obsoletion.rb +13 -10
  24. data/lib/rubocop/config_validator.rb +17 -9
  25. data/lib/rubocop/cop/autocorrect_logic.rb +30 -3
  26. data/lib/rubocop/cop/base.rb +78 -19
  27. data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -0
  28. data/lib/rubocop/cop/bundler/duplicated_group.rb +127 -0
  29. data/lib/rubocop/cop/bundler/gem_comment.rb +3 -3
  30. data/lib/rubocop/cop/bundler/gem_version.rb +6 -7
  31. data/lib/rubocop/cop/bundler/ordered_gems.rb +9 -1
  32. data/lib/rubocop/cop/cop.rb +30 -4
  33. data/lib/rubocop/cop/correctors/alignment_corrector.rb +2 -13
  34. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +4 -8
  35. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +5 -13
  36. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +7 -4
  37. data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -0
  38. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +1 -1
  39. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
  40. data/lib/rubocop/cop/documentation.rb +32 -5
  41. data/lib/rubocop/cop/exclude_limit.rb +1 -1
  42. data/lib/rubocop/cop/force.rb +12 -0
  43. data/lib/rubocop/cop/gemspec/add_runtime_dependency.rb +38 -0
  44. data/lib/rubocop/cop/gemspec/dependency_version.rb +5 -7
  45. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +2 -2
  46. data/lib/rubocop/cop/gemspec/development_dependencies.rb +1 -1
  47. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +2 -2
  48. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +9 -1
  49. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -1
  50. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +3 -3
  51. data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
  52. data/lib/rubocop/cop/internal_affairs/cop_description.rb +32 -12
  53. data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +2 -1
  54. data/lib/rubocop/cop/internal_affairs/example_description.rb +46 -24
  55. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -1
  56. data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +8 -6
  57. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
  58. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +53 -0
  59. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +128 -34
  60. data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
  61. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +6 -21
  62. data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +11 -2
  63. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +8 -1
  64. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +11 -1
  65. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -5
  66. data/lib/rubocop/cop/internal_affairs.rb +18 -0
  67. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +5 -1
  68. data/lib/rubocop/cop/layout/argument_alignment.rb +1 -1
  69. data/lib/rubocop/cop/layout/assignment_indentation.rb +3 -2
  70. data/lib/rubocop/cop/layout/block_alignment.rb +30 -12
  71. data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
  72. data/lib/rubocop/cop/layout/class_structure.rb +7 -0
  73. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -2
  74. data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
  75. data/lib/rubocop/cop/layout/condition_position.rb +0 -4
  76. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  77. data/lib/rubocop/cop/layout/dot_position.rb +1 -5
  78. data/lib/rubocop/cop/layout/empty_comment.rb +3 -1
  79. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +43 -10
  80. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
  81. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
  82. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +29 -5
  83. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +10 -3
  84. data/lib/rubocop/cop/layout/end_alignment.rb +15 -3
  85. data/lib/rubocop/cop/layout/extra_spacing.rb +4 -10
  86. data/lib/rubocop/cop/layout/first_argument_indentation.rb +2 -2
  87. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +24 -10
  88. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +8 -0
  89. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +1 -1
  90. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +4 -4
  91. data/lib/rubocop/cop/layout/heredoc_indentation.rb +5 -2
  92. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  93. data/lib/rubocop/cop/layout/indentation_width.rb +8 -9
  94. data/lib/rubocop/cop/layout/leading_comment_space.rb +57 -2
  95. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +17 -9
  96. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +1 -1
  97. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -0
  98. data/lib/rubocop/cop/layout/line_length.rb +20 -20
  99. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +18 -3
  100. data/lib/rubocop/cop/layout/redundant_line_break.rb +30 -7
  101. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +4 -4
  102. data/lib/rubocop/cop/layout/single_line_block_chain.rb +5 -0
  103. data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
  104. data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
  105. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +2 -2
  106. data/lib/rubocop/cop/layout/space_around_operators.rb +56 -21
  107. data/lib/rubocop/cop/layout/space_before_block_braces.rb +19 -10
  108. data/lib/rubocop/cop/layout/space_before_brackets.rb +5 -5
  109. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +6 -0
  110. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +1 -1
  111. data/lib/rubocop/cop/layout/space_inside_parens.rb +1 -1
  112. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
  113. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +3 -4
  114. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +5 -0
  115. data/lib/rubocop/cop/legacy/corrector.rb +12 -2
  116. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +13 -3
  117. data/lib/rubocop/cop/lint/ambiguous_operator.rb +0 -2
  118. data/lib/rubocop/cop/lint/ambiguous_range.rb +4 -1
  119. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +0 -2
  120. data/lib/rubocop/cop/lint/assignment_in_condition.rb +6 -6
  121. data/lib/rubocop/cop/lint/big_decimal_new.rb +4 -7
  122. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +2 -2
  123. data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -3
  124. data/lib/rubocop/cop/lint/circular_argument_reference.rb +0 -13
  125. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +1 -1
  126. data/lib/rubocop/cop/lint/debugger.rb +45 -10
  127. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
  128. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +0 -10
  129. data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
  130. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -5
  131. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -5
  132. data/lib/rubocop/cop/lint/duplicate_methods.rb +1 -11
  133. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +46 -19
  134. data/lib/rubocop/cop/lint/duplicate_set_element.rb +74 -0
  135. data/lib/rubocop/cop/lint/each_with_object_argument.rb +0 -4
  136. data/lib/rubocop/cop/lint/else_layout.rb +0 -2
  137. data/lib/rubocop/cop/lint/empty_block.rb +1 -1
  138. data/lib/rubocop/cop/lint/empty_conditional_body.rb +29 -8
  139. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -11
  140. data/lib/rubocop/cop/lint/empty_interpolation.rb +0 -4
  141. data/lib/rubocop/cop/lint/empty_when.rb +1 -3
  142. data/lib/rubocop/cop/lint/ensure_return.rb +1 -9
  143. data/lib/rubocop/cop/lint/erb_new_arguments.rb +27 -21
  144. data/lib/rubocop/cop/lint/float_comparison.rb +10 -0
  145. data/lib/rubocop/cop/lint/float_out_of_range.rb +0 -4
  146. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +0 -10
  147. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
  148. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
  149. data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
  150. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +23 -12
  151. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -3
  152. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +0 -7
  153. data/lib/rubocop/cop/lint/inherit_exception.rb +9 -0
  154. data/lib/rubocop/cop/lint/interpolation_check.rb +0 -4
  155. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +47 -0
  156. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
  157. data/lib/rubocop/cop/lint/literal_as_condition.rb +1 -1
  158. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +85 -0
  159. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +26 -7
  160. data/lib/rubocop/cop/lint/loop.rb +6 -12
  161. data/lib/rubocop/cop/lint/missing_super.rb +34 -5
  162. data/lib/rubocop/cop/lint/mixed_case_range.rb +116 -0
  163. data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -7
  164. data/lib/rubocop/cop/lint/next_without_accumulator.rb +6 -25
  165. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +0 -5
  166. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +17 -7
  167. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -5
  168. data/lib/rubocop/cop/lint/number_conversion.rb +14 -4
  169. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -2
  170. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +0 -1
  171. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +2 -2
  172. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +5 -6
  173. data/lib/rubocop/cop/lint/percent_string_array.rb +0 -4
  174. data/lib/rubocop/cop/lint/percent_symbol_array.rb +0 -4
  175. data/lib/rubocop/cop/lint/rand_one.rb +0 -4
  176. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +3 -1
  177. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
  178. data/lib/rubocop/cop/lint/redundant_require_statement.rb +12 -3
  179. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +72 -8
  180. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
  181. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -5
  182. data/lib/rubocop/cop/lint/redundant_with_index.rb +6 -2
  183. data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -2
  184. data/lib/rubocop/cop/lint/require_parentheses.rb +0 -4
  185. data/lib/rubocop/cop/lint/rescue_exception.rb +0 -4
  186. data/lib/rubocop/cop/lint/rescue_type.rb +1 -3
  187. data/lib/rubocop/cop/lint/return_in_void_context.rb +0 -2
  188. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +23 -12
  189. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +107 -41
  190. data/lib/rubocop/cop/lint/script_permission.rb +3 -3
  191. data/lib/rubocop/cop/lint/self_assignment.rb +38 -0
  192. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -2
  193. data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -0
  194. data/lib/rubocop/cop/lint/shadowed_exception.rb +5 -11
  195. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +13 -11
  196. data/lib/rubocop/cop/lint/struct_new_override.rb +12 -12
  197. data/lib/rubocop/cop/lint/suppressed_exception.rb +2 -2
  198. data/lib/rubocop/cop/lint/symbol_conversion.rb +9 -4
  199. data/lib/rubocop/cop/lint/syntax.rb +6 -3
  200. data/lib/rubocop/cop/lint/to_enum_arguments.rb +6 -6
  201. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +23 -9
  202. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
  203. data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +88 -0
  204. data/lib/rubocop/cop/lint/unified_integer.rb +0 -4
  205. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +3 -2
  206. data/lib/rubocop/cop/lint/unreachable_code.rb +4 -7
  207. data/lib/rubocop/cop/lint/unreachable_loop.rb +8 -2
  208. data/lib/rubocop/cop/lint/uri_regexp.rb +25 -7
  209. data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -2
  210. data/lib/rubocop/cop/lint/useless_assignment.rb +102 -15
  211. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +0 -4
  212. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +77 -0
  213. data/lib/rubocop/cop/lint/useless_setter_call.rb +0 -4
  214. data/lib/rubocop/cop/lint/useless_times.rb +2 -2
  215. data/lib/rubocop/cop/lint/void.rb +128 -15
  216. data/lib/rubocop/cop/metrics/abc_size.rb +3 -3
  217. data/lib/rubocop/cop/metrics/block_length.rb +7 -6
  218. data/lib/rubocop/cop/metrics/block_nesting.rb +19 -7
  219. data/lib/rubocop/cop/metrics/class_length.rb +14 -8
  220. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +4 -1
  221. data/lib/rubocop/cop/metrics/method_length.rb +7 -6
  222. data/lib/rubocop/cop/metrics/module_length.rb +6 -5
  223. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -2
  224. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +37 -9
  225. data/lib/rubocop/cop/migration/department_name.rb +2 -2
  226. data/lib/rubocop/cop/mixin/alignment.rb +5 -1
  227. data/lib/rubocop/cop/mixin/allowed_methods.rb +7 -1
  228. data/lib/rubocop/cop/mixin/allowed_pattern.rb +15 -3
  229. data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
  230. data/lib/rubocop/cop/mixin/annotation_comment.rb +0 -2
  231. data/lib/rubocop/cop/mixin/check_line_breakable.rb +11 -1
  232. data/lib/rubocop/cop/mixin/code_length.rb +12 -1
  233. data/lib/rubocop/cop/mixin/comments_help.rb +19 -11
  234. data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
  235. data/lib/rubocop/cop/mixin/configurable_max.rb +5 -1
  236. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  237. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  238. data/lib/rubocop/cop/mixin/endless_method_rewriter.rb +24 -0
  239. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +22 -10
  240. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +23 -13
  241. data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
  242. data/lib/rubocop/cop/mixin/line_length_help.rb +7 -2
  243. data/lib/rubocop/cop/mixin/method_complexity.rb +15 -6
  244. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +4 -3
  245. data/lib/rubocop/cop/mixin/percent_array.rb +1 -1
  246. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  247. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +6 -8
  248. data/lib/rubocop/cop/mixin/rescue_node.rb +4 -0
  249. data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
  250. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
  251. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
  252. data/lib/rubocop/cop/mixin/statement_modifier.rb +3 -2
  253. data/lib/rubocop/cop/mixin/string_help.rb +4 -2
  254. data/lib/rubocop/cop/mixin/string_literals_help.rb +12 -0
  255. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  256. data/lib/rubocop/cop/naming/accessor_method_name.rb +5 -0
  257. data/lib/rubocop/cop/naming/block_forwarding.rb +35 -8
  258. data/lib/rubocop/cop/naming/constant_name.rb +2 -3
  259. data/lib/rubocop/cop/naming/file_name.rb +3 -3
  260. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -1
  261. data/lib/rubocop/cop/naming/inclusive_language.rb +13 -5
  262. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +26 -11
  263. data/lib/rubocop/cop/naming/predicate_name.rb +55 -29
  264. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +21 -4
  265. data/lib/rubocop/cop/naming/variable_name.rb +6 -1
  266. data/lib/rubocop/cop/offense.rb +4 -5
  267. data/lib/rubocop/cop/registry.rb +1 -1
  268. data/lib/rubocop/cop/security/compound_hash.rb +2 -2
  269. data/lib/rubocop/cop/security/open.rb +2 -2
  270. data/lib/rubocop/cop/style/access_modifier_declarations.rb +63 -3
  271. data/lib/rubocop/cop/style/accessor_grouping.rb +14 -2
  272. data/lib/rubocop/cop/style/alias.rb +11 -9
  273. data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +79 -0
  274. data/lib/rubocop/cop/style/arguments_forwarding.rb +459 -63
  275. data/lib/rubocop/cop/style/array_first_last.rb +64 -0
  276. data/lib/rubocop/cop/style/array_intersect.rb +13 -5
  277. data/lib/rubocop/cop/style/attr.rb +11 -1
  278. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
  279. data/lib/rubocop/cop/style/begin_block.rb +1 -2
  280. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +2 -2
  281. data/lib/rubocop/cop/style/bitwise_predicate.rb +100 -0
  282. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  283. data/lib/rubocop/cop/style/block_delimiters.rb +36 -7
  284. data/lib/rubocop/cop/style/case_like_if.rb +5 -5
  285. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  286. data/lib/rubocop/cop/style/class_check.rb +1 -0
  287. data/lib/rubocop/cop/style/class_equality_comparison.rb +24 -39
  288. data/lib/rubocop/cop/style/class_vars.rb +3 -3
  289. data/lib/rubocop/cop/style/collection_compact.rb +31 -11
  290. data/lib/rubocop/cop/style/collection_methods.rb +2 -0
  291. data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
  292. data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
  293. data/lib/rubocop/cop/style/combinable_loops.rb +43 -8
  294. data/lib/rubocop/cop/style/commented_keyword.rb +12 -3
  295. data/lib/rubocop/cop/style/concat_array_literals.rb +2 -1
  296. data/lib/rubocop/cop/style/conditional_assignment.rb +13 -12
  297. data/lib/rubocop/cop/style/copyright.rb +36 -23
  298. data/lib/rubocop/cop/style/data_inheritance.rb +1 -1
  299. data/lib/rubocop/cop/style/date_time.rb +5 -4
  300. data/lib/rubocop/cop/style/def_with_parentheses.rb +0 -2
  301. data/lib/rubocop/cop/style/dir.rb +1 -1
  302. data/lib/rubocop/cop/style/dir_empty.rb +8 -14
  303. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
  304. data/lib/rubocop/cop/style/documentation.rb +25 -25
  305. data/lib/rubocop/cop/style/documentation_method.rb +20 -0
  306. data/lib/rubocop/cop/style/each_for_simple_loop.rb +7 -8
  307. data/lib/rubocop/cop/style/each_with_object.rb +2 -2
  308. data/lib/rubocop/cop/style/empty_case_condition.rb +6 -1
  309. data/lib/rubocop/cop/style/empty_else.rb +6 -5
  310. data/lib/rubocop/cop/style/empty_heredoc.rb +1 -14
  311. data/lib/rubocop/cop/style/empty_literal.rb +32 -23
  312. data/lib/rubocop/cop/style/endless_method.rb +1 -14
  313. data/lib/rubocop/cop/style/eval_with_location.rb +24 -32
  314. data/lib/rubocop/cop/style/exact_regexp_match.rb +70 -0
  315. data/lib/rubocop/cop/style/explicit_block_argument.rb +2 -2
  316. data/lib/rubocop/cop/style/file_read.rb +4 -7
  317. data/lib/rubocop/cop/style/file_write.rb +2 -5
  318. data/lib/rubocop/cop/style/for.rb +3 -1
  319. data/lib/rubocop/cop/style/format_string.rb +33 -12
  320. data/lib/rubocop/cop/style/format_string_token.rb +2 -2
  321. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -1
  322. data/lib/rubocop/cop/style/global_std_stream.rb +7 -1
  323. data/lib/rubocop/cop/style/guard_clause.rb +45 -2
  324. data/lib/rubocop/cop/style/hash_conversion.rb +10 -0
  325. data/lib/rubocop/cop/style/hash_each_methods.rb +112 -33
  326. data/lib/rubocop/cop/style/hash_except.rb +29 -14
  327. data/lib/rubocop/cop/style/hash_syntax.rb +26 -4
  328. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  329. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  330. data/lib/rubocop/cop/style/identical_conditional_branches.rb +34 -5
  331. data/lib/rubocop/cop/style/if_inside_else.rb +7 -1
  332. data/lib/rubocop/cop/style/if_unless_modifier.rb +3 -0
  333. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +5 -4
  334. data/lib/rubocop/cop/style/if_with_semicolon.rb +51 -8
  335. data/lib/rubocop/cop/style/in_pattern_then.rb +6 -2
  336. data/lib/rubocop/cop/style/inverse_methods.rb +14 -13
  337. data/lib/rubocop/cop/style/invertible_unless_condition.rb +56 -10
  338. data/lib/rubocop/cop/style/keyword_arguments_merging.rb +67 -0
  339. data/lib/rubocop/cop/style/lambda.rb +4 -4
  340. data/lib/rubocop/cop/style/lambda_call.rb +5 -0
  341. data/lib/rubocop/cop/style/magic_comment_format.rb +1 -1
  342. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +82 -50
  343. data/lib/rubocop/cop/style/map_into_array.rb +233 -0
  344. data/lib/rubocop/cop/style/map_to_hash.rb +18 -8
  345. data/lib/rubocop/cop/style/map_to_set.rb +1 -1
  346. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +40 -15
  347. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +3 -5
  348. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +22 -2
  349. data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
  350. data/lib/rubocop/cop/style/missing_else.rb +0 -4
  351. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +2 -2
  352. data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
  353. data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
  354. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  355. data/lib/rubocop/cop/style/multiline_method_signature.rb +10 -1
  356. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +6 -4
  357. data/lib/rubocop/cop/style/multiline_when_then.rb +0 -4
  358. data/lib/rubocop/cop/style/multiple_comparison.rb +41 -46
  359. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  360. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
  361. data/lib/rubocop/cop/style/nested_ternary_operator.rb +3 -11
  362. data/lib/rubocop/cop/style/next.rb +1 -1
  363. data/lib/rubocop/cop/style/nil_comparison.rb +2 -0
  364. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
  365. data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
  366. data/lib/rubocop/cop/style/numeric_predicate.rb +12 -4
  367. data/lib/rubocop/cop/style/object_then.rb +5 -3
  368. data/lib/rubocop/cop/style/one_line_conditional.rb +6 -2
  369. data/lib/rubocop/cop/style/open_struct_use.rb +1 -1
  370. data/lib/rubocop/cop/style/operator_method_call.rb +32 -7
  371. data/lib/rubocop/cop/style/parallel_assignment.rb +8 -9
  372. data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -0
  373. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  374. data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
  375. data/lib/rubocop/cop/style/quoted_symbols.rb +1 -3
  376. data/lib/rubocop/cop/style/raise_args.rb +4 -1
  377. data/lib/rubocop/cop/style/redundant_argument.rb +33 -4
  378. data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
  379. data/lib/rubocop/cop/style/redundant_assignment.rb +10 -2
  380. data/lib/rubocop/cop/style/redundant_begin.rb +15 -3
  381. data/lib/rubocop/cop/style/redundant_condition.rb +4 -4
  382. data/lib/rubocop/cop/style/redundant_conditional.rb +2 -10
  383. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +39 -0
  384. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +93 -5
  385. data/lib/rubocop/cop/style/redundant_each.rb +7 -4
  386. data/lib/rubocop/cop/style/redundant_exception.rb +32 -12
  387. data/lib/rubocop/cop/style/redundant_fetch_block.rb +3 -3
  388. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
  389. data/lib/rubocop/cop/style/redundant_filter_chain.rb +118 -0
  390. data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +46 -0
  391. data/lib/rubocop/cop/style/redundant_line_continuation.rb +48 -9
  392. data/lib/rubocop/cop/style/redundant_parentheses.rb +80 -33
  393. data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
  394. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +103 -0
  395. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
  396. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +9 -24
  397. data/lib/rubocop/cop/style/redundant_return.rb +14 -3
  398. data/lib/rubocop/cop/style/redundant_self.rb +17 -2
  399. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +8 -1
  400. data/lib/rubocop/cop/style/redundant_sort.rb +10 -9
  401. data/lib/rubocop/cop/style/redundant_sort_by.rb +2 -2
  402. data/lib/rubocop/cop/style/redundant_string_escape.rb +3 -1
  403. data/lib/rubocop/cop/style/regexp_literal.rb +11 -2
  404. data/lib/rubocop/cop/style/require_order.rb +13 -7
  405. data/lib/rubocop/cop/style/rescue_modifier.rb +14 -4
  406. data/lib/rubocop/cop/style/return_nil.rb +6 -2
  407. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +137 -0
  408. data/lib/rubocop/cop/style/safe_navigation.rb +106 -52
  409. data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
  410. data/lib/rubocop/cop/style/sample.rb +3 -4
  411. data/lib/rubocop/cop/style/select_by_regexp.rb +29 -15
  412. data/lib/rubocop/cop/style/self_assignment.rb +1 -1
  413. data/lib/rubocop/cop/style/semicolon.rb +21 -5
  414. data/lib/rubocop/cop/style/send.rb +4 -4
  415. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +104 -0
  416. data/lib/rubocop/cop/style/signal_exception.rb +1 -1
  417. data/lib/rubocop/cop/style/single_argument_dig.rb +7 -3
  418. data/lib/rubocop/cop/style/single_line_do_end_block.rb +67 -0
  419. data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
  420. data/lib/rubocop/cop/style/slicing_with_range.rb +76 -10
  421. data/lib/rubocop/cop/style/sole_nested_conditional.rb +27 -4
  422. data/lib/rubocop/cop/style/special_global_vars.rb +4 -6
  423. data/lib/rubocop/cop/style/string_chars.rb +1 -0
  424. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
  425. data/lib/rubocop/cop/style/strip.rb +7 -4
  426. data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
  427. data/lib/rubocop/cop/style/super_arguments.rb +174 -0
  428. data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
  429. data/lib/rubocop/cop/style/symbol_array.rb +35 -15
  430. data/lib/rubocop/cop/style/symbol_proc.rb +75 -5
  431. data/lib/rubocop/cop/style/ternary_parentheses.rb +26 -5
  432. data/lib/rubocop/cop/style/top_level_method_definition.rb +1 -1
  433. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  434. data/lib/rubocop/cop/style/unpack_first.rb +11 -14
  435. data/lib/rubocop/cop/style/while_until_do.rb +0 -2
  436. data/lib/rubocop/cop/style/while_until_modifier.rb +0 -1
  437. data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
  438. data/lib/rubocop/cop/style/yoda_condition.rb +4 -2
  439. data/lib/rubocop/cop/style/yoda_expression.rb +8 -7
  440. data/lib/rubocop/cop/style/zero_length_predicate.rb +32 -24
  441. data/lib/rubocop/cop/team.rb +27 -3
  442. data/lib/rubocop/cop/util.rb +9 -3
  443. data/lib/rubocop/cop/utils/regexp_ranges.rb +113 -0
  444. data/lib/rubocop/cop/variable_force/assignment.rb +62 -6
  445. data/lib/rubocop/cop/variable_force/branch.rb +1 -1
  446. data/lib/rubocop/cop/variable_force/variable.rb +5 -1
  447. data/lib/rubocop/cop/variable_force/variable_table.rb +4 -4
  448. data/lib/rubocop/cop/variable_force.rb +14 -1
  449. data/lib/rubocop/cops_documentation_generator.rb +97 -44
  450. data/lib/rubocop/core_ext/string.rb +2 -6
  451. data/lib/rubocop/directive_comment.rb +10 -8
  452. data/lib/rubocop/ext/regexp_node.rb +18 -35
  453. data/lib/rubocop/ext/regexp_parser.rb +7 -21
  454. data/lib/rubocop/file_finder.rb +11 -9
  455. data/lib/rubocop/formatter/clang_style_formatter.rb +3 -7
  456. data/lib/rubocop/formatter/disabled_config_formatter.rb +24 -9
  457. data/lib/rubocop/formatter/formatter_set.rb +7 -1
  458. data/lib/rubocop/formatter/html_formatter.rb +37 -14
  459. data/lib/rubocop/formatter/json_formatter.rb +0 -1
  460. data/lib/rubocop/formatter/junit_formatter.rb +71 -24
  461. data/lib/rubocop/formatter/offense_count_formatter.rb +12 -2
  462. data/lib/rubocop/formatter/tap_formatter.rb +3 -7
  463. data/lib/rubocop/formatter.rb +1 -1
  464. data/lib/rubocop/lockfile.rb +58 -7
  465. data/lib/rubocop/lsp/logger.rb +22 -0
  466. data/lib/rubocop/lsp/routes.rb +243 -0
  467. data/lib/rubocop/lsp/runtime.rb +101 -0
  468. data/lib/rubocop/lsp/server.rb +72 -0
  469. data/lib/rubocop/lsp/severity.rb +27 -0
  470. data/lib/rubocop/lsp.rb +36 -0
  471. data/lib/rubocop/magic_comment.rb +13 -11
  472. data/lib/rubocop/options.rb +28 -13
  473. data/lib/rubocop/path_util.rb +6 -2
  474. data/lib/rubocop/rake_task.rb +1 -1
  475. data/lib/rubocop/remote_config.rb +5 -1
  476. data/lib/rubocop/result_cache.rb +7 -10
  477. data/lib/rubocop/rspec/cop_helper.rb +8 -2
  478. data/lib/rubocop/rspec/expect_offense.rb +17 -8
  479. data/lib/rubocop/rspec/shared_contexts.rb +77 -21
  480. data/lib/rubocop/rspec/support.rb +3 -0
  481. data/lib/rubocop/runner.rb +36 -12
  482. data/lib/rubocop/server/cache.rb +16 -1
  483. data/lib/rubocop/server/client_command/exec.rb +5 -5
  484. data/lib/rubocop/server/client_command/start.rb +1 -1
  485. data/lib/rubocop/server/core.rb +5 -0
  486. data/lib/rubocop/server/server_command/exec.rb +0 -1
  487. data/lib/rubocop/string_interpreter.rb +3 -3
  488. data/lib/rubocop/target_finder.rb +91 -81
  489. data/lib/rubocop/target_ruby.rb +90 -79
  490. data/lib/rubocop/version.rb +53 -13
  491. data/lib/rubocop/yaml_duplication_checker.rb +20 -26
  492. data/lib/rubocop.rb +40 -1
  493. metadata +73 -36
  494. /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'
@@ -80,6 +82,8 @@ AllCops:
80
82
  StyleGuideBaseURL: https://rubystyle.guide
81
83
  # Documentation URLs will be constructed using the base URL.
82
84
  DocumentationBaseURL: https://docs.rubocop.org/rubocop
85
+ # Documentation URLs will end with this extension.
86
+ DocumentationExtension: .html
83
87
  # Extra details are not displayed in offense messages by default. Change
84
88
  # behavior by overriding ExtraDetails, or by giving the
85
89
  # `-E/--extra-details` option.
@@ -140,8 +144,14 @@ AllCops:
140
144
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
141
145
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
142
146
  # Ruby version is still unresolved, RuboCop will use the oldest officially
143
- # supported Ruby version (currently Ruby 2.6).
147
+ # supported Ruby version (currently Ruby 2.7).
144
148
  TargetRubyVersion: ~
149
+ # You can specify the parser engine. There are two options available:
150
+ # - `parser_whitequark` ... https://github.com/whitequark/parser
151
+ # - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
152
+ # By default, `parser` is used. For the `TargetRubyVersion` value, `parser` can be specified for versions `2.0` and above.
153
+ # `parser_prism` can be specified for versions `3.3` and above. `parser_prism` is faster but still considered experimental.
154
+ ParserEngine: parser_whitequark
145
155
  # Determines if a notification for extension libraries should be shown when
146
156
  # rubocop is run. Keys are the name of the extension, and values are an array
147
157
  # of gems in the Gemfile that the extension is suggested for, if not already
@@ -154,8 +164,15 @@ AllCops:
154
164
  rubocop-rake: [rake]
155
165
  rubocop-graphql: [graphql]
156
166
  rubocop-capybara: [capybara]
167
+ rubocop-factory_bot: [factory_bot, factory_bot_rails]
168
+ rubocop-rspec_rails: [rspec-rails]
157
169
  # Enable/Disable checking the methods extended by Active Support.
158
170
  ActiveSupportExtensionsEnabled: false
171
+ # Future version of Ruby will freeze string literals by default.
172
+ # This allows to opt in early, for example when enabled through RUBYOPT.
173
+ # For now this will behave as if set to false but in future ruby versions
174
+ # (likely 4.0) it will be true by default.
175
+ StringLiteralsFrozenByDefault: ~
159
176
 
160
177
  #################### Bundler ###############################
161
178
 
@@ -170,6 +187,16 @@ Bundler/DuplicatedGem:
170
187
  - '**/Gemfile'
171
188
  - '**/gems.rb'
172
189
 
190
+ Bundler/DuplicatedGroup:
191
+ Description: 'Checks for duplicate group entries in Gemfile.'
192
+ Enabled: true
193
+ Severity: warning
194
+ VersionAdded: '1.56'
195
+ Include:
196
+ - '**/*.gemfile'
197
+ - '**/Gemfile'
198
+ - '**/gems.rb'
199
+
173
200
  Bundler/GemComment:
174
201
  Description: 'Add a comment describing each gem.'
175
202
  Enabled: false
@@ -242,6 +269,15 @@ Bundler/OrderedGems:
242
269
 
243
270
  #################### Gemspec ###############################
244
271
 
272
+ Gemspec/AddRuntimeDependency:
273
+ Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
274
+ StyleGuide: '#add_dependency_vs_add_runtime_dependency'
275
+ Reference: https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
276
+ Enabled: pending
277
+ VersionAdded: '1.65'
278
+ Include:
279
+ - '**/*.gemspec'
280
+
245
281
  Gemspec/DependencyVersion:
246
282
  Description: 'Requires or forbids specifying gem dependency versions.'
247
283
  Enabled: false
@@ -466,7 +502,9 @@ Layout/ClassStructure:
466
502
  Description: 'Enforces a configured order of definitions within a class body.'
467
503
  StyleGuide: '#consistent-classes'
468
504
  Enabled: false
505
+ SafeAutoCorrect: false
469
506
  VersionAdded: '0.52'
507
+ VersionChanged: '1.53'
470
508
  Categories:
471
509
  module_inclusion:
472
510
  - include
@@ -541,7 +579,9 @@ Layout/ElseAlignment:
541
579
  Layout/EmptyComment:
542
580
  Description: 'Checks empty comment.'
543
581
  Enabled: true
582
+ AutoCorrect: contextual
544
583
  VersionAdded: '0.53'
584
+ VersionChanged: '1.61'
545
585
  AllowBorderComment: true
546
586
  AllowMarginComment: true
547
587
 
@@ -574,6 +614,8 @@ Layout/EmptyLineBetweenDefs:
574
614
  EmptyLineBetweenMethodDefs: true
575
615
  EmptyLineBetweenClassDefs: true
576
616
  EmptyLineBetweenModuleDefs: true
617
+ # `DefLikeMacros` takes the name of any macro that you want to treat like a def.
618
+ DefLikeMacros: []
577
619
  # `AllowAdjacentOneLineDefs` means that single line method definitions don't
578
620
  # need an empty line between them. `true` by default.
579
621
  AllowAdjacentOneLineDefs: true
@@ -819,6 +861,7 @@ Layout/FirstMethodArgumentLineBreak:
819
861
  Enabled: false
820
862
  VersionAdded: '0.49'
821
863
  AllowMultilineFinalElement: false
864
+ AllowedMethods: []
822
865
 
823
866
  Layout/FirstMethodParameterLineBreak:
824
867
  Description: >-
@@ -994,6 +1037,8 @@ Layout/LeadingCommentSpace:
994
1037
  VersionChanged: '0.73'
995
1038
  AllowDoxygenCommentStyle: false
996
1039
  AllowGemfileRubyComment: false
1040
+ AllowRBSInlineAnnotation: false
1041
+ AllowSteepAnnotation: false
997
1042
 
998
1043
  Layout/LeadingEmptyLines:
999
1044
  Description: Check for unnecessary blank lines at the beginning of a file.
@@ -1334,6 +1379,10 @@ Layout/SpaceAroundOperators:
1334
1379
  SupportedStylesForExponentOperator:
1335
1380
  - space
1336
1381
  - no_space
1382
+ EnforcedStyleForRationalLiterals: no_space
1383
+ SupportedStylesForRationalLiterals:
1384
+ - space
1385
+ - no_space
1337
1386
 
1338
1387
  Layout/SpaceBeforeBlockBraces:
1339
1388
  Description: >-
@@ -1529,7 +1578,6 @@ Lint/AmbiguousBlockAssociation:
1529
1578
  Description: >-
1530
1579
  Checks for ambiguous block association with method when param passed without
1531
1580
  parentheses.
1532
- StyleGuide: '#syntax'
1533
1581
  Enabled: true
1534
1582
  VersionAdded: '0.48'
1535
1583
  VersionChanged: '1.13'
@@ -1629,7 +1677,7 @@ Lint/Debugger:
1629
1677
  Description: 'Check for debugger calls.'
1630
1678
  Enabled: true
1631
1679
  VersionAdded: '0.14'
1632
- VersionChanged: '1.46'
1680
+ VersionChanged: '1.63'
1633
1681
  DebuggerMethods:
1634
1682
  # Groups are available so that a specific group can be disabled in
1635
1683
  # a user's configuration, but are otherwise not significant.
@@ -1642,8 +1690,14 @@ Lint/Debugger:
1642
1690
  - Kernel.byebug
1643
1691
  - Kernel.remote_byebug
1644
1692
  Capybara:
1693
+ - page.save_and_open_page
1694
+ - page.save_and_open_screenshot
1695
+ - page.save_page
1696
+ - page.save_screenshot
1645
1697
  - save_and_open_page
1646
1698
  - save_and_open_screenshot
1699
+ - save_page
1700
+ - save_screenshot
1647
1701
  debug.rb:
1648
1702
  - binding.b
1649
1703
  - binding.break
@@ -1665,6 +1719,10 @@ Lint/Debugger:
1665
1719
  - jard
1666
1720
  WebConsole:
1667
1721
  - binding.console
1722
+ DebuggerRequires:
1723
+ debug.rb:
1724
+ - debug/open
1725
+ - debug/start
1668
1726
 
1669
1727
  Lint/DeprecatedClassMethods:
1670
1728
  Description: 'Check for deprecated class method calls.'
@@ -1728,6 +1786,7 @@ Lint/DuplicateBranch:
1728
1786
  VersionChanged: '1.7'
1729
1787
  IgnoreLiteralBranches: false
1730
1788
  IgnoreConstantBranches: false
1789
+ IgnoreDuplicateElseBranch: false
1731
1790
 
1732
1791
  Lint/DuplicateCaseCondition:
1733
1792
  Description: 'Do not repeat values in case conditionals.'
@@ -1777,6 +1836,11 @@ Lint/DuplicateRescueException:
1777
1836
  Enabled: true
1778
1837
  VersionAdded: '0.89'
1779
1838
 
1839
+ Lint/DuplicateSetElement:
1840
+ Description: 'Checks for duplicate elements in Set.'
1841
+ Enabled: pending
1842
+ VersionAdded: '1.67'
1843
+
1780
1844
  Lint/EachWithObjectArgument:
1781
1845
  Description: 'Check for immutable argument given to each_with_object.'
1782
1846
  Enabled: true
@@ -1805,16 +1869,18 @@ Lint/EmptyClass:
1805
1869
  Lint/EmptyConditionalBody:
1806
1870
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1807
1871
  Enabled: true
1872
+ AutoCorrect: contextual
1808
1873
  SafeAutoCorrect: false
1809
1874
  AllowComments: true
1810
1875
  VersionAdded: '0.89'
1811
- VersionChanged: '1.34'
1876
+ VersionChanged: '1.61'
1812
1877
 
1813
1878
  Lint/EmptyEnsure:
1814
1879
  Description: 'Checks for empty ensure block.'
1815
1880
  Enabled: true
1881
+ AutoCorrect: contextual
1816
1882
  VersionAdded: '0.10'
1817
- VersionChanged: '0.48'
1883
+ VersionChanged: '1.61'
1818
1884
 
1819
1885
  Lint/EmptyExpression:
1820
1886
  Description: 'Checks for empty expressions.'
@@ -1836,8 +1902,9 @@ Lint/EmptyInPattern:
1836
1902
  Lint/EmptyInterpolation:
1837
1903
  Description: 'Checks for empty string interpolation.'
1838
1904
  Enabled: true
1905
+ AutoCorrect: contextual
1839
1906
  VersionAdded: '0.20'
1840
- VersionChanged: '0.45'
1907
+ VersionChanged: '1.61'
1841
1908
 
1842
1909
  Lint/EmptyWhen:
1843
1910
  Description: 'Checks for `when` branches with empty bodies.'
@@ -1943,6 +2010,12 @@ Lint/InterpolationCheck:
1943
2010
  VersionAdded: '0.50'
1944
2011
  VersionChanged: '1.40'
1945
2012
 
2013
+ Lint/ItWithoutArgumentsInBlock:
2014
+ Description: 'Checks uses of `it` calls without arguments in block.'
2015
+ Reference: 'https://bugs.ruby-lang.org/issues/18980'
2016
+ Enabled: pending
2017
+ VersionAdded: '1.59'
2018
+
1946
2019
  Lint/LambdaWithoutLiteralBlock:
1947
2020
  Description: 'Checks uses of lambda without a literal block.'
1948
2021
  Enabled: pending
@@ -1953,6 +2026,11 @@ Lint/LiteralAsCondition:
1953
2026
  Enabled: true
1954
2027
  VersionAdded: '0.51'
1955
2028
 
2029
+ Lint/LiteralAssignmentInCondition:
2030
+ Description: 'Checks for literal assignments in the conditions.'
2031
+ Enabled: pending
2032
+ VersionAdded: '1.58'
2033
+
1956
2034
  Lint/LiteralInInterpolation:
1957
2035
  Description: 'Checks for literals used in interpolation.'
1958
2036
  Enabled: true
@@ -1987,9 +2065,16 @@ Lint/MissingSuper:
1987
2065
  Checks for the presence of constructors and lifecycle callbacks
1988
2066
  without calls to `super`.
1989
2067
  Enabled: true
2068
+ AllowedParentClasses: []
1990
2069
  VersionAdded: '0.89'
1991
2070
  VersionChanged: '1.4'
1992
2071
 
2072
+ Lint/MixedCaseRange:
2073
+ Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
2074
+ Enabled: pending
2075
+ SafeAutoCorrect: false
2076
+ VersionAdded: '1.53'
2077
+
1993
2078
  Lint/MixedRegexpCaptureTypes:
1994
2079
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1995
2080
  Enabled: true
@@ -2139,10 +2224,17 @@ Lint/RedundantDirGlobSort:
2139
2224
  VersionChanged: '1.26'
2140
2225
  SafeAutoCorrect: false
2141
2226
 
2227
+ Lint/RedundantRegexpQuantifiers:
2228
+ Description: 'Checks for redundant quantifiers in Regexps.'
2229
+ Enabled: pending
2230
+ VersionAdded: '1.53'
2231
+
2142
2232
  Lint/RedundantRequireStatement:
2143
2233
  Description: 'Checks for unnecessary `require` statement.'
2144
2234
  Enabled: true
2235
+ SafeAutoCorrect: false
2145
2236
  VersionAdded: '0.76'
2237
+ VersionChanged: '1.57'
2146
2238
 
2147
2239
  Lint/RedundantSafeNavigation:
2148
2240
  Description: 'Checks for redundant safe navigation calls.'
@@ -2244,9 +2336,9 @@ Lint/SafeNavigationChain:
2244
2336
 
2245
2337
  Lint/SafeNavigationConsistency:
2246
2338
  Description: >-
2247
- Check to make sure that if safe navigation is used for a method
2248
- call in an `&&` or `||` condition that safe navigation is used
2249
- for all method calls on that same object.
2339
+ Check to make sure that if safe navigation is used in an `&&` or `||` condition,
2340
+ consistent and appropriate safe navigation, without excess or deficiency,
2341
+ is used for all method calls on the same object.
2250
2342
  Enabled: true
2251
2343
  VersionAdded: '0.55'
2252
2344
  VersionChanged: '0.77'
@@ -2343,11 +2435,16 @@ Lint/TopLevelReturnWithArgument:
2343
2435
  Description: 'Detects top level return statements with argument.'
2344
2436
  Enabled: true
2345
2437
  VersionAdded: '0.89'
2438
+ # These codes are `eval`-ed in method and their return values may be used.
2439
+ Exclude:
2440
+ - '**/*.jb'
2346
2441
 
2347
2442
  Lint/TrailingCommaInAttributeDeclaration:
2348
2443
  Description: 'Checks for trailing commas in attribute declarations.'
2349
2444
  Enabled: true
2445
+ AutoCorrect: contextual
2350
2446
  VersionAdded: '0.90'
2447
+ VersionChanged: '1.61'
2351
2448
 
2352
2449
  Lint/TripleQuotes:
2353
2450
  Description: 'Checks for useless triple quote constructs.'
@@ -2360,6 +2457,11 @@ Lint/UnderscorePrefixedVariableName:
2360
2457
  VersionAdded: '0.21'
2361
2458
  AllowKeywordBlockArguments: false
2362
2459
 
2460
+ Lint/UnescapedBracketInRegexp:
2461
+ Description: 'Checks for unescaped literal `]` in Regexp.'
2462
+ Enabled: pending
2463
+ VersionAdded: '1.68'
2464
+
2363
2465
  Lint/UnexpectedBlockArity:
2364
2466
  Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2365
2467
  Enabled: pending
@@ -2407,8 +2509,9 @@ Lint/UnusedBlockArgument:
2407
2509
  Description: 'Checks for unused block arguments.'
2408
2510
  StyleGuide: '#underscore-unused-vars'
2409
2511
  Enabled: true
2512
+ AutoCorrect: contextual
2410
2513
  VersionAdded: '0.21'
2411
- VersionChanged: '0.22'
2514
+ VersionChanged: '1.61'
2412
2515
  IgnoreEmptyBlocks: true
2413
2516
  AllowUnusedKeywordArguments: false
2414
2517
 
@@ -2416,8 +2519,9 @@ Lint/UnusedMethodArgument:
2416
2519
  Description: 'Checks for unused method arguments.'
2417
2520
  StyleGuide: '#underscore-unused-vars'
2418
2521
  Enabled: true
2522
+ AutoCorrect: contextual
2419
2523
  VersionAdded: '0.21'
2420
- VersionChanged: '0.81'
2524
+ VersionChanged: '1.61'
2421
2525
  AllowUnusedKeywordArguments: false
2422
2526
  IgnoreEmptyMethods: true
2423
2527
  IgnoreNotImplementedMethods: true
@@ -2441,8 +2545,9 @@ Lint/UriRegexp:
2441
2545
  Lint/UselessAccessModifier:
2442
2546
  Description: 'Checks for useless access modifiers.'
2443
2547
  Enabled: true
2548
+ AutoCorrect: contextual
2444
2549
  VersionAdded: '0.20'
2445
- VersionChanged: '0.83'
2550
+ VersionChanged: '1.61'
2446
2551
  ContextCreatingMethods: []
2447
2552
  MethodCreatingMethods: []
2448
2553
 
@@ -2450,7 +2555,9 @@ Lint/UselessAssignment:
2450
2555
  Description: 'Checks for useless assignment to a local variable.'
2451
2556
  StyleGuide: '#underscore-unused-vars'
2452
2557
  Enabled: true
2558
+ AutoCorrect: contextual
2453
2559
  VersionAdded: '0.11'
2560
+ VersionChanged: '1.66'
2454
2561
 
2455
2562
  Lint/UselessElseWithoutRescue:
2456
2563
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
@@ -2461,10 +2568,16 @@ Lint/UselessElseWithoutRescue:
2461
2568
  Lint/UselessMethodDefinition:
2462
2569
  Description: 'Checks for useless method definitions.'
2463
2570
  Enabled: true
2571
+ AutoCorrect: contextual
2464
2572
  VersionAdded: '0.90'
2465
- VersionChanged: '0.91'
2573
+ VersionChanged: '1.61'
2466
2574
  Safe: false
2467
2575
 
2576
+ Lint/UselessNumericOperation:
2577
+ Description: 'Checks for useless numeric operations.'
2578
+ Enabled: pending
2579
+ VersionAdded: '1.66'
2580
+
2468
2581
  Lint/UselessRescue:
2469
2582
  Description: 'Checks for useless `rescue`s.'
2470
2583
  Enabled: pending
@@ -2478,21 +2591,24 @@ Lint/UselessRuby2Keywords:
2478
2591
  Lint/UselessSetterCall:
2479
2592
  Description: 'Checks for useless setter call to a local variable.'
2480
2593
  Enabled: true
2481
- SafeAutoCorrect: false
2594
+ Safe: false
2482
2595
  VersionAdded: '0.13'
2483
2596
  VersionChanged: '1.2'
2484
- Safe: false
2485
2597
 
2486
2598
  Lint/UselessTimes:
2487
2599
  Description: 'Checks for useless `Integer#times` calls.'
2488
2600
  Enabled: true
2489
- VersionAdded: '0.91'
2490
2601
  Safe: false
2602
+ AutoCorrect: contextual
2603
+ VersionAdded: '0.91'
2604
+ VersionChanged: '1.61'
2491
2605
 
2492
2606
  Lint/Void:
2493
2607
  Description: 'Possible use of operator/literal/variable in void context.'
2494
2608
  Enabled: true
2609
+ AutoCorrect: contextual
2495
2610
  VersionAdded: '0.9'
2611
+ VersionChanged: '1.61'
2496
2612
  CheckForMethodsWithNoSideEffects: false
2497
2613
 
2498
2614
  #################### Metrics ###############################
@@ -2535,8 +2651,9 @@ Metrics/BlockNesting:
2535
2651
  StyleGuide: '#three-is-the-number-thou-shalt-count'
2536
2652
  Enabled: true
2537
2653
  VersionAdded: '0.25'
2538
- VersionChanged: '0.47'
2654
+ VersionChanged: '1.65'
2539
2655
  CountBlocks: false
2656
+ CountModifierForms: false
2540
2657
  Max: 3
2541
2658
 
2542
2659
  Metrics/ClassLength:
@@ -2691,7 +2808,8 @@ Naming/FileName:
2691
2808
  VersionChanged: '1.23'
2692
2809
  # Camel case file names listed in `AllCops:Include` and all file names listed
2693
2810
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2694
- Exclude: []
2811
+ Exclude:
2812
+ - Rakefile.rb
2695
2813
  # When `true`, requires that each source file should define a class or module
2696
2814
  # with a name which matches the file name (converted to ... case).
2697
2815
  # It further expects it to be nested inside modules which match the names
@@ -2942,7 +3060,9 @@ Naming/VariableNumber:
2942
3060
  Security/CompoundHash:
2943
3061
  Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
2944
3062
  Enabled: pending
3063
+ Safe: false
2945
3064
  VersionAdded: '1.28'
3065
+ VersionChanged: '1.51'
2946
3066
 
2947
3067
  Security/Eval:
2948
3068
  Description: 'The use of eval represents a serious security risk.'
@@ -3005,6 +3125,7 @@ Style/AccessModifierDeclarations:
3005
3125
  - inline
3006
3126
  - group
3007
3127
  AllowModifiersOnSymbols: true
3128
+ AllowModifiersOnAttrs: true
3008
3129
  SafeAutoCorrect: false
3009
3130
 
3010
3131
  Style/AccessorGrouping:
@@ -3029,6 +3150,12 @@ Style/Alias:
3029
3150
  - prefer_alias
3030
3151
  - prefer_alias_method
3031
3152
 
3153
+ Style/AmbiguousEndlessMethodDefinition:
3154
+ Description: 'Checks for endless methods inside operators of lower precedence.'
3155
+ StyleGuide: '#ambiguous-endless-method-defintions'
3156
+ Enabled: pending
3157
+ VersionAdded: '1.68'
3158
+
3032
3159
  Style/AndOr:
3033
3160
  Description: 'Use &&/|| instead of and/or.'
3034
3161
  StyleGuide: '#no-and-or-or'
@@ -3048,7 +3175,20 @@ Style/ArgumentsForwarding:
3048
3175
  StyleGuide: '#arguments-forwarding'
3049
3176
  Enabled: pending
3050
3177
  AllowOnlyRestArgument: true
3178
+ UseAnonymousForwarding: true
3179
+ RedundantRestArgumentNames:
3180
+ - args
3181
+ - arguments
3182
+ RedundantKeywordRestArgumentNames:
3183
+ - kwargs
3184
+ - options
3185
+ - opts
3186
+ RedundantBlockArgumentNames:
3187
+ - blk
3188
+ - block
3189
+ - proc
3051
3190
  VersionAdded: '1.1'
3191
+ VersionChanged: '1.58'
3052
3192
 
3053
3193
  Style/ArrayCoercion:
3054
3194
  Description: >-
@@ -3059,6 +3199,13 @@ Style/ArrayCoercion:
3059
3199
  Enabled: false
3060
3200
  VersionAdded: '0.88'
3061
3201
 
3202
+ Style/ArrayFirstLast:
3203
+ Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3204
+ Reference: '#first-and-last'
3205
+ Enabled: false
3206
+ VersionAdded: '1.58'
3207
+ Safe: false
3208
+
3062
3209
  Style/ArrayIntersect:
3063
3210
  Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
3064
3211
  Enabled: 'pending'
@@ -3116,6 +3263,13 @@ Style/BisectedAttrAccessor:
3116
3263
  Enabled: true
3117
3264
  VersionAdded: '0.87'
3118
3265
 
3266
+ Style/BitwisePredicate:
3267
+ Description: 'Prefer bitwise predicate methods over direct comparison operations.'
3268
+ StyleGuide: '#bitwise-predicate-methods'
3269
+ Enabled: pending
3270
+ Safe: false
3271
+ VersionAdded: '1.68'
3272
+
3119
3273
  Style/BlockComments:
3120
3274
  Description: 'Do not use block comments.'
3121
3275
  StyleGuide: '#no-block-comments'
@@ -3319,7 +3473,9 @@ Style/ClassEqualityComparison:
3319
3473
  Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3320
3474
  StyleGuide: '#instance-of-vs-class-comparison'
3321
3475
  Enabled: true
3476
+ SafeAutoCorrect: false
3322
3477
  VersionAdded: '0.93'
3478
+ VersionChanged: '1.57'
3323
3479
  AllowedMethods:
3324
3480
  - ==
3325
3481
  - equal?
@@ -3355,6 +3511,7 @@ Style/CollectionCompact:
3355
3511
  Safe: false
3356
3512
  VersionAdded: '1.2'
3357
3513
  VersionChanged: '1.3'
3514
+ AllowedReceivers: []
3358
3515
 
3359
3516
  # Align with the style guide.
3360
3517
  Style/CollectionMethods:
@@ -3373,6 +3530,7 @@ Style/CollectionMethods:
3373
3530
  PreferredMethods:
3374
3531
  collect: 'map'
3375
3532
  collect!: 'map!'
3533
+ collect_concat: 'flat_map'
3376
3534
  inject: 'reduce'
3377
3535
  detect: 'find'
3378
3536
  find_all: 'select'
@@ -3395,6 +3553,11 @@ Style/ColonMethodDefinition:
3395
3553
  Enabled: true
3396
3554
  VersionAdded: '0.52'
3397
3555
 
3556
+ Style/CombinableDefined:
3557
+ Description: 'Checks successive `defined?` calls that can be combined into a single call.'
3558
+ Enabled: pending
3559
+ VersionAdded: '1.68'
3560
+
3398
3561
  Style/CombinableLoops:
3399
3562
  Description: >-
3400
3563
  Checks for places where multiple consecutive loops over the same data
@@ -3515,7 +3678,9 @@ Style/DataInheritance:
3515
3678
  Description: 'Checks for inheritance from Data.define.'
3516
3679
  StyleGuide: '#no-extend-data-define'
3517
3680
  Enabled: pending
3681
+ SafeAutoCorrect: false
3518
3682
  VersionAdded: '1.49'
3683
+ VersionChanged: '1.51'
3519
3684
 
3520
3685
  Style/DateTime:
3521
3686
  Description: 'Use Time over DateTime.'
@@ -3576,6 +3741,7 @@ Style/DocumentationMethod:
3576
3741
  Description: 'Checks for missing documentation comment for public methods.'
3577
3742
  Enabled: false
3578
3743
  VersionAdded: '0.43'
3744
+ AllowedMethods: []
3579
3745
  Exclude:
3580
3746
  - 'spec/**/*'
3581
3747
  - 'test/**/*'
@@ -3624,8 +3790,9 @@ Style/EmptyCaseCondition:
3624
3790
  Style/EmptyElse:
3625
3791
  Description: 'Avoid empty else-clauses.'
3626
3792
  Enabled: true
3793
+ AutoCorrect: contextual
3627
3794
  VersionAdded: '0.28'
3628
- VersionChanged: '0.32'
3795
+ VersionChanged: '1.61'
3629
3796
  EnforcedStyle: both
3630
3797
  # empty - warn only on empty `else`
3631
3798
  # nil - warn on `else` with nil in it
@@ -3639,7 +3806,9 @@ Style/EmptyElse:
3639
3806
  Style/EmptyHeredoc:
3640
3807
  Description: 'Checks for using empty heredoc to reduce redundancy.'
3641
3808
  Enabled: pending
3809
+ AutoCorrect: contextual
3642
3810
  VersionAdded: '1.32'
3811
+ VersionChanged: '1.61'
3643
3812
 
3644
3813
  Style/EmptyLambdaParameter:
3645
3814
  Description: 'Omit parens for empty lambda parameters.'
@@ -3657,7 +3826,9 @@ Style/EmptyMethod:
3657
3826
  Description: 'Checks the formatting of empty method definitions.'
3658
3827
  StyleGuide: '#no-single-line-methods'
3659
3828
  Enabled: true
3829
+ AutoCorrect: contextual
3660
3830
  VersionAdded: '0.46'
3831
+ VersionChanged: '1.61'
3661
3832
  EnforcedStyle: compact
3662
3833
  SupportedStyles:
3663
3834
  - compact
@@ -3706,6 +3877,11 @@ Style/EvenOdd:
3706
3877
  VersionAdded: '0.12'
3707
3878
  VersionChanged: '0.29'
3708
3879
 
3880
+ Style/ExactRegexpMatch:
3881
+ Description: 'Checks for exact regexp match inside Regexp literals.'
3882
+ Enabled: pending
3883
+ VersionAdded: '1.51'
3884
+
3709
3885
  Style/ExpandPathArguments:
3710
3886
  Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3711
3887
  Enabled: true
@@ -3884,8 +4060,9 @@ Style/HashConversion:
3884
4060
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3885
4061
  StyleGuide: '#avoid-hash-constructor'
3886
4062
  Enabled: pending
4063
+ SafeAutoCorrect: false
3887
4064
  VersionAdded: '1.10'
3888
- VersionChanged: '1.11'
4065
+ VersionChanged: '1.55'
3889
4066
  AllowSplatArgument: true
3890
4067
 
3891
4068
  Style/HashEachMethods:
@@ -3924,7 +4101,7 @@ Style/HashSyntax:
3924
4101
  StyleGuide: '#hash-literals'
3925
4102
  Enabled: true
3926
4103
  VersionAdded: '0.9'
3927
- VersionChanged: '1.24'
4104
+ VersionChanged: '1.67'
3928
4105
  EnforcedStyle: ruby19
3929
4106
  SupportedStyles:
3930
4107
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -3936,7 +4113,7 @@ Style/HashSyntax:
3936
4113
  # enforces both ruby19 and no_mixed_keys styles
3937
4114
  - ruby19_no_mixed_keys
3938
4115
  # Force hashes that have a hash value omission
3939
- EnforcedShorthandSyntax: always
4116
+ EnforcedShorthandSyntax: either
3940
4117
  SupportedShorthandSyntax:
3941
4118
  # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3942
4119
  - always
@@ -3946,6 +4123,8 @@ Style/HashSyntax:
3946
4123
  - either
3947
4124
  # forces use of the 3.1 syntax only if all values can be omitted in the hash.
3948
4125
  - consistent
4126
+ # allow either (implicit or explicit) syntax but enforce consistency within a single hash
4127
+ - either_consistent
3949
4128
  # Force hashes that have a symbol value to use hash rockets
3950
4129
  UseHashRocketsWithSymbolValues: false
3951
4130
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -4086,14 +4265,6 @@ Style/InvertibleUnlessCondition:
4086
4265
  :none?: :any?
4087
4266
  :even?: :odd?
4088
4267
  :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
4268
 
4098
4269
  Style/IpAddresses:
4099
4270
  Description: "Don't include literal IP addresses in code."
@@ -4110,6 +4281,14 @@ Style/IpAddresses:
4110
4281
  - '**/gems.rb'
4111
4282
  - '**/*.gemspec'
4112
4283
 
4284
+ Style/KeywordArgumentsMerging:
4285
+ Description: >-
4286
+ When passing an existing hash as keyword arguments, provide additional arguments
4287
+ directly rather than using `merge`.
4288
+ StyleGuide: '#merging-keyword-arguments'
4289
+ Enabled: pending
4290
+ VersionAdded: '1.68'
4291
+
4113
4292
  Style/KeywordParametersOrder:
4114
4293
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
4115
4294
  StyleGuide: '#keyword-parameters-order'
@@ -4174,6 +4353,14 @@ Style/MapCompactWithConditionalBlock:
4174
4353
  Enabled: pending
4175
4354
  VersionAdded: '1.30'
4176
4355
 
4356
+ Style/MapIntoArray:
4357
+ Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
4358
+ StyleGuide: '#functional-code'
4359
+ Enabled: pending
4360
+ VersionAdded: '1.63'
4361
+ VersionChanged: '1.67'
4362
+ Safe: false
4363
+
4177
4364
  Style/MapToHash:
4178
4365
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
4179
4366
  Enabled: pending
@@ -4370,6 +4557,7 @@ Style/MultipleComparison:
4370
4557
  VersionAdded: '0.49'
4371
4558
  VersionChanged: '1.1'
4372
4559
  AllowMethodComparison: true
4560
+ ComparisonsThreshold: 2
4373
4561
 
4374
4562
  Style/MutableConstant:
4375
4563
  Description: 'Do not assign mutable objects to constants.'
@@ -4624,7 +4812,9 @@ Style/OpenStructUse:
4624
4812
  - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4625
4813
 
4626
4814
  Enabled: pending
4815
+ Safe: false
4627
4816
  VersionAdded: '1.23'
4817
+ VersionChanged: '1.51'
4628
4818
 
4629
4819
  Style/OperatorMethodCall:
4630
4820
  Description: 'Checks for redundant dot before operator method call.'
@@ -4634,6 +4824,7 @@ Style/OperatorMethodCall:
4634
4824
 
4635
4825
  Style/OptionHash:
4636
4826
  Description: "Don't use option hashes when you can use keyword arguments."
4827
+ StyleGuide: '#keyword-arguments-vs-option-hashes'
4637
4828
  Enabled: false
4638
4829
  VersionAdded: '0.33'
4639
4830
  VersionChanged: '0.34'
@@ -4756,8 +4947,9 @@ Style/RaiseArgs:
4756
4947
  Description: 'Checks the arguments passed to raise/fail.'
4757
4948
  StyleGuide: '#exception-class-messages'
4758
4949
  Enabled: true
4950
+ Safe: false
4759
4951
  VersionAdded: '0.14'
4760
- VersionChanged: '1.2'
4952
+ VersionChanged: '1.61'
4761
4953
  EnforcedStyle: exploded
4762
4954
  SupportedStyles:
4763
4955
  - compact # raise Exception.new(msg)
@@ -4777,12 +4969,16 @@ Style/RedundantArgument:
4777
4969
  Enabled: pending
4778
4970
  Safe: false
4779
4971
  VersionAdded: '1.4'
4780
- VersionChanged: '1.40'
4972
+ VersionChanged: '1.55'
4781
4973
  Methods:
4782
4974
  # Array#join
4783
4975
  join: ''
4784
4976
  # Array#sum
4785
4977
  sum: 0
4978
+ # Kernel.#exit
4979
+ exit: true
4980
+ # Kernel.#exit!
4981
+ exit!: false
4786
4982
  # String#split
4787
4983
  split: ' '
4788
4984
  # String#chomp
@@ -4790,6 +4986,11 @@ Style/RedundantArgument:
4790
4986
  # String#chomp!
4791
4987
  chomp!: "\n"
4792
4988
 
4989
+ Style/RedundantArrayConstructor:
4990
+ Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
4991
+ Enabled: pending
4992
+ VersionAdded: '1.52'
4993
+
4793
4994
  Style/RedundantAssignment:
4794
4995
  Description: 'Checks for redundant assignment before returning.'
4795
4996
  Enabled: true
@@ -4822,6 +5023,11 @@ Style/RedundantConstantBase:
4822
5023
  Enabled: pending
4823
5024
  VersionAdded: '1.40'
4824
5025
 
5026
+ Style/RedundantCurrentDirectoryInPath:
5027
+ Description: 'Checks for uses a redundant current directory in path.'
5028
+ Enabled: pending
5029
+ VersionAdded: '1.53'
5030
+
4825
5031
  Style/RedundantDoubleSplatHashBraces:
4826
5032
  Description: 'Checks for redundant uses of double splat hash braces.'
4827
5033
  Enabled: pending
@@ -4844,7 +5050,7 @@ Style/RedundantFetchBlock:
4844
5050
  Description: >-
4845
5051
  Use `fetch(key, value)` instead of `fetch(key) { value }`
4846
5052
  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'
5053
+ Reference: 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4848
5054
  Enabled: true
4849
5055
  Safe: false
4850
5056
  # If enabled, this cop will autocorrect usages of
@@ -4861,6 +5067,15 @@ Style/RedundantFileExtensionInRequire:
4861
5067
  Enabled: true
4862
5068
  VersionAdded: '0.88'
4863
5069
 
5070
+ Style/RedundantFilterChain:
5071
+ Description: >-
5072
+ Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
5073
+ `select`/`filter`/`find_all` and change them to use predicate method instead.
5074
+ Enabled: pending
5075
+ SafeAutoCorrect: false
5076
+ VersionAdded: '1.52'
5077
+ VersionChanged: '1.57'
5078
+
4864
5079
  Style/RedundantFreeze:
4865
5080
  Description: "Checks usages of Object#freeze on immutable objects."
4866
5081
  Enabled: true
@@ -4875,10 +5090,11 @@ Style/RedundantHeredocDelimiterQuotes:
4875
5090
  Style/RedundantInitialize:
4876
5091
  Description: 'Checks for redundant `initialize` methods.'
4877
5092
  Enabled: pending
5093
+ AutoCorrect: contextual
4878
5094
  Safe: false
4879
5095
  AllowComments: true
4880
5096
  VersionAdded: '1.27'
4881
- VersionChanged: '1.28'
5097
+ VersionChanged: '1.61'
4882
5098
 
4883
5099
  Style/RedundantInterpolation:
4884
5100
  Description: 'Checks for strings that are just an interpolated expression.'
@@ -4887,6 +5103,11 @@ Style/RedundantInterpolation:
4887
5103
  VersionAdded: '0.76'
4888
5104
  VersionChanged: '1.30'
4889
5105
 
5106
+ Style/RedundantInterpolationUnfreeze:
5107
+ Description: 'Checks for redundant unfreezing of interpolated strings.'
5108
+ Enabled: pending
5109
+ VersionAdded: '1.66'
5110
+
4890
5111
  Style/RedundantLineContinuation:
4891
5112
  Description: 'Check for redundant line continuation.'
4892
5113
  Enabled: pending
@@ -4903,11 +5124,21 @@ Style/RedundantPercentQ:
4903
5124
  Enabled: true
4904
5125
  VersionAdded: '0.76'
4905
5126
 
5127
+ Style/RedundantRegexpArgument:
5128
+ Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
5129
+ Enabled: pending
5130
+ VersionAdded: '1.53'
5131
+
4906
5132
  Style/RedundantRegexpCharacterClass:
4907
5133
  Description: 'Checks for unnecessary single-element Regexp character classes.'
4908
5134
  Enabled: true
4909
5135
  VersionAdded: '0.85'
4910
5136
 
5137
+ Style/RedundantRegexpConstructor:
5138
+ Description: 'Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.'
5139
+ Enabled: pending
5140
+ VersionAdded: '1.52'
5141
+
4911
5142
  Style/RedundantRegexpEscape:
4912
5143
  Description: 'Checks for redundant escapes in Regexps.'
4913
5144
  Enabled: true
@@ -5010,6 +5241,16 @@ Style/ReturnNil:
5010
5241
  - return_nil
5011
5242
  VersionAdded: '0.50'
5012
5243
 
5244
+ Style/ReturnNilInPredicateMethodDefinition:
5245
+ Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
5246
+ StyleGuide: '#bool-methods-qmark'
5247
+ Enabled: pending
5248
+ SafeAutoCorrect: false
5249
+ AllowedMethods: []
5250
+ AllowedPatterns: []
5251
+ VersionAdded: '1.53'
5252
+ VersionChanged: '1.67'
5253
+
5013
5254
  Style/SafeNavigation:
5014
5255
  Description: >-
5015
5256
  Transforms usages of a method call safeguarded by
@@ -5019,7 +5260,7 @@ Style/SafeNavigation:
5019
5260
  be `nil` or truthy, but never `false`.
5020
5261
  Enabled: true
5021
5262
  VersionAdded: '0.43'
5022
- VersionChanged: '1.27'
5263
+ VersionChanged: '1.67'
5023
5264
  # Safe navigation may cause a statement to start returning `nil` in addition
5024
5265
  # to whatever it used to return.
5025
5266
  ConvertCodeThatCanStartToReturnNil: false
@@ -5033,11 +5274,18 @@ Style/SafeNavigation:
5033
5274
  # Maximum length of method chains for register an offense.
5034
5275
  MaxChainLength: 2
5035
5276
 
5277
+ Style/SafeNavigationChainLength:
5278
+ Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
5279
+ StyleGuide: '#safe-navigation'
5280
+ Enabled: pending
5281
+ VersionAdded: '1.68'
5282
+ Max: 2
5283
+
5036
5284
  Style/Sample:
5037
5285
  Description: >-
5038
5286
  Use `sample` instead of `shuffle.first`,
5039
5287
  `shuffle.last`, and `shuffle[Integer]`.
5040
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5288
+ Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5041
5289
  Enabled: true
5042
5290
  VersionAdded: '0.30'
5043
5291
 
@@ -5071,6 +5319,13 @@ Style/Send:
5071
5319
  Enabled: false
5072
5320
  VersionAdded: '0.33'
5073
5321
 
5322
+ Style/SendWithLiteralMethodName:
5323
+ Description: 'Detects the use of the `public_send` method with a static method name argument.'
5324
+ Enabled: pending
5325
+ Safe: false
5326
+ AllowSend: true
5327
+ VersionAdded: '1.64'
5328
+
5074
5329
  Style/SignalException:
5075
5330
  Description: 'Checks for proper usage of fail and raise.'
5076
5331
  StyleGuide: '#prefer-raise-over-fail'
@@ -5102,6 +5357,12 @@ Style/SingleLineBlockParams:
5102
5357
  - acc
5103
5358
  - elem
5104
5359
 
5360
+ Style/SingleLineDoEndBlock:
5361
+ Description: 'Checks for single-line `do`...`end` blocks.'
5362
+ StyleGuide: '#single-line-do-end-block'
5363
+ Enabled: pending
5364
+ VersionAdded: '1.57'
5365
+
5105
5366
  Style/SingleLineMethods:
5106
5367
  Description: 'Avoid single-line methods.'
5107
5368
  StyleGuide: '#no-single-line-methods'
@@ -5111,7 +5372,8 @@ Style/SingleLineMethods:
5111
5372
  AllowIfMethodIsEmpty: true
5112
5373
 
5113
5374
  Style/SlicingWithRange:
5114
- Description: 'Checks array slicing is done with endless ranges when suitable.'
5375
+ Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
5376
+ StyleGuide: '#slicing-with-ranges'
5115
5377
  Enabled: true
5116
5378
  VersionAdded: '0.83'
5117
5379
  Safe: false
@@ -5238,6 +5500,17 @@ Style/StructInheritance:
5238
5500
  VersionAdded: '0.29'
5239
5501
  VersionChanged: '1.20'
5240
5502
 
5503
+ Style/SuperArguments:
5504
+ Description: 'Call `super` without arguments and parentheses when the signature is identical.'
5505
+ Enabled: pending
5506
+ VersionAdded: '1.64'
5507
+
5508
+ Style/SuperWithArgsParentheses:
5509
+ Description: 'Use parentheses for `super` with arguments.'
5510
+ StyleGuide: '#super-with-args'
5511
+ Enabled: pending
5512
+ VersionAdded: '1.58'
5513
+
5241
5514
  Style/SwapValues:
5242
5515
  Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
5243
5516
  StyleGuide: '#values-swapping'
@@ -5267,7 +5540,7 @@ Style/SymbolProc:
5267
5540
  Enabled: true
5268
5541
  Safe: false
5269
5542
  VersionAdded: '0.26'
5270
- VersionChanged: '1.40'
5543
+ VersionChanged: '1.64'
5271
5544
  AllowMethodsWithArguments: false
5272
5545
  # A list of method names to be always allowed by the check.
5273
5546
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
@@ -5494,6 +5767,11 @@ Style/WordArray:
5494
5767
  # The regular expression `WordRegex` decides what is considered a word.
5495
5768
  WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
5496
5769
 
5770
+ Style/YAMLFileRead:
5771
+ Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
5772
+ Enabled: pending
5773
+ VersionAdded: '1.53'
5774
+
5497
5775
  Style/YodaCondition:
5498
5776
  Description: 'Forbid or enforce yoda conditions.'
5499
5777
  Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'