rubocop 1.71.1 → 1.88.2

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 (590) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +23 -19
  4. data/config/default.yml +513 -149
  5. data/config/internal_affairs.yml +20 -0
  6. data/config/obsoletion.yml +38 -4
  7. data/exe/rubocop +1 -8
  8. data/lib/rubocop/cache_config.rb +29 -0
  9. data/lib/rubocop/cli/command/auto_generate_config.rb +36 -4
  10. data/lib/rubocop/cli/command/list_enabled_cops_for.rb +40 -0
  11. data/lib/rubocop/cli/command/lsp.rb +1 -1
  12. data/lib/rubocop/cli/command/mcp.rb +19 -0
  13. data/lib/rubocop/cli/command/show_cops.rb +2 -2
  14. data/lib/rubocop/cli/command/show_docs_url.rb +4 -8
  15. data/lib/rubocop/cli/command/suggest_extensions.rb +8 -2
  16. data/lib/rubocop/cli.rb +48 -11
  17. data/lib/rubocop/comment_config.rb +60 -18
  18. data/lib/rubocop/config.rb +53 -16
  19. data/lib/rubocop/config_finder.rb +1 -1
  20. data/lib/rubocop/config_loader.rb +65 -49
  21. data/lib/rubocop/config_loader_resolver.rb +44 -19
  22. data/lib/rubocop/config_obsoletion/extracted_cop.rb +6 -3
  23. data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
  24. data/lib/rubocop/config_obsoletion.rb +46 -2
  25. data/lib/rubocop/config_store.rb +7 -2
  26. data/lib/rubocop/config_validator.rb +7 -6
  27. data/lib/rubocop/cop/autocorrect_logic.rb +27 -14
  28. data/lib/rubocop/cop/base.rb +38 -12
  29. data/lib/rubocop/cop/bundler/gem_comment.rb +5 -3
  30. data/lib/rubocop/cop/bundler/gem_version.rb +28 -28
  31. data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -3
  32. data/lib/rubocop/cop/commissioner.rb +13 -11
  33. data/lib/rubocop/cop/correctors/alignment_corrector.rb +26 -7
  34. data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -1
  35. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +1 -1
  36. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +7 -2
  37. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +7 -1
  38. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +1 -5
  39. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +8 -1
  40. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +36 -2
  41. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -2
  42. data/lib/rubocop/cop/correctors.rb +28 -0
  43. data/lib/rubocop/cop/documentation.rb +2 -3
  44. data/lib/rubocop/cop/exclude_limit.rb +31 -5
  45. data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
  46. data/lib/rubocop/cop/gemspec/development_dependencies.rb +1 -1
  47. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +49 -17
  48. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +2 -3
  49. data/lib/rubocop/cop/gemspec/require_mfa.rb +22 -5
  50. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +12 -7
  51. data/lib/rubocop/cop/internal_affairs/example_description.rb +9 -5
  52. data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +8 -8
  53. data/lib/rubocop/cop/internal_affairs/itblock_handler.rb +69 -0
  54. data/lib/rubocop/cop/internal_affairs/location_exists.rb +142 -0
  55. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +1 -0
  56. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +13 -13
  57. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +1 -1
  58. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +1 -1
  59. data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +6 -2
  60. data/lib/rubocop/cop/internal_affairs/node_type_group.rb +92 -0
  61. data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +1 -1
  62. data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
  63. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +6 -5
  64. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +5 -3
  65. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +13 -2
  66. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +4 -4
  67. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
  68. data/lib/rubocop/cop/internal_affairs.rb +3 -16
  69. data/lib/rubocop/cop/layout/argument_alignment.rb +2 -2
  70. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  71. data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -1
  72. data/lib/rubocop/cop/layout/block_alignment.rb +60 -4
  73. data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
  74. data/lib/rubocop/cop/layout/case_indentation.rb +3 -1
  75. data/lib/rubocop/cop/layout/class_structure.rb +56 -10
  76. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +5 -5
  77. data/lib/rubocop/cop/layout/comment_indentation.rb +9 -2
  78. data/lib/rubocop/cop/layout/condition_position.rb +13 -3
  79. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  80. data/lib/rubocop/cop/layout/dot_position.rb +2 -2
  81. data/lib/rubocop/cop/layout/else_alignment.rb +2 -15
  82. data/lib/rubocop/cop/layout/empty_comment.rb +8 -10
  83. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +28 -9
  84. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +46 -21
  85. data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +101 -0
  86. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +34 -4
  87. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +8 -29
  88. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -0
  89. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +13 -2
  90. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +17 -3
  91. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +22 -2
  92. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +16 -2
  93. data/lib/rubocop/cop/layout/end_alignment.rb +10 -3
  94. data/lib/rubocop/cop/layout/first_argument_indentation.rb +35 -2
  95. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +26 -0
  96. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +20 -15
  97. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +25 -25
  98. data/lib/rubocop/cop/layout/hash_alignment.rb +5 -8
  99. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +3 -3
  100. data/lib/rubocop/cop/layout/heredoc_indentation.rb +33 -3
  101. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  102. data/lib/rubocop/cop/layout/indentation_width.rb +152 -7
  103. data/lib/rubocop/cop/layout/leading_comment_space.rb +13 -1
  104. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +1 -1
  105. data/lib/rubocop/cop/layout/line_length.rb +62 -15
  106. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +57 -57
  107. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +9 -2
  108. data/lib/rubocop/cop/layout/multiline_block_layout.rb +3 -0
  109. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +56 -56
  110. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
  111. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +236 -41
  112. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +1 -0
  113. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +9 -5
  114. data/lib/rubocop/cop/layout/parameter_alignment.rb +1 -1
  115. data/lib/rubocop/cop/layout/redundant_line_break.rb +12 -6
  116. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +15 -7
  117. data/lib/rubocop/cop/layout/space_after_comma.rb +2 -10
  118. data/lib/rubocop/cop/layout/space_after_semicolon.rb +11 -1
  119. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
  120. data/lib/rubocop/cop/layout/space_around_keyword.rb +10 -3
  121. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
  122. data/lib/rubocop/cop/layout/space_around_operators.rb +18 -3
  123. data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -0
  124. data/lib/rubocop/cop/layout/space_before_brackets.rb +6 -39
  125. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +9 -8
  126. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +12 -3
  127. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -0
  128. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +3 -0
  129. data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
  130. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -11
  131. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
  132. data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +1 -10
  133. data/lib/rubocop/cop/lint/ambiguous_range.rb +5 -0
  134. data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +2 -3
  135. data/lib/rubocop/cop/lint/assignment_in_condition.rb +13 -1
  136. data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
  137. data/lib/rubocop/cop/lint/circular_argument_reference.rb +47 -8
  138. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +4 -3
  139. data/lib/rubocop/cop/lint/constant_reassignment.rb +93 -11
  140. data/lib/rubocop/cop/lint/constant_resolution.rb +6 -6
  141. data/lib/rubocop/cop/lint/cop_directive_syntax.rb +90 -0
  142. data/lib/rubocop/cop/lint/data_define_override.rb +63 -0
  143. data/lib/rubocop/cop/lint/debugger.rb +13 -4
  144. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
  145. data/lib/rubocop/cop/lint/deprecated_constants.rb +2 -8
  146. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +5 -2
  147. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +4 -4
  148. data/lib/rubocop/cop/lint/duplicate_methods.rb +219 -32
  149. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +5 -42
  150. data/lib/rubocop/cop/lint/else_layout.rb +19 -0
  151. data/lib/rubocop/cop/lint/empty_block.rb +4 -4
  152. data/lib/rubocop/cop/lint/empty_conditional_body.rb +20 -65
  153. data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
  154. data/lib/rubocop/cop/lint/empty_in_pattern.rb +8 -1
  155. data/lib/rubocop/cop/lint/empty_interpolation.rb +14 -1
  156. data/lib/rubocop/cop/lint/empty_when.rb +8 -1
  157. data/lib/rubocop/cop/lint/ensure_return.rb +19 -1
  158. data/lib/rubocop/cop/lint/erb_new_arguments.rb +4 -8
  159. data/lib/rubocop/cop/lint/float_comparison.rb +33 -10
  160. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +1 -1
  161. data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
  162. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -1
  163. data/lib/rubocop/cop/lint/interpolation_check.rb +25 -5
  164. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
  165. data/lib/rubocop/cop/lint/literal_as_condition.rb +129 -11
  166. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +11 -1
  167. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +9 -12
  168. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +19 -10
  169. data/lib/rubocop/cop/lint/mixed_case_range.rb +2 -2
  170. data/lib/rubocop/cop/lint/multiple_comparison.rb +2 -2
  171. data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -1
  172. data/lib/rubocop/cop/lint/next_without_accumulator.rb +2 -0
  173. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +20 -0
  174. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +4 -2
  175. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +4 -4
  176. data/lib/rubocop/cop/lint/number_conversion.rb +19 -10
  177. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -1
  178. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +11 -0
  179. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +1 -1
  180. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +7 -7
  181. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +3 -13
  182. data/lib/rubocop/cop/lint/raise_exception.rb +30 -11
  183. data/lib/rubocop/cop/lint/rand_one.rb +1 -1
  184. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +27 -10
  185. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +6 -12
  186. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +15 -4
  187. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +1 -1
  188. data/lib/rubocop/cop/lint/redundant_require_statement.rb +4 -23
  189. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +134 -11
  190. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +12 -2
  191. data/lib/rubocop/cop/lint/redundant_type_conversion.rb +268 -0
  192. data/lib/rubocop/cop/lint/redundant_with_index.rb +4 -1
  193. data/lib/rubocop/cop/lint/redundant_with_object.rb +8 -0
  194. data/lib/rubocop/cop/lint/refinement_import_methods.rb +8 -1
  195. data/lib/rubocop/cop/lint/regexp_as_condition.rb +9 -1
  196. data/lib/rubocop/cop/lint/require_parentheses.rb +13 -4
  197. data/lib/rubocop/cop/lint/require_range_parentheses.rb +3 -2
  198. data/lib/rubocop/cop/lint/require_relative_self_path.rb +7 -5
  199. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -4
  200. data/lib/rubocop/cop/lint/rescue_type.rb +2 -2
  201. data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -11
  202. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +22 -4
  203. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +7 -1
  204. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  205. data/lib/rubocop/cop/lint/script_permission.rb +5 -1
  206. data/lib/rubocop/cop/lint/self_assignment.rb +63 -6
  207. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -1
  208. data/lib/rubocop/cop/lint/shadowed_argument.rb +7 -7
  209. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
  210. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +27 -1
  211. data/lib/rubocop/cop/lint/shared_mutable_default.rb +14 -1
  212. data/lib/rubocop/cop/lint/struct_new_override.rb +17 -1
  213. data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
  214. data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +123 -0
  215. data/lib/rubocop/cop/lint/symbol_conversion.rb +21 -4
  216. data/lib/rubocop/cop/lint/syntax.rb +25 -1
  217. data/lib/rubocop/cop/lint/to_enum_arguments.rb +36 -3
  218. data/lib/rubocop/cop/lint/to_json.rb +20 -17
  219. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
  220. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +5 -1
  221. data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +36 -10
  222. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +2 -0
  223. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +2 -1
  224. data/lib/rubocop/cop/lint/unreachable_code.rb +17 -9
  225. data/lib/rubocop/cop/lint/unreachable_loop.rb +5 -5
  226. data/lib/rubocop/cop/lint/unreachable_pattern_branch.rb +113 -0
  227. data/lib/rubocop/cop/lint/unused_method_argument.rb +10 -0
  228. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +2 -0
  229. data/lib/rubocop/cop/lint/useless_access_modifier.rb +30 -4
  230. data/lib/rubocop/cop/lint/useless_assignment.rb +55 -25
  231. data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
  232. data/lib/rubocop/cop/lint/useless_default_value_argument.rb +92 -0
  233. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +11 -10
  234. data/lib/rubocop/cop/lint/useless_or.rb +111 -0
  235. data/lib/rubocop/cop/lint/useless_rescue.rb +1 -1
  236. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +11 -7
  237. data/lib/rubocop/cop/lint/useless_setter_call.rb +4 -1
  238. data/lib/rubocop/cop/lint/useless_times.rb +22 -1
  239. data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +147 -0
  240. data/lib/rubocop/cop/lint/void.rb +50 -21
  241. data/lib/rubocop/cop/message_annotator.rb +7 -3
  242. data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
  243. data/lib/rubocop/cop/metrics/block_length.rb +2 -1
  244. data/lib/rubocop/cop/metrics/block_nesting.rb +23 -0
  245. data/lib/rubocop/cop/metrics/collection_literal_length.rb +1 -1
  246. data/lib/rubocop/cop/metrics/method_length.rb +3 -2
  247. data/lib/rubocop/cop/metrics/perceived_complexity.rb +38 -7
  248. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +4 -3
  249. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  250. data/lib/rubocop/cop/metrics/utils/iterating_block.rb +1 -1
  251. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
  252. data/lib/rubocop/cop/migration/department_name.rb +12 -1
  253. data/lib/rubocop/cop/mixin/alignment.rb +3 -3
  254. data/lib/rubocop/cop/mixin/allowed_methods.rb +5 -5
  255. data/lib/rubocop/cop/mixin/allowed_pattern.rb +9 -5
  256. data/lib/rubocop/cop/mixin/check_line_breakable.rb +4 -4
  257. data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +5 -7
  258. data/lib/rubocop/cop/mixin/code_length.rb +1 -1
  259. data/lib/rubocop/cop/mixin/comments_help.rb +1 -1
  260. data/lib/rubocop/cop/mixin/configurable_max.rb +6 -5
  261. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  262. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
  263. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -7
  264. data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
  265. data/lib/rubocop/cop/mixin/forbidden_pattern.rb +20 -0
  266. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -2
  267. data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
  268. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +15 -14
  269. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +22 -22
  270. data/lib/rubocop/cop/mixin/hash_subset.rb +27 -4
  271. data/lib/rubocop/cop/mixin/hash_transform_method/autocorrection.rb +63 -0
  272. data/lib/rubocop/cop/mixin/hash_transform_method.rb +32 -78
  273. data/lib/rubocop/cop/mixin/line_length_help.rb +45 -10
  274. data/lib/rubocop/cop/mixin/method_complexity.rb +2 -1
  275. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +3 -1
  276. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -1
  277. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  278. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  279. data/lib/rubocop/cop/mixin/project_index_help.rb +48 -0
  280. data/lib/rubocop/cop/mixin/range_help.rb +15 -3
  281. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +5 -4
  282. data/lib/rubocop/cop/mixin/statement_modifier.rb +1 -7
  283. data/lib/rubocop/cop/mixin/string_help.rb +1 -1
  284. data/lib/rubocop/cop/mixin/target_ruby_version.rb +1 -1
  285. data/lib/rubocop/cop/mixin/trailing_comma.rb +25 -6
  286. data/lib/rubocop/cop/mixin.rb +86 -0
  287. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  288. data/lib/rubocop/cop/naming/block_forwarding.rb +3 -3
  289. data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
  290. data/lib/rubocop/cop/naming/file_name.rb +6 -5
  291. data/lib/rubocop/cop/naming/inclusive_language.rb +8 -2
  292. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +11 -2
  293. data/lib/rubocop/cop/naming/method_name.rb +187 -15
  294. data/lib/rubocop/cop/naming/predicate_method.rb +330 -0
  295. data/lib/rubocop/cop/naming/{predicate_name.rb → predicate_prefix.rb} +48 -4
  296. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +10 -4
  297. data/lib/rubocop/cop/naming/variable_name.rb +51 -6
  298. data/lib/rubocop/cop/offense.rb +17 -1
  299. data/lib/rubocop/cop/registry.rb +66 -39
  300. data/lib/rubocop/cop/security/eval.rb +17 -3
  301. data/lib/rubocop/cop/security/io_methods.rb +2 -2
  302. data/lib/rubocop/cop/security/json_load.rb +33 -11
  303. data/lib/rubocop/cop/security/marshal_load.rb +1 -1
  304. data/lib/rubocop/cop/security/open.rb +1 -0
  305. data/lib/rubocop/cop/style/access_modifier_declarations.rb +45 -12
  306. data/lib/rubocop/cop/style/accessor_grouping.rb +46 -8
  307. data/lib/rubocop/cop/style/alias.rb +15 -3
  308. data/lib/rubocop/cop/style/and_or.rb +2 -1
  309. data/lib/rubocop/cop/style/arguments_forwarding.rb +46 -31
  310. data/lib/rubocop/cop/style/array_first_last.rb +12 -1
  311. data/lib/rubocop/cop/style/array_intersect.rb +117 -38
  312. data/lib/rubocop/cop/style/array_intersect_with_single_element.rb +50 -0
  313. data/lib/rubocop/cop/style/array_join.rb +4 -2
  314. data/lib/rubocop/cop/style/ascii_comments.rb +6 -3
  315. data/lib/rubocop/cop/style/attr.rb +5 -2
  316. data/lib/rubocop/cop/style/bare_percent_literals.rb +4 -3
  317. data/lib/rubocop/cop/style/begin_block.rb +3 -1
  318. data/lib/rubocop/cop/style/bitwise_predicate.rb +8 -1
  319. data/lib/rubocop/cop/style/block_delimiters.rb +42 -34
  320. data/lib/rubocop/cop/style/case_equality.rb +29 -15
  321. data/lib/rubocop/cop/style/case_like_if.rb +1 -1
  322. data/lib/rubocop/cop/style/character_literal.rb +2 -2
  323. data/lib/rubocop/cop/style/class_and_module_children.rb +67 -12
  324. data/lib/rubocop/cop/style/class_equality_comparison.rb +22 -14
  325. data/lib/rubocop/cop/style/class_methods_definitions.rb +11 -5
  326. data/lib/rubocop/cop/style/collection_compact.rb +37 -17
  327. data/lib/rubocop/cop/style/collection_methods.rb +1 -0
  328. data/lib/rubocop/cop/style/collection_querying.rb +167 -0
  329. data/lib/rubocop/cop/style/colon_method_call.rb +16 -7
  330. data/lib/rubocop/cop/style/combinable_loops.rb +6 -0
  331. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  332. data/lib/rubocop/cop/style/commented_keyword.rb +12 -5
  333. data/lib/rubocop/cop/style/comparable_between.rb +78 -0
  334. data/lib/rubocop/cop/style/comparable_clamp.rb +12 -1
  335. data/lib/rubocop/cop/style/concat_array_literals.rb +7 -1
  336. data/lib/rubocop/cop/style/conditional_assignment.rb +33 -24
  337. data/lib/rubocop/cop/style/constant_visibility.rb +20 -12
  338. data/lib/rubocop/cop/style/copyright.rb +22 -11
  339. data/lib/rubocop/cop/style/data_inheritance.rb +11 -0
  340. data/lib/rubocop/cop/style/date_time.rb +4 -4
  341. data/lib/rubocop/cop/style/def_with_parentheses.rb +22 -5
  342. data/lib/rubocop/cop/style/dig_chain.rb +6 -1
  343. data/lib/rubocop/cop/style/dir_empty.rb +4 -0
  344. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +1 -1
  345. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +6 -1
  346. data/lib/rubocop/cop/style/documentation.rb +6 -6
  347. data/lib/rubocop/cop/style/documentation_method.rb +12 -8
  348. data/lib/rubocop/cop/style/double_negation.rb +3 -3
  349. data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -1
  350. data/lib/rubocop/cop/style/each_with_object.rb +4 -3
  351. data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
  352. data/lib/rubocop/cop/style/empty_case_condition.rb +12 -2
  353. data/lib/rubocop/cop/style/empty_class_definition.rb +126 -0
  354. data/lib/rubocop/cop/style/empty_heredoc.rb +4 -0
  355. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
  356. data/lib/rubocop/cop/style/empty_literal.rb +11 -2
  357. data/lib/rubocop/cop/style/empty_method.rb +0 -6
  358. data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +110 -0
  359. data/lib/rubocop/cop/style/encoding.rb +7 -1
  360. data/lib/rubocop/cop/style/end_block.rb +3 -1
  361. data/lib/rubocop/cop/style/endless_method.rb +181 -18
  362. data/lib/rubocop/cop/style/env_home.rb +4 -0
  363. data/lib/rubocop/cop/style/eval_with_location.rb +3 -3
  364. data/lib/rubocop/cop/style/even_odd.rb +11 -1
  365. data/lib/rubocop/cop/style/exact_regexp_match.rb +8 -1
  366. data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
  367. data/lib/rubocop/cop/style/explicit_block_argument.rb +16 -3
  368. data/lib/rubocop/cop/style/exponential_notation.rb +5 -4
  369. data/lib/rubocop/cop/style/fetch_env_var.rb +33 -7
  370. data/lib/rubocop/cop/style/file_null.rb +4 -2
  371. data/lib/rubocop/cop/style/file_open.rb +84 -0
  372. data/lib/rubocop/cop/style/file_write.rb +21 -16
  373. data/lib/rubocop/cop/style/float_division.rb +15 -1
  374. data/lib/rubocop/cop/style/for.rb +4 -0
  375. data/lib/rubocop/cop/style/format_string.rb +17 -4
  376. data/lib/rubocop/cop/style/format_string_token.rb +85 -14
  377. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -2
  378. data/lib/rubocop/cop/style/global_std_stream.rb +3 -0
  379. data/lib/rubocop/cop/style/global_vars.rb +5 -2
  380. data/lib/rubocop/cop/style/guard_clause.rb +29 -23
  381. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +27 -9
  382. data/lib/rubocop/cop/style/hash_conversion.rb +28 -12
  383. data/lib/rubocop/cop/style/hash_each_methods.rb +3 -2
  384. data/lib/rubocop/cop/style/hash_fetch_chain.rb +104 -0
  385. data/lib/rubocop/cop/style/hash_lookup_method.rb +102 -0
  386. data/lib/rubocop/cop/style/hash_slice.rb +16 -0
  387. data/lib/rubocop/cop/style/hash_syntax.rb +6 -1
  388. data/lib/rubocop/cop/style/hash_transform_keys.rb +19 -9
  389. data/lib/rubocop/cop/style/hash_transform_values.rb +19 -9
  390. data/lib/rubocop/cop/style/identical_conditional_branches.rb +18 -7
  391. data/lib/rubocop/cop/style/if_inside_else.rb +26 -20
  392. data/lib/rubocop/cop/style/if_unless_modifier.rb +83 -16
  393. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +16 -19
  394. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +5 -2
  395. data/lib/rubocop/cop/style/if_with_semicolon.rb +16 -6
  396. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  397. data/lib/rubocop/cop/style/inline_comment.rb +5 -2
  398. data/lib/rubocop/cop/style/inverse_methods.rb +10 -6
  399. data/lib/rubocop/cop/style/invertible_unless_condition.rb +27 -7
  400. data/lib/rubocop/cop/style/ip_addresses.rb +3 -4
  401. data/lib/rubocop/cop/style/it_assignment.rb +69 -12
  402. data/lib/rubocop/cop/style/it_block_parameter.rb +121 -0
  403. data/lib/rubocop/cop/style/keyword_arguments_merging.rb +4 -0
  404. data/lib/rubocop/cop/style/keyword_parameters_order.rb +20 -10
  405. data/lib/rubocop/cop/style/lambda.rb +8 -1
  406. data/lib/rubocop/cop/style/lambda_call.rb +26 -10
  407. data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
  408. data/lib/rubocop/cop/style/magic_comment_format.rb +3 -3
  409. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +11 -0
  410. data/lib/rubocop/cop/style/map_into_array.rb +5 -2
  411. data/lib/rubocop/cop/style/map_join.rb +123 -0
  412. data/lib/rubocop/cop/style/map_to_hash.rb +12 -3
  413. data/lib/rubocop/cop/style/map_to_set.rb +1 -3
  414. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +9 -8
  415. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +15 -2
  416. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +33 -4
  417. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +11 -5
  418. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +2 -1
  419. data/lib/rubocop/cop/style/method_def_parentheses.rb +7 -5
  420. data/lib/rubocop/cop/style/min_max_comparison.rb +17 -6
  421. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +10 -7
  422. data/lib/rubocop/cop/style/mixin_usage.rb +1 -1
  423. data/lib/rubocop/cop/style/module_function.rb +4 -2
  424. data/lib/rubocop/cop/style/module_member_existence_check.rb +110 -0
  425. data/lib/rubocop/cop/style/multiline_block_chain.rb +2 -1
  426. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -0
  427. data/lib/rubocop/cop/style/multiline_if_then.rb +4 -4
  428. data/lib/rubocop/cop/style/multiline_memoization.rb +7 -1
  429. data/lib/rubocop/cop/style/multiline_method_signature.rb +13 -16
  430. data/lib/rubocop/cop/style/mutable_constant.rb +106 -12
  431. data/lib/rubocop/cop/style/negative_array_index.rb +220 -0
  432. data/lib/rubocop/cop/style/next.rb +44 -0
  433. data/lib/rubocop/cop/style/nil_comparison.rb +11 -10
  434. data/lib/rubocop/cop/style/nil_lambda.rb +9 -1
  435. data/lib/rubocop/cop/style/non_nil_check.rb +5 -11
  436. data/lib/rubocop/cop/style/not.rb +2 -0
  437. data/lib/rubocop/cop/style/numeric_literals.rb +3 -2
  438. data/lib/rubocop/cop/style/numeric_predicate.rb +1 -1
  439. data/lib/rubocop/cop/style/object_then.rb +1 -0
  440. data/lib/rubocop/cop/style/one_class_per_file.rb +115 -0
  441. data/lib/rubocop/cop/style/one_line_conditional.rb +21 -12
  442. data/lib/rubocop/cop/style/open_struct_use.rb +1 -1
  443. data/lib/rubocop/cop/style/operator_method_call.rb +11 -2
  444. data/lib/rubocop/cop/style/option_hash.rb +1 -1
  445. data/lib/rubocop/cop/style/optional_arguments.rb +1 -0
  446. data/lib/rubocop/cop/style/parallel_assignment.rb +57 -25
  447. data/lib/rubocop/cop/style/partition_instead_of_double_select.rb +270 -0
  448. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +4 -0
  449. data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
  450. data/lib/rubocop/cop/style/perl_backrefs.rb +5 -3
  451. data/lib/rubocop/cop/style/predicate_with_kind.rb +84 -0
  452. data/lib/rubocop/cop/style/preferred_hash_methods.rb +12 -12
  453. data/lib/rubocop/cop/style/proc.rb +4 -2
  454. data/lib/rubocop/cop/style/raise_args.rb +9 -9
  455. data/lib/rubocop/cop/style/reduce_to_hash.rb +200 -0
  456. data/lib/rubocop/cop/style/redundant_argument.rb +2 -0
  457. data/lib/rubocop/cop/style/redundant_array_constructor.rb +2 -2
  458. data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
  459. data/lib/rubocop/cop/style/redundant_begin.rb +38 -3
  460. data/lib/rubocop/cop/style/redundant_condition.rb +61 -1
  461. data/lib/rubocop/cop/style/redundant_constant_base.rb +5 -5
  462. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +26 -4
  463. data/lib/rubocop/cop/style/redundant_each.rb +3 -3
  464. data/lib/rubocop/cop/style/redundant_exception.rb +7 -1
  465. data/lib/rubocop/cop/style/redundant_fetch_block.rb +2 -10
  466. data/lib/rubocop/cop/style/redundant_filter_chain.rb +1 -1
  467. data/lib/rubocop/cop/style/redundant_format.rb +312 -0
  468. data/lib/rubocop/cop/style/redundant_freeze.rb +2 -2
  469. data/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb +6 -1
  470. data/lib/rubocop/cop/style/redundant_interpolation.rb +12 -3
  471. data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +26 -10
  472. data/lib/rubocop/cop/style/redundant_line_continuation.rb +28 -7
  473. data/lib/rubocop/cop/style/redundant_min_max_by.rb +93 -0
  474. data/lib/rubocop/cop/style/redundant_parentheses.rb +111 -37
  475. data/lib/rubocop/cop/style/redundant_percent_q.rb +5 -3
  476. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +9 -0
  477. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +2 -2
  478. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +12 -0
  479. data/lib/rubocop/cop/style/redundant_return.rb +3 -1
  480. data/lib/rubocop/cop/style/redundant_self.rb +20 -7
  481. data/lib/rubocop/cop/style/redundant_self_assignment.rb +1 -1
  482. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +0 -5
  483. data/lib/rubocop/cop/style/redundant_sort.rb +7 -7
  484. data/lib/rubocop/cop/style/redundant_sort_by.rb +17 -1
  485. data/lib/rubocop/cop/style/redundant_struct_keyword_init.rb +133 -0
  486. data/lib/rubocop/cop/style/regexp_literal.rb +32 -3
  487. data/lib/rubocop/cop/style/rescue_modifier.rb +6 -3
  488. data/lib/rubocop/cop/style/return_nil.rb +2 -2
  489. data/lib/rubocop/cop/style/reverse_find.rb +51 -0
  490. data/lib/rubocop/cop/style/safe_navigation.rb +67 -20
  491. data/lib/rubocop/cop/style/select_by_kind.rb +158 -0
  492. data/lib/rubocop/cop/style/select_by_range.rb +197 -0
  493. data/lib/rubocop/cop/style/select_by_regexp.rb +53 -20
  494. data/lib/rubocop/cop/style/self_assignment.rb +1 -1
  495. data/lib/rubocop/cop/style/semicolon.rb +45 -12
  496. data/lib/rubocop/cop/style/single_line_block_params.rb +2 -2
  497. data/lib/rubocop/cop/style/single_line_do_end_block.rb +21 -6
  498. data/lib/rubocop/cop/style/single_line_methods.rb +13 -8
  499. data/lib/rubocop/cop/style/sole_nested_conditional.rb +77 -101
  500. data/lib/rubocop/cop/style/special_global_vars.rb +6 -1
  501. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
  502. data/lib/rubocop/cop/style/string_concatenation.rb +18 -15
  503. data/lib/rubocop/cop/style/string_hash_keys.rb +1 -0
  504. data/lib/rubocop/cop/style/struct_inheritance.rb +24 -2
  505. data/lib/rubocop/cop/style/super_arguments.rb +3 -4
  506. data/lib/rubocop/cop/style/symbol_array.rb +1 -1
  507. data/lib/rubocop/cop/style/symbol_proc.rb +10 -7
  508. data/lib/rubocop/cop/style/tally_method.rb +181 -0
  509. data/lib/rubocop/cop/style/ternary_parentheses.rb +11 -0
  510. data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -2
  511. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +52 -1
  512. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
  513. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +2 -2
  514. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
  515. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +1 -0
  516. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +18 -19
  517. data/lib/rubocop/cop/style/trivial_accessors.rb +2 -2
  518. data/lib/rubocop/cop/style/unless_else.rb +10 -9
  519. data/lib/rubocop/cop/style/unless_logical_operators.rb +3 -3
  520. data/lib/rubocop/cop/style/while_until_do.rb +7 -0
  521. data/lib/rubocop/cop/style/while_until_modifier.rb +16 -1
  522. data/lib/rubocop/cop/style/word_array.rb +1 -0
  523. data/lib/rubocop/cop/style/yoda_condition.rb +1 -1
  524. data/lib/rubocop/cop/style/yoda_expression.rb +1 -1
  525. data/lib/rubocop/cop/style/zero_length_predicate.rb +6 -3
  526. data/lib/rubocop/cop/team.rb +105 -40
  527. data/lib/rubocop/cop/util.rb +4 -5
  528. data/lib/rubocop/cop/utils/format_string.rb +20 -5
  529. data/lib/rubocop/cop/variable_force/assignment.rb +7 -3
  530. data/lib/rubocop/cop/variable_force/branch.rb +30 -6
  531. data/lib/rubocop/cop/variable_force/scope.rb +1 -1
  532. data/lib/rubocop/cop/variable_force/variable.rb +10 -3
  533. data/lib/rubocop/cop/variable_force.rb +26 -9
  534. data/lib/rubocop/cops_documentation_generator.rb +23 -7
  535. data/lib/rubocop/directive_comment.rb +80 -3
  536. data/lib/rubocop/ext/regexp_node.rb +0 -1
  537. data/lib/rubocop/file_patterns.rb +9 -1
  538. data/lib/rubocop/formatter/clang_style_formatter.rb +5 -2
  539. data/lib/rubocop/formatter/disabled_config_formatter.rb +38 -13
  540. data/lib/rubocop/formatter/formatter_set.rb +2 -2
  541. data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
  542. data/lib/rubocop/formatter/html_formatter.rb +1 -1
  543. data/lib/rubocop/formatter/junit_formatter.rb +1 -1
  544. data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
  545. data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
  546. data/lib/rubocop/formatter/pacman_formatter.rb +2 -1
  547. data/lib/rubocop/formatter/simple_text_formatter.rb +0 -2
  548. data/lib/rubocop/formatter/tap_formatter.rb +5 -2
  549. data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -1
  550. data/lib/rubocop/formatter.rb +22 -21
  551. data/lib/rubocop/lsp/diagnostic.rb +22 -37
  552. data/lib/rubocop/lsp/disable_comment_edits.rb +135 -0
  553. data/lib/rubocop/lsp/routes.rb +47 -11
  554. data/lib/rubocop/lsp/runtime.rb +19 -8
  555. data/lib/rubocop/lsp/server.rb +0 -2
  556. data/lib/rubocop/lsp/stdin_runner.rb +11 -18
  557. data/lib/rubocop/magic_comment.rb +28 -0
  558. data/lib/rubocop/mcp/server.rb +200 -0
  559. data/lib/rubocop/options.rb +60 -14
  560. data/lib/rubocop/path_util.rb +18 -2
  561. data/lib/rubocop/pending_cops_reporter.rb +56 -0
  562. data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
  563. data/lib/rubocop/plugin/load_error.rb +26 -0
  564. data/lib/rubocop/plugin/loader.rb +100 -0
  565. data/lib/rubocop/plugin/not_supported_error.rb +29 -0
  566. data/lib/rubocop/plugin.rb +46 -0
  567. data/lib/rubocop/project_index_loader.rb +66 -0
  568. data/lib/rubocop/rake_task.rb +5 -2
  569. data/lib/rubocop/remote_config.rb +10 -8
  570. data/lib/rubocop/result_cache.rb +72 -47
  571. data/lib/rubocop/rspec/cop_helper.rb +21 -1
  572. data/lib/rubocop/rspec/expect_offense.rb +9 -3
  573. data/lib/rubocop/rspec/shared_contexts.rb +71 -3
  574. data/lib/rubocop/rspec/support.rb +4 -0
  575. data/lib/rubocop/runner.rb +188 -65
  576. data/lib/rubocop/server/cache.rb +56 -41
  577. data/lib/rubocop/server/cli.rb +2 -2
  578. data/lib/rubocop/server/client_command/base.rb +10 -0
  579. data/lib/rubocop/server/client_command/exec.rb +2 -1
  580. data/lib/rubocop/server/client_command/start.rb +11 -1
  581. data/lib/rubocop/server/core.rb +8 -0
  582. data/lib/rubocop/target_finder.rb +21 -10
  583. data/lib/rubocop/target_ruby.rb +31 -14
  584. data/lib/rubocop/version.rb +50 -10
  585. data/lib/rubocop.rb +47 -96
  586. data/lib/ruby_lsp/rubocop/addon.rb +29 -17
  587. data/lib/ruby_lsp/rubocop/runtime_adapter.rb +99 -0
  588. metadata +86 -16
  589. data/lib/rubocop/cop/utils/regexp_ranges.rb +0 -113
  590. data/lib/ruby_lsp/rubocop/wraps_built_in_lsp_runtime.rb +0 -50
data/config/default.yml CHANGED
@@ -3,20 +3,16 @@
3
3
  AllCops:
4
4
  RubyInterpreters:
5
5
  - ruby
6
- - macruby
7
6
  - rake
8
7
  - jruby
9
- - rbx
10
8
  # Include common Ruby source files.
11
9
  Include:
12
10
  - '**/*.rb'
13
11
  - '**/*.arb'
14
12
  - '**/*.axlsx'
15
13
  - '**/*.builder'
16
- - '**/*.fcgi'
17
14
  - '**/*.gemfile'
18
15
  - '**/*.gemspec'
19
- - '**/*.god'
20
16
  - '**/*.jb'
21
17
  - '**/*.jbuilder'
22
18
  - '**/*.mspec'
@@ -25,15 +21,12 @@ AllCops:
25
21
  - '**/*.podspec'
26
22
  - '**/*.rabl'
27
23
  - '**/*.rake'
28
- - '**/*.rbuild'
29
24
  - '**/*.rbw'
30
- - '**/*.rbx'
31
25
  - '**/*.ru'
32
26
  - '**/*.ruby'
33
27
  - '**/*.schema'
34
28
  - '**/*.spec'
35
29
  - '**/*.thor'
36
- - '**/*.watchr'
37
30
  - '**/.irbrc'
38
31
  - '**/.pryrc'
39
32
  - '**/.simplecov'
@@ -43,7 +36,6 @@ AllCops:
43
36
  - '**/Brewfile'
44
37
  - '**/Buildfile'
45
38
  - '**/Capfile'
46
- - '**/Cheffile'
47
39
  - '**/Dangerfile'
48
40
  - '**/Deliverfile'
49
41
  - '**/Fastfile'
@@ -60,7 +52,6 @@ AllCops:
60
52
  - '**/Snapfile'
61
53
  - '**/Steepfile'
62
54
  - '**/Thorfile'
63
- - '**/Vagabondfile'
64
55
  - '**/Vagrantfile'
65
56
  Exclude:
66
57
  - 'node_modules/**/*'
@@ -113,11 +104,17 @@ AllCops:
113
104
  # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
114
105
  # the `--disable-pending-cops` command-line option.
115
106
  NewCops: pending
107
+ # When `true`, RuboCop builds a project index (a project-wide map of declarations and references)
108
+ # once per run and makes it available to cops that opt in.
109
+ # The project index is implemented by the optional `rubydex` gem; when `rubydex` is not installed,
110
+ # a warning is shown and the flag has no effect.
111
+ # The default `false` preserves RuboCop's traditional file-local analysis.
112
+ UseProjectIndex: false
116
113
  # Enables the result cache if `true`. Can be overridden by the `--cache` command
117
114
  # line option.
118
115
  UseCache: true
119
116
  # Threshold for how many files can be stored in the result cache before some
120
- # of the files are automatically removed.
117
+ # of the files are automatically removed. Set to false to disable cache pruning.
121
118
  MaxFilesInCache: 20000
122
119
  # The cache will be stored in "rubocop_cache" under this directory. If
123
120
  # CacheRootDirectory is ~ (nil), which it is by default, the root will be
@@ -146,12 +143,14 @@ AllCops:
146
143
  # Ruby version is still unresolved, RuboCop will use the oldest officially
147
144
  # supported Ruby version (currently Ruby 2.7).
148
145
  TargetRubyVersion: ~
149
- # You can specify the parser engine. There are two options available:
146
+ # RuboCop choses the parser engine automatically but you can also specify it yourself.
147
+ # These options are available:
148
+ # - `default`
150
149
  # - `parser_whitequark` ... https://github.com/whitequark/parser
151
150
  # - `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
151
+ # Not every parser engine can handle every `TargetRubyVersion`. `parser_whitequark`
152
+ # only works with versions 3.4 and below, `parser_prism` with versions 3.3 and above.
153
+ ParserEngine: default
155
154
  # Determines if a notification for extension libraries should be shown when
156
155
  # rubocop is run. Keys are the name of the extension, and values are an array
157
156
  # of gems in the Gemfile that the extension is suggested for, if not already
@@ -201,12 +200,12 @@ Bundler/GemComment:
201
200
  Description: 'Add a comment describing each gem.'
202
201
  Enabled: false
203
202
  VersionAdded: '0.59'
204
- VersionChanged: '0.85'
203
+ VersionChanged: '1.88'
205
204
  Include:
206
205
  - '**/*.gemfile'
207
206
  - '**/Gemfile'
208
207
  - '**/gems.rb'
209
- IgnoredGems: []
208
+ AllowedGems: []
210
209
  OnlyFor: []
211
210
 
212
211
  Bundler/GemFilename:
@@ -272,12 +271,20 @@ Bundler/OrderedGems:
272
271
  Gemspec/AddRuntimeDependency:
273
272
  Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
274
273
  StyleGuide: '#add_dependency_vs_add_runtime_dependency'
275
- Reference: https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
274
+ References:
275
+ - https://github.com/ruby/rubygems/issues/7799#issuecomment-2192720316
276
276
  Enabled: pending
277
277
  VersionAdded: '1.65'
278
278
  Include:
279
279
  - '**/*.gemspec'
280
280
 
281
+ Gemspec/AttributeAssignment:
282
+ Description: 'Use consistent style for Gemspec attributes assignment.'
283
+ Enabled: pending
284
+ VersionAdded: '1.77'
285
+ Include:
286
+ - '**/*.gemspec'
287
+
281
288
  Gemspec/DependencyVersion:
282
289
  Description: 'Requires or forbids specifying gem dependency versions.'
283
290
  Enabled: false
@@ -341,7 +348,7 @@ Gemspec/RequireMFA:
341
348
  Severity: warning
342
349
  VersionAdded: '1.23'
343
350
  VersionChanged: '1.40'
344
- Reference:
351
+ References:
345
352
  - https://guides.rubygems.org/mfa-requirement-opt-in/
346
353
  Include:
347
354
  - '**/*.gemspec'
@@ -365,10 +372,10 @@ Gemspec/RubyVersionGlobalsUsage:
365
372
  Include:
366
373
  - '**/*.gemspec'
367
374
 
368
- #################### Layout ###########################
375
+ #################### Layout ################################
369
376
 
370
377
  Layout/AccessModifierIndentation:
371
- Description: Check indentation of private/protected visibility modifiers.
378
+ Description: Checks indentation of private/protected visibility modifiers.
372
379
  StyleGuide: '#indent-public-private-protected'
373
380
  Enabled: true
374
381
  VersionAdded: '0.49'
@@ -483,7 +490,7 @@ Layout/BlockEndNewline:
483
490
  VersionAdded: '0.49'
484
491
 
485
492
  Layout/CaseIndentation:
486
- Description: 'Indentation of when in a case/(when|in)/[else/]end.'
493
+ Description: 'Checks how the `when` and `in` clauses of a `case` expression are indented.'
487
494
  StyleGuide: '#indent-when-to-case'
488
495
  Enabled: true
489
496
  VersionAdded: '0.49'
@@ -528,15 +535,22 @@ Layout/ClosingParenthesisIndentation:
528
535
  Description: 'Checks the indentation of hanging closing parentheses.'
529
536
  Enabled: true
530
537
  VersionAdded: '0.49'
538
+ VersionChanged: '1.86'
539
+ # By default the indentation width from `Layout/IndentationWidth` is used,
540
+ # but it can be overridden by setting this parameter.
541
+ IndentationWidth: ~
531
542
 
532
543
  Layout/CommentIndentation:
533
- Description: 'Indentation of comments.'
544
+ Description: 'Checks the indentation of comments.'
534
545
  Enabled: true
546
+ VersionAdded: '0.49'
547
+ VersionChanged: '1.86'
535
548
  # When true, allows comments to have extra indentation if that aligns them
536
549
  # with a comment on the preceding line.
537
550
  AllowForAlignment: false
538
- VersionAdded: '0.49'
539
- VersionChanged: '1.24'
551
+ # By default the indentation width from `Layout/IndentationWidth` is used,
552
+ # but it can be overridden by setting this parameter.
553
+ IndentationWidth: ~
540
554
 
541
555
  Layout/ConditionPosition:
542
556
  Description: >-
@@ -602,7 +616,7 @@ Layout/EmptyLineAfterMultilineCondition:
602
616
  # This is disabled, because this style is not very common in practice.
603
617
  Enabled: false
604
618
  VersionAdded: '0.90'
605
- Reference:
619
+ References:
606
620
  - https://github.com/airbnb/ruby#multiline-if-newline
607
621
 
608
622
  Layout/EmptyLineBetweenDefs:
@@ -628,6 +642,12 @@ Layout/EmptyLines:
628
642
  Enabled: true
629
643
  VersionAdded: '0.49'
630
644
 
645
+ Layout/EmptyLinesAfterModuleInclusion:
646
+ Description: 'Keeps track of empty lines after module inclusion methods.'
647
+ StyleGuide: '#empty-lines-after-module-inclusion'
648
+ Enabled: pending
649
+ VersionAdded: '1.79'
650
+
631
651
  Layout/EmptyLinesAroundAccessModifier:
632
652
  Description: "Keep blank lines around access modifiers."
633
653
  StyleGuide: '#empty-lines-around-access-modifier'
@@ -637,7 +657,7 @@ Layout/EmptyLinesAroundAccessModifier:
637
657
  SupportedStyles:
638
658
  - around
639
659
  - only_before
640
- Reference:
660
+ References:
641
661
  # A reference to `EnforcedStyle: only_before`.
642
662
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
643
663
 
@@ -819,6 +839,7 @@ Layout/FirstArrayElementLineBreak:
819
839
  multi-line array.
820
840
  Enabled: false
821
841
  VersionAdded: '0.49'
842
+ AllowImplicitArrayLiterals: false
822
843
  AllowMultilineFinalElement: false
823
844
 
824
845
  Layout/FirstHashElementIndentation:
@@ -891,9 +912,9 @@ Layout/HashAlignment:
891
912
  Align the elements of a hash literal if they span more than
892
913
  one line.
893
914
  Enabled: true
894
- AllowMultipleStyles: true
895
915
  VersionAdded: '0.49'
896
916
  VersionChanged: '1.16'
917
+ AllowMultipleStyles: true
897
918
  # Alignment of entries using hash rocket as separator. Valid values are:
898
919
  #
899
920
  # key - left alignment of keys
@@ -968,8 +989,8 @@ Layout/HeredocArgumentClosingParenthesis:
968
989
  Description: >-
969
990
  Checks for the placement of the closing parenthesis in a
970
991
  method call that passes a HEREDOC string as an argument.
971
- Enabled: false
972
992
  StyleGuide: '#heredoc-argument-closing-parentheses'
993
+ Enabled: false
973
994
  VersionAdded: '0.68'
974
995
 
975
996
  Layout/HeredocIndentation:
@@ -994,7 +1015,7 @@ Layout/IndentationConsistency:
994
1015
  SupportedStyles:
995
1016
  - normal
996
1017
  - indented_internal_methods
997
- Reference:
1018
+ References:
998
1019
  # A reference to `EnforcedStyle: indented_internal_methods`.
999
1020
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
1000
1021
 
@@ -1021,6 +1042,15 @@ Layout/IndentationWidth:
1021
1042
  VersionAdded: '0.49'
1022
1043
  # Number of spaces for each indentation level.
1023
1044
  Width: 2
1045
+ # Block body indentation for method chain blocks.
1046
+ # The value `start_of_line` means that block bodies are indented
1047
+ # relative to the start of the line where the block starts.
1048
+ # The value `relative_to_receiver` means that block bodies are indented
1049
+ # relative to the method call position in the chain.
1050
+ EnforcedStyleAlignWith: start_of_line
1051
+ SupportedStylesAlignWith:
1052
+ - start_of_line
1053
+ - relative_to_receiver
1024
1054
  AllowedPatterns: []
1025
1055
 
1026
1056
  Layout/InitialIndentation:
@@ -1041,7 +1071,7 @@ Layout/LeadingCommentSpace:
1041
1071
  AllowSteepAnnotation: false
1042
1072
 
1043
1073
  Layout/LeadingEmptyLines:
1044
- Description: Check for unnecessary blank lines at the beginning of a file.
1074
+ Description: Checks for unnecessary blank lines at the beginning of a file.
1045
1075
  Enabled: true
1046
1076
  VersionAdded: '0.57'
1047
1077
  VersionChanged: '0.77'
@@ -1086,18 +1116,22 @@ Layout/LineLength:
1086
1116
  StyleGuide: '#max-line-length'
1087
1117
  Enabled: true
1088
1118
  VersionAdded: '0.25'
1089
- VersionChanged: '1.69'
1119
+ VersionChanged: '1.82'
1090
1120
  Max: 120
1091
1121
  AllowHeredoc: true
1092
1122
  # To make it possible to copy or click on URIs in the code, we allow lines
1093
1123
  # containing a URI to be longer than Max.
1094
1124
  AllowURI: true
1125
+ AllowQualifiedName: true
1095
1126
  URISchemes:
1096
1127
  - http
1097
1128
  - https
1098
- # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1129
+ # The AllowRBSInlineAnnotation option makes LineLength allow RBS::Inline annotations
1130
+ # such as `#: (?date: Date) -> Foo` when calculating line length.
1131
+ AllowRBSInlineAnnotation: false
1132
+ # The AllowCopDirectives option causes the LineLength rule to ignore cop
1099
1133
  # directives like '# rubocop: enable ...' when calculating a line's length.
1100
- IgnoreCopDirectives: true
1134
+ AllowCopDirectives: true
1101
1135
  # The AllowedPatterns option is a list of !ruby/regexp and/or string
1102
1136
  # elements. Strings will be converted to Regexp objects. A line that matches
1103
1137
  # any regular expression listed in this option will be ignored by LineLength.
@@ -1130,7 +1164,7 @@ Layout/MultilineArrayLineBreaks:
1130
1164
  AllowMultilineFinalElement: false
1131
1165
 
1132
1166
  Layout/MultilineAssignmentLayout:
1133
- Description: 'Check for a newline after the assignment operator in multi-line assignments.'
1167
+ Description: 'Checks for a newline after the assignment operator in multi-line assignments.'
1134
1168
  StyleGuide: '#indent-conditional-assignment'
1135
1169
  Enabled: false
1136
1170
  VersionAdded: '0.49'
@@ -1392,6 +1426,7 @@ Layout/SpaceBeforeBlockBraces:
1392
1426
  before it.
1393
1427
  Enabled: true
1394
1428
  VersionAdded: '0.49'
1429
+ VersionChanged: '0.52'
1395
1430
  EnforcedStyle: space
1396
1431
  SupportedStyles:
1397
1432
  - space
@@ -1400,7 +1435,6 @@ Layout/SpaceBeforeBlockBraces:
1400
1435
  SupportedStylesForEmptyBraces:
1401
1436
  - space
1402
1437
  - no_space
1403
- VersionChanged: '0.52'
1404
1438
 
1405
1439
  Layout/SpaceBeforeBrackets:
1406
1440
  Description: 'Checks for receiver with a space before the opening brackets.'
@@ -1644,7 +1678,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
1644
1678
  VersionChanged: '1.69'
1645
1679
 
1646
1680
  Lint/BooleanSymbol:
1647
- Description: 'Check for `:true` and `:false` symbols.'
1681
+ Description: 'Checks for `:true` and `:false` symbols.'
1648
1682
  Enabled: true
1649
1683
  SafeAutoCorrect: false
1650
1684
  VersionAdded: '0.50'
@@ -1675,9 +1709,10 @@ Lint/ConstantReassignment:
1675
1709
  Description: 'Checks for constant reassignments.'
1676
1710
  Enabled: pending
1677
1711
  VersionAdded: '1.70'
1712
+ VersionChanged: '1.87'
1678
1713
 
1679
1714
  Lint/ConstantResolution:
1680
- Description: 'Check that constants are fully qualified with `::`.'
1715
+ Description: 'Checks that constants are fully qualified with `::`.'
1681
1716
  Enabled: false
1682
1717
  VersionAdded: '0.86'
1683
1718
  # Restrict this cop to only looking at certain names
@@ -1685,8 +1720,18 @@ Lint/ConstantResolution:
1685
1720
  # Restrict this cop from only looking at certain names
1686
1721
  Ignore: []
1687
1722
 
1723
+ Lint/CopDirectiveSyntax:
1724
+ Description: 'Checks that `# rubocop:` directives are strictly formatted.'
1725
+ Enabled: pending
1726
+ VersionAdded: '1.72'
1727
+
1728
+ Lint/DataDefineOverride:
1729
+ Description: 'Disallow overriding the `Data` built-in methods via `Data.define`.'
1730
+ Enabled: pending
1731
+ VersionAdded: '1.85'
1732
+
1688
1733
  Lint/Debugger:
1689
- Description: 'Check for debugger calls.'
1734
+ Description: 'Checks for debugger calls.'
1690
1735
  Enabled: true
1691
1736
  VersionAdded: '0.14'
1692
1737
  VersionChanged: '1.63'
@@ -1737,7 +1782,7 @@ Lint/Debugger:
1737
1782
  - debug/start
1738
1783
 
1739
1784
  Lint/DeprecatedClassMethods:
1740
- Description: 'Check for deprecated class method calls.'
1785
+ Description: 'Checks for deprecated class method calls.'
1741
1786
  Enabled: true
1742
1787
  VersionAdded: '0.19'
1743
1788
 
@@ -1811,13 +1856,13 @@ Lint/DuplicateElsifCondition:
1811
1856
  VersionAdded: '0.88'
1812
1857
 
1813
1858
  Lint/DuplicateHashKey:
1814
- Description: 'Check for duplicate keys in hash literals.'
1859
+ Description: 'Checks for duplicate keys in hash literals.'
1815
1860
  Enabled: true
1816
1861
  VersionAdded: '0.34'
1817
1862
  VersionChanged: '0.77'
1818
1863
 
1819
1864
  Lint/DuplicateMagicComment:
1820
- Description: 'Check for duplicated magic comments.'
1865
+ Description: 'Checks for duplicated magic comments.'
1821
1866
  Enabled: pending
1822
1867
  VersionAdded: '1.37'
1823
1868
 
@@ -1827,7 +1872,7 @@ Lint/DuplicateMatchPattern:
1827
1872
  VersionAdded: '1.50'
1828
1873
 
1829
1874
  Lint/DuplicateMethods:
1830
- Description: 'Check for duplicate method definitions.'
1875
+ Description: 'Checks for duplicate method definitions.'
1831
1876
  Enabled: true
1832
1877
  VersionAdded: '0.29'
1833
1878
 
@@ -1837,7 +1882,7 @@ Lint/DuplicateRegexpCharacterClassElement:
1837
1882
  VersionAdded: '1.1'
1838
1883
 
1839
1884
  Lint/DuplicateRequire:
1840
- Description: 'Check for duplicate `require`s and `require_relative`s.'
1885
+ Description: 'Checks for duplicate `require`s and `require_relative`s.'
1841
1886
  Enabled: true
1842
1887
  SafeAutoCorrect: false
1843
1888
  VersionAdded: '0.90'
@@ -1854,12 +1899,12 @@ Lint/DuplicateSetElement:
1854
1899
  VersionAdded: '1.67'
1855
1900
 
1856
1901
  Lint/EachWithObjectArgument:
1857
- Description: 'Check for immutable argument given to each_with_object.'
1902
+ Description: 'Checks for immutable argument given to each_with_object.'
1858
1903
  Enabled: true
1859
1904
  VersionAdded: '0.31'
1860
1905
 
1861
1906
  Lint/ElseLayout:
1862
- Description: 'Check for odd code arrangement in an else block.'
1907
+ Description: 'Checks for odd code arrangement in an else block.'
1863
1908
  Enabled: true
1864
1909
  VersionAdded: '0.17'
1865
1910
  VersionChanged: '1.2'
@@ -1882,10 +1927,9 @@ Lint/EmptyConditionalBody:
1882
1927
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1883
1928
  Enabled: true
1884
1929
  AutoCorrect: contextual
1885
- SafeAutoCorrect: false
1886
- AllowComments: true
1887
1930
  VersionAdded: '0.89'
1888
- VersionChanged: '1.61'
1931
+ VersionChanged: '1.73'
1932
+ AllowComments: true
1889
1933
 
1890
1934
  Lint/EmptyEnsure:
1891
1935
  Description: 'Checks for empty ensure block.'
@@ -1916,14 +1960,14 @@ Lint/EmptyInterpolation:
1916
1960
  Enabled: true
1917
1961
  AutoCorrect: contextual
1918
1962
  VersionAdded: '0.20'
1919
- VersionChanged: '1.61'
1963
+ VersionChanged: '1.76'
1920
1964
 
1921
1965
  Lint/EmptyWhen:
1922
1966
  Description: 'Checks for `when` branches with empty bodies.'
1923
1967
  Enabled: true
1924
- AllowComments: true
1925
1968
  VersionAdded: '0.45'
1926
1969
  VersionChanged: '0.83'
1970
+ AllowComments: true
1927
1971
 
1928
1972
  Lint/EnsureReturn:
1929
1973
  Description: 'Do not use return in an ensure block.'
@@ -1957,7 +2001,7 @@ Lint/FloatOutOfRange:
1957
2001
  VersionAdded: '0.36'
1958
2002
 
1959
2003
  Lint/FormatParameterMismatch:
1960
- Description: 'The number of parameters to format/sprint must match the fields.'
2004
+ Description: 'Checks for a mismatch between the format fields and the arguments to `format`/`sprintf`/`%`.'
1961
2005
  Enabled: true
1962
2006
  VersionAdded: '0.33'
1963
2007
 
@@ -1977,14 +2021,14 @@ Lint/HeredocMethodCallPosition:
1977
2021
  Description: >-
1978
2022
  Checks for the ordering of a method call where
1979
2023
  the receiver of the call is a HEREDOC.
1980
- Enabled: false
1981
2024
  StyleGuide: '#heredoc-method-calls'
2025
+ Enabled: false
1982
2026
  VersionAdded: '0.68'
1983
2027
 
1984
2028
  Lint/IdentityComparison:
1985
2029
  Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1986
- Enabled: true
1987
2030
  StyleGuide: '#identity-comparison'
2031
+ Enabled: true
1988
2032
  VersionAdded: '0.91'
1989
2033
 
1990
2034
  Lint/ImplicitStringConcatenation:
@@ -2029,7 +2073,8 @@ Lint/InterpolationCheck:
2029
2073
 
2030
2074
  Lint/ItWithoutArgumentsInBlock:
2031
2075
  Description: 'Checks uses of `it` calls without arguments in block.'
2032
- Reference: 'https://bugs.ruby-lang.org/issues/18980'
2076
+ References:
2077
+ - 'https://bugs.ruby-lang.org/issues/18980'
2033
2078
  Enabled: pending
2034
2079
  VersionAdded: '1.59'
2035
2080
 
@@ -2041,6 +2086,7 @@ Lint/LambdaWithoutLiteralBlock:
2041
2086
  Lint/LiteralAsCondition:
2042
2087
  Description: 'Checks of literals used in conditions.'
2043
2088
  Enabled: true
2089
+ AutoCorrect: contextual
2044
2090
  VersionAdded: '0.51'
2045
2091
 
2046
2092
  Lint/LiteralAssignmentInCondition:
@@ -2068,6 +2114,7 @@ Lint/MissingCopEnableDirective:
2068
2114
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
2069
2115
  Enabled: true
2070
2116
  VersionAdded: '0.52'
2117
+ VersionChanged: '1.88'
2071
2118
  # Maximum number of consecutive lines the cop can be disabled for.
2072
2119
  # 0 allows only single-line disables
2073
2120
  # 1 would mean the maximum allowed is the following:
@@ -2075,16 +2122,16 @@ Lint/MissingCopEnableDirective:
2075
2122
  # a = 1
2076
2123
  # # rubocop:enable SomeCop
2077
2124
  # .inf for any size
2078
- MaximumRangeSize: .inf
2125
+ MaxRangeSize: .inf
2079
2126
 
2080
2127
  Lint/MissingSuper:
2081
2128
  Description: >-
2082
2129
  Checks for the presence of constructors and lifecycle callbacks
2083
2130
  without calls to `super`.
2084
2131
  Enabled: true
2085
- AllowedParentClasses: []
2086
2132
  VersionAdded: '0.89'
2087
2133
  VersionChanged: '1.4'
2134
+ AllowedParentClasses: []
2088
2135
 
2089
2136
  Lint/MixedCaseRange:
2090
2137
  Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
@@ -2150,11 +2197,11 @@ Lint/NumberConversion:
2150
2197
  Description: 'Checks unsafe usage of number conversion methods.'
2151
2198
  Enabled: false
2152
2199
  VersionAdded: '0.53'
2153
- VersionChanged: '1.1'
2200
+ VersionChanged: '1.88'
2154
2201
  SafeAutoCorrect: false
2155
2202
  AllowedMethods: []
2156
2203
  AllowedPatterns: []
2157
- IgnoredClasses:
2204
+ AllowedClasses:
2158
2205
  - Time
2159
2206
  - DateTime
2160
2207
 
@@ -2166,7 +2213,9 @@ Lint/NumberedParameterAssignment:
2166
2213
  Lint/NumericOperationWithConstantResult:
2167
2214
  Description: 'Checks for numeric operations with constant results.'
2168
2215
  Enabled: pending
2216
+ SafeAutoCorrect: false
2169
2217
  VersionAdded: '1.69'
2218
+ VersionChanged: '1.88'
2170
2219
 
2171
2220
  Lint/OrAssignmentToConstant:
2172
2221
  Description: 'Checks unintended or-assignment to constant.'
@@ -2254,14 +2303,14 @@ Lint/RedundantRegexpQuantifiers:
2254
2303
  Lint/RedundantRequireStatement:
2255
2304
  Description: 'Checks for unnecessary `require` statement.'
2256
2305
  Enabled: true
2257
- SafeAutoCorrect: false
2258
2306
  VersionAdded: '0.76'
2259
- VersionChanged: '1.57'
2307
+ VersionChanged: '1.73'
2260
2308
 
2261
2309
  Lint/RedundantSafeNavigation:
2262
2310
  Description: 'Checks for redundant safe navigation calls.'
2263
2311
  Enabled: true
2264
2312
  VersionAdded: '0.93'
2313
+ VersionChanged: '1.79'
2265
2314
  AllowedMethods:
2266
2315
  - instance_of?
2267
2316
  - kind_of?
@@ -2269,6 +2318,12 @@ Lint/RedundantSafeNavigation:
2269
2318
  - eql?
2270
2319
  - respond_to?
2271
2320
  - equal?
2321
+ InferNonNilReceiver: false
2322
+ AdditionalNilMethods:
2323
+ - present?
2324
+ - blank?
2325
+ - try
2326
+ - try!
2272
2327
  Safe: false
2273
2328
 
2274
2329
  Lint/RedundantSplatExpansion:
@@ -2285,6 +2340,11 @@ Lint/RedundantStringCoercion:
2285
2340
  VersionAdded: '0.19'
2286
2341
  VersionChanged: '0.77'
2287
2342
 
2343
+ Lint/RedundantTypeConversion:
2344
+ Description: 'Checks for redundantly converting a literal to the same type.'
2345
+ Enabled: pending
2346
+ VersionAdded: '1.72'
2347
+
2288
2348
  Lint/RedundantWithIndex:
2289
2349
  Description: 'Checks for redundant `with_index`.'
2290
2350
  Enabled: true
@@ -2293,13 +2353,16 @@ Lint/RedundantWithIndex:
2293
2353
  Lint/RedundantWithObject:
2294
2354
  Description: 'Checks for redundant `with_object`.'
2295
2355
  Enabled: true
2356
+ SafeAutoCorrect: false
2296
2357
  VersionAdded: '0.51'
2358
+ VersionChanged: '1.88'
2297
2359
 
2298
2360
  Lint/RefinementImportMethods:
2299
2361
  Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
2300
2362
  Enabled: pending
2301
2363
  SafeAutoCorrect: false
2302
2364
  VersionAdded: '1.27'
2365
+ VersionChanged: '1.88'
2303
2366
 
2304
2367
  Lint/RegexpAsCondition:
2305
2368
  Description: >-
@@ -2362,8 +2425,9 @@ Lint/SafeNavigationConsistency:
2362
2425
  consistent and appropriate safe navigation, without excess or deficiency,
2363
2426
  is used for all method calls on the same object.
2364
2427
  Enabled: true
2428
+ SafeAutoCorrect: false
2365
2429
  VersionAdded: '0.55'
2366
- VersionChanged: '0.77'
2430
+ VersionChanged: '1.85'
2367
2431
  AllowedMethods:
2368
2432
  - present?
2369
2433
  - blank?
@@ -2387,6 +2451,7 @@ Lint/SelfAssignment:
2387
2451
  Description: 'Checks for self-assignments.'
2388
2452
  Enabled: true
2389
2453
  VersionAdded: '0.89'
2454
+ AllowRBSInlineAnnotation: false
2390
2455
 
2391
2456
  Lint/SendWithMixinArgument:
2392
2457
  Description: 'Checks for `send` method when using mixin.'
@@ -2410,8 +2475,9 @@ Lint/ShadowingOuterLocalVariable:
2410
2475
  Description: >-
2411
2476
  Do not use the same name as outer local variable
2412
2477
  for block arguments or block local variables.
2413
- Enabled: true
2478
+ Enabled: false
2414
2479
  VersionAdded: '0.9'
2480
+ VersionChanged: '1.76'
2415
2481
 
2416
2482
  Lint/SharedMutableDefault:
2417
2483
  Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
@@ -2428,10 +2494,16 @@ Lint/SuppressedException:
2428
2494
  Description: "Don't suppress exceptions."
2429
2495
  StyleGuide: '#dont-hide-exceptions'
2430
2496
  Enabled: true
2431
- AllowComments: true
2432
- AllowNil: true
2433
2497
  VersionAdded: '0.9'
2434
2498
  VersionChanged: '1.12'
2499
+ AllowComments: true
2500
+ AllowNil: true
2501
+
2502
+ Lint/SuppressedExceptionInNumberConversion:
2503
+ Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
2504
+ Enabled: pending
2505
+ SafeAutoCorrect: false
2506
+ VersionAdded: '1.72'
2435
2507
 
2436
2508
  Lint/SymbolConversion:
2437
2509
  Description: 'Checks for unnecessary symbol conversions.'
@@ -2518,7 +2590,7 @@ Lint/UnmodifiedReduceAccumulator:
2518
2590
  VersionChanged: '1.5'
2519
2591
 
2520
2592
  Lint/UnreachableCode:
2521
- Description: 'Unreachable code.'
2593
+ Description: 'Checks for unreachable code.'
2522
2594
  Enabled: true
2523
2595
  VersionAdded: '0.9'
2524
2596
 
@@ -2532,6 +2604,11 @@ Lint/UnreachableLoop:
2532
2604
  # eg. `exactly(2).times`
2533
2605
  - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2534
2606
 
2607
+ Lint/UnreachablePatternBranch:
2608
+ Description: 'Checks for unreachable `in` pattern branches after an unconditional catch-all pattern.'
2609
+ Enabled: pending
2610
+ VersionAdded: '1.85'
2611
+
2535
2612
  Lint/UnusedBlockArgument:
2536
2613
  Description: 'Checks for unused block arguments.'
2537
2614
  StyleGuide: '#underscore-unused-vars'
@@ -2588,6 +2665,18 @@ Lint/UselessAssignment:
2588
2665
  VersionAdded: '0.11'
2589
2666
  VersionChanged: '1.66'
2590
2667
 
2668
+ Lint/UselessConstantScoping:
2669
+ Description: 'Checks for useless constant scoping.'
2670
+ Enabled: pending
2671
+ VersionAdded: '1.72'
2672
+
2673
+ Lint/UselessDefaultValueArgument:
2674
+ Description: 'Checks for usage of `fetch` or `Array.new` with default value argument and block.'
2675
+ Enabled: pending
2676
+ VersionAdded: '1.76'
2677
+ Safe: false
2678
+ AllowedReceivers: []
2679
+
2591
2680
  Lint/UselessDefined:
2592
2681
  Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
2593
2682
  Enabled: pending
@@ -2612,6 +2701,14 @@ Lint/UselessNumericOperation:
2612
2701
  Enabled: pending
2613
2702
  VersionAdded: '1.66'
2614
2703
 
2704
+ Lint/UselessOr:
2705
+ Description: 'Checks for useless OR expressions.'
2706
+ Enabled: pending
2707
+ SafeAutoCorrect: false
2708
+ AutoCorrect: contextual
2709
+ VersionAdded: '1.76'
2710
+ VersionChanged: '1.82'
2711
+
2615
2712
  Lint/UselessRescue:
2616
2713
  Description: 'Checks for useless `rescue`s.'
2617
2714
  Enabled: pending
@@ -2638,7 +2735,7 @@ Lint/UselessTimes:
2638
2735
  VersionChanged: '1.61'
2639
2736
 
2640
2737
  Lint/Void:
2641
- Description: 'Possible use of operator/literal/variable in void context.'
2738
+ Description: 'Checks for operators, literals, lambdas, and procs used in void context.'
2642
2739
  Enabled: true
2643
2740
  AutoCorrect: contextual
2644
2741
  VersionAdded: '0.9'
@@ -2648,11 +2745,9 @@ Lint/Void:
2648
2745
  #################### Metrics ###############################
2649
2746
 
2650
2747
  Metrics/AbcSize:
2651
- Description: >-
2652
- A calculated magnitude based on number of assignments,
2653
- branches, and conditions.
2654
- Reference:
2655
- - http://c2.com/cgi/wiki?AbcMetric
2748
+ Description: 'Checks that the ABC size of methods is not higher than the configured maximum.'
2749
+ References:
2750
+ - https://wiki.c2.com/?AbcMetric
2656
2751
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
2657
2752
  Enabled: true
2658
2753
  VersionAdded: '0.27'
@@ -2703,13 +2798,12 @@ Metrics/CollectionLiteralLength:
2703
2798
  Description: 'Checks for `Array` or `Hash` literals with many entries.'
2704
2799
  Enabled: pending
2705
2800
  VersionAdded: '1.47'
2706
- LengthThreshold: 250
2801
+ VersionChanged: '1.88'
2802
+ Max: 250
2707
2803
 
2708
2804
  # Avoid complex methods.
2709
2805
  Metrics/CyclomaticComplexity:
2710
- Description: >-
2711
- A complexity metric that is strongly correlated to the number
2712
- of test cases needed to validate a method.
2806
+ Description: 'Checks that the cyclomatic complexity of methods is not higher than the configured maximum.'
2713
2807
  Enabled: true
2714
2808
  VersionAdded: '0.25'
2715
2809
  VersionChanged: '0.81'
@@ -2749,29 +2843,25 @@ Metrics/ParameterLists:
2749
2843
  MaxOptionalParameters: 3
2750
2844
 
2751
2845
  Metrics/PerceivedComplexity:
2752
- Description: >-
2753
- A complexity metric geared towards measuring complexity for a
2754
- human reader.
2846
+ Description: 'Checks that the perceived complexity of methods is not higher than the configured maximum.'
2755
2847
  Enabled: true
2756
2848
  VersionAdded: '0.25'
2757
- VersionChanged: '0.81'
2849
+ VersionChanged: '1.88'
2758
2850
  AllowedMethods: []
2759
2851
  AllowedPatterns: []
2760
2852
  Max: 8
2761
2853
 
2762
- ################## Migration #############################
2854
+ #################### Migration #############################
2763
2855
 
2764
2856
  Migration/DepartmentName:
2765
- Description: >-
2766
- Check that cop names in rubocop:disable (etc) comments are
2767
- given with department name.
2857
+ Description: 'Checks that cop names in `rubocop:disable` (etc.) comments are given with a department name.'
2768
2858
  Enabled: true
2769
2859
  VersionAdded: '0.75'
2770
2860
 
2771
- #################### Naming ##############################
2861
+ #################### Naming ################################
2772
2862
 
2773
2863
  Naming/AccessorMethodName:
2774
- Description: Check the naming of accessor methods for get_/set_.
2864
+ Description: Checks the naming of accessor methods for get_/set_.
2775
2865
  StyleGuide: '#accessor_mutator_method_names'
2776
2866
  Enabled: true
2777
2867
  VersionAdded: '0.50'
@@ -2785,7 +2875,7 @@ Naming/AsciiIdentifiers:
2785
2875
  AsciiConstants: true
2786
2876
 
2787
2877
  Naming/BinaryOperatorParameterName:
2788
- Description: 'When defining binary operators, name the argument other.'
2878
+ Description: 'Checks that the sole parameter of binary operator methods is named `other`.'
2789
2879
  StyleGuide: '#other-arg'
2790
2880
  Enabled: true
2791
2881
  VersionAdded: '0.50'
@@ -2955,7 +3045,10 @@ Naming/InclusiveLanguage:
2955
3045
  - block
2956
3046
  slave:
2957
3047
  WholeWord: true
2958
- Suggestions: ['replica', 'secondary', 'follower']
3048
+ Suggestions:
3049
+ - replica
3050
+ - secondary
3051
+ - follower
2959
3052
 
2960
3053
  Naming/MemoizedInstanceVariableName:
2961
3054
  Description: >-
@@ -2975,6 +3068,7 @@ Naming/MethodName:
2975
3068
  StyleGuide: '#snake-case-symbols-methods-vars'
2976
3069
  Enabled: true
2977
3070
  VersionAdded: '0.50'
3071
+ VersionChanged: '1.75'
2978
3072
  EnforcedStyle: snake_case
2979
3073
  SupportedStyles:
2980
3074
  - snake_case
@@ -2986,6 +3080,10 @@ Naming/MethodName:
2986
3080
  # - '\A\s*onSelectionCleared\s*'
2987
3081
  #
2988
3082
  AllowedPatterns: []
3083
+ ForbiddenIdentifiers:
3084
+ - __id__
3085
+ - __send__
3086
+ ForbiddenPatterns: []
2989
3087
 
2990
3088
  Naming/MethodParameterName:
2991
3089
  Description: >-
@@ -3017,22 +3115,43 @@ Naming/MethodParameterName:
3017
3115
  # Forbidden names that will register an offense
3018
3116
  ForbiddenNames: []
3019
3117
 
3020
- Naming/PredicateName:
3021
- Description: 'Check the names of predicate methods.'
3118
+ Naming/PredicateMethod:
3119
+ Description: 'Checks that predicate methods end with `?` and non-predicate methods do not.'
3120
+ Enabled: pending
3121
+ VersionAdded: '1.76'
3122
+ VersionChanged: '1.78'
3123
+ # In `aggressive` mode, the cop will register an offense for predicate methods that
3124
+ # may return a non-boolean value.
3125
+ # In `conservative` mode, the cop will *not* register an offense for predicate methods
3126
+ # that may return a non-boolean value.
3127
+ Mode: conservative
3128
+ AllowedMethods:
3129
+ - call
3130
+ AllowedPatterns: []
3131
+ AllowBangMethods: false
3132
+ # Methods that are known to not return a boolean value, despite ending in `?`.
3133
+ WaywardPredicates:
3134
+ - infinite?
3135
+ - nonzero?
3136
+
3137
+ Naming/PredicatePrefix:
3138
+ Description: 'Checks that predicate method names end with a question mark and do not start with a forbidden prefix.'
3022
3139
  StyleGuide: '#bool-methods-qmark'
3023
3140
  Enabled: true
3024
3141
  VersionAdded: '0.50'
3025
- VersionChanged: '0.77'
3142
+ VersionChanged: '1.75'
3026
3143
  # Predicate name prefixes.
3027
3144
  NamePrefix:
3028
3145
  - is_
3029
3146
  - has_
3030
3147
  - have_
3148
+ - does_
3031
3149
  # Predicate name prefixes that should be removed.
3032
3150
  ForbiddenPrefixes:
3033
3151
  - is_
3034
3152
  - has_
3035
3153
  - have_
3154
+ - does_
3036
3155
  # Predicate names which, despite having a forbidden prefix, or no `?`,
3037
3156
  # should still be accepted
3038
3157
  AllowedMethods:
@@ -3041,6 +3160,8 @@ Naming/PredicateName:
3041
3160
  MethodDefinitionMacros:
3042
3161
  - define_method
3043
3162
  - define_singleton_method
3163
+ # Use Sorbet's T::Boolean return type to detect predicate methods.
3164
+ UseSorbetSigs: false
3044
3165
  # Exclude Rspec specs because there is a strong convention to write spec
3045
3166
  # helpers in the form of `have_something` or `be_something`.
3046
3167
  Exclude:
@@ -3058,13 +3179,15 @@ Naming/VariableName:
3058
3179
  StyleGuide: '#snake-case-symbols-methods-vars'
3059
3180
  Enabled: true
3060
3181
  VersionAdded: '0.50'
3061
- VersionChanged: '1.8'
3182
+ VersionChanged: '1.73'
3062
3183
  EnforcedStyle: snake_case
3063
3184
  SupportedStyles:
3064
3185
  - snake_case
3065
3186
  - camelCase
3066
3187
  AllowedIdentifiers: []
3067
3188
  AllowedPatterns: []
3189
+ ForbiddenIdentifiers: []
3190
+ ForbiddenPatterns: []
3068
3191
 
3069
3192
  Naming/VariableNumber:
3070
3193
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -3080,6 +3203,8 @@ Naming/VariableNumber:
3080
3203
  CheckMethodNames: true
3081
3204
  CheckSymbols: true
3082
3205
  AllowedIdentifiers:
3206
+ - TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
3207
+ - TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
3083
3208
  - capture3 # Open3.capture3
3084
3209
  - iso8601 # Time#iso8601
3085
3210
  - rfc1123_date # CGI.rfc1123_date
@@ -3092,14 +3217,14 @@ Naming/VariableNumber:
3092
3217
  #################### Security ##############################
3093
3218
 
3094
3219
  Security/CompoundHash:
3095
- Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
3220
+ Description: 'Checks for `hash` implementations that combine values manually instead of delegating to `Array#hash`.'
3096
3221
  Enabled: pending
3097
3222
  Safe: false
3098
3223
  VersionAdded: '1.28'
3099
3224
  VersionChanged: '1.51'
3100
3225
 
3101
3226
  Security/Eval:
3102
- Description: 'The use of eval represents a serious security risk.'
3227
+ Description: 'Checks for the use of `Kernel#eval` and `Binding#eval` with dynamic arguments.'
3103
3228
  Enabled: true
3104
3229
  VersionAdded: '0.47'
3105
3230
 
@@ -3115,7 +3240,9 @@ Security/JSONLoad:
3115
3240
  Description: >-
3116
3241
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
3117
3242
  security issues. See reference for more information.
3118
- Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3243
+ References:
3244
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3245
+ - 'https://bugs.ruby-lang.org/issues/19528'
3119
3246
  Enabled: true
3120
3247
  VersionAdded: '0.43'
3121
3248
  VersionChanged: '1.22'
@@ -3127,12 +3254,13 @@ Security/MarshalLoad:
3127
3254
  Description: >-
3128
3255
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
3129
3256
  security issues. See reference for more information.
3130
- Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3257
+ References:
3258
+ - 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3131
3259
  Enabled: true
3132
3260
  VersionAdded: '0.47'
3133
3261
 
3134
3262
  Security/Open:
3135
- Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
3263
+ Description: 'Checks for the use of `Kernel#open` and `URI.open` with dynamic data.'
3136
3264
  Enabled: true
3137
3265
  VersionAdded: '0.53'
3138
3266
  VersionChanged: '1.0'
@@ -3142,12 +3270,13 @@ Security/YAMLLoad:
3142
3270
  Description: >-
3143
3271
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
3144
3272
  security issues. See reference for more information.
3145
- Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3273
+ References:
3274
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3146
3275
  Enabled: true
3147
3276
  VersionAdded: '0.47'
3148
3277
  SafeAutoCorrect: false
3149
3278
 
3150
- #################### Style ###############################
3279
+ #################### Style #################################
3151
3280
 
3152
3281
  Style/AccessModifierDeclarations:
3153
3282
  Description: 'Checks style of how access modifiers are used.'
@@ -3187,7 +3316,7 @@ Style/Alias:
3187
3316
 
3188
3317
  Style/AmbiguousEndlessMethodDefinition:
3189
3318
  Description: 'Checks for endless methods inside operators of lower precedence.'
3190
- StyleGuide: '#ambiguous-endless-method-defintions'
3319
+ StyleGuide: '#ambiguous-endless-method-definitions'
3191
3320
  Enabled: pending
3192
3321
  VersionAdded: '1.68'
3193
3322
 
@@ -3209,6 +3338,8 @@ Style/ArgumentsForwarding:
3209
3338
  Description: 'Use arguments forwarding.'
3210
3339
  StyleGuide: '#arguments-forwarding'
3211
3340
  Enabled: pending
3341
+ VersionAdded: '1.1'
3342
+ VersionChanged: '1.58'
3212
3343
  AllowOnlyRestArgument: true
3213
3344
  UseAnonymousForwarding: true
3214
3345
  RedundantRestArgumentNames:
@@ -3222,8 +3353,6 @@ Style/ArgumentsForwarding:
3222
3353
  - blk
3223
3354
  - block
3224
3355
  - proc
3225
- VersionAdded: '1.1'
3226
- VersionChanged: '1.58'
3227
3356
 
3228
3357
  Style/ArrayCoercion:
3229
3358
  Description: >-
@@ -3236,7 +3365,8 @@ Style/ArrayCoercion:
3236
3365
 
3237
3366
  Style/ArrayFirstLast:
3238
3367
  Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3239
- Reference: '#first-and-last'
3368
+ References:
3369
+ - '#first-and-last'
3240
3370
  Enabled: false
3241
3371
  VersionAdded: '1.58'
3242
3372
  Safe: false
@@ -3247,6 +3377,12 @@ Style/ArrayIntersect:
3247
3377
  Safe: false
3248
3378
  VersionAdded: '1.40'
3249
3379
 
3380
+ Style/ArrayIntersectWithSingleElement:
3381
+ Description: 'Use `include?(element)` instead of `intersect?([element])`.'
3382
+ Enabled: 'pending'
3383
+ Safe: false
3384
+ VersionAdded: '1.81'
3385
+
3250
3386
  Style/ArrayJoin:
3251
3387
  Description: 'Use Array#join instead of Array#*.'
3252
3388
  StyleGuide: '#array-join'
@@ -3424,9 +3560,11 @@ Style/BlockDelimiters:
3424
3560
  BracesRequiredMethods: []
3425
3561
 
3426
3562
  Style/CaseEquality:
3427
- Description: 'Avoid explicit use of the case equality operator(===).'
3563
+ Description: 'Avoid explicit use of the case equality operator (`===`).'
3428
3564
  StyleGuide: '#no-case-equality'
3429
3565
  Enabled: true
3566
+ References:
3567
+ - 'https://docs.rubocop.org/rubocop-performance/cops_performance.html#performanceregexpmatch'
3430
3568
  VersionAdded: '0.9'
3431
3569
  VersionChanged: '0.89'
3432
3570
  # If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
@@ -3475,6 +3613,7 @@ Style/ClassAndModuleChildren:
3475
3613
  SafeAutoCorrect: false
3476
3614
  Enabled: true
3477
3615
  VersionAdded: '0.19'
3616
+ VersionChanged: '1.74'
3478
3617
  #
3479
3618
  # Basically there are two different styles:
3480
3619
  #
@@ -3490,7 +3629,21 @@ Style/ClassAndModuleChildren:
3490
3629
  #
3491
3630
  # The compact style is only forced, for classes or modules with one child.
3492
3631
  EnforcedStyle: nested
3493
- SupportedStyles:
3632
+ SupportedStyles: &supported_styles
3633
+ - nested
3634
+ - compact
3635
+ # Configure classes separately, if desired. If not set, or set to `nil`,
3636
+ # the `EnforcedStyle` value will be used.
3637
+ EnforcedStyleForClasses: ~
3638
+ SupportedStylesForClasses:
3639
+ - ~
3640
+ - nested
3641
+ - compact
3642
+ # Configure modules separately, if desired. If not set, or set to `nil`,
3643
+ # the `EnforcedStyle` value will be used.
3644
+ EnforcedStyleForModules: ~
3645
+ SupportedStylesForModules:
3646
+ - ~
3494
3647
  - nested
3495
3648
  - compact
3496
3649
 
@@ -3550,7 +3703,7 @@ Style/CollectionCompact:
3550
3703
 
3551
3704
  # Align with the style guide.
3552
3705
  Style/CollectionMethods:
3553
- Description: 'Preferred collection methods.'
3706
+ Description: 'Enforces the use of consistent method names from the `Enumerable` module.'
3554
3707
  StyleGuide: '#map-find-select-reduce-include-size'
3555
3708
  Enabled: false
3556
3709
  VersionAdded: '0.9'
@@ -3576,6 +3729,13 @@ Style/CollectionMethods:
3576
3729
  - inject
3577
3730
  - reduce
3578
3731
 
3732
+ Style/CollectionQuerying:
3733
+ Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
3734
+ StyleGuide: '#collection-querying'
3735
+ Enabled: pending
3736
+ VersionAdded: '1.77'
3737
+ Safe: false
3738
+
3579
3739
  Style/ColonMethodCall:
3580
3740
  Description: 'Do not use :: for method call.'
3581
3741
  StyleGuide: '#double-colons'
@@ -3643,6 +3803,14 @@ Style/CommentedKeyword:
3643
3803
  VersionAdded: '0.51'
3644
3804
  VersionChanged: '1.19'
3645
3805
 
3806
+ Style/ComparableBetween:
3807
+ Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
3808
+ StyleGuide: '#ranges-or-between'
3809
+ Enabled: pending
3810
+ Safe: false
3811
+ VersionAdded: '1.74'
3812
+ VersionChanged: '1.75'
3813
+
3646
3814
  Style/ComparableClamp:
3647
3815
  Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3648
3816
  Enabled: pending
@@ -3828,6 +3996,18 @@ Style/EmptyCaseCondition:
3828
3996
  Enabled: true
3829
3997
  VersionAdded: '0.40'
3830
3998
 
3999
+ Style/EmptyClassDefinition:
4000
+ Description: 'Enforces consistent style for empty class definitions.'
4001
+ Enabled: pending
4002
+ VersionAdded: '1.84'
4003
+ VersionChanged: '1.86'
4004
+ EnforcedStyle: class_keyword
4005
+ SupportedStyles:
4006
+ - class_keyword
4007
+ - class_new
4008
+ - class_definition # Deprecated.
4009
+ AllowedParentClasses: []
4010
+
3831
4011
  Style/EmptyElse:
3832
4012
  Description: 'Avoid empty else-clauses.'
3833
4013
  Enabled: true
@@ -3875,6 +4055,16 @@ Style/EmptyMethod:
3875
4055
  - compact
3876
4056
  - expanded
3877
4057
 
4058
+ Style/EmptyStringInsideInterpolation:
4059
+ Description: 'Checks for empty strings being assigned inside string interpolation.'
4060
+ StyleGuide: '#empty-strings-in-interpolation'
4061
+ Enabled: pending
4062
+ EnforcedStyle: trailing_conditional
4063
+ SupportedStyles:
4064
+ - trailing_conditional
4065
+ - ternary
4066
+ VersionAdded: '1.76'
4067
+
3878
4068
  Style/Encoding:
3879
4069
  Description: 'Use UTF-8 as the source file encoding.'
3880
4070
  StyleGuide: '#utf-8'
@@ -3899,6 +4089,8 @@ Style/EndlessMethod:
3899
4089
  - allow_single_line
3900
4090
  - allow_always
3901
4091
  - disallow
4092
+ - require_single_line
4093
+ - require_always
3902
4094
 
3903
4095
  Style/EnvHome:
3904
4096
  Description: "Checks for consistent usage of `ENV['HOME']`."
@@ -3938,7 +4130,7 @@ Style/ExplicitBlockArgument:
3938
4130
  VersionChanged: '1.8'
3939
4131
 
3940
4132
  Style/ExponentialNotation:
3941
- Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
4133
+ Description: 'Enforces consistency in the use of exponential (scientific) notation.'
3942
4134
  StyleGuide: '#exponential-notation'
3943
4135
  Enabled: true
3944
4136
  VersionAdded: '0.82'
@@ -3951,12 +4143,16 @@ Style/ExponentialNotation:
3951
4143
  Style/FetchEnvVar:
3952
4144
  Description: >-
3953
4145
  Suggests `ENV.fetch` for the replacement of `ENV[]`.
3954
- Reference:
4146
+ References:
3955
4147
  - https://rubystyle.guide/#hash-fetch-defaults
3956
4148
  Enabled: pending
3957
4149
  VersionAdded: '1.28'
4150
+ VersionChanged: '1.88'
3958
4151
  # Environment variables to be excluded from the inspection.
3959
- AllowedVars: []
4152
+ AllowedVariables: []
4153
+ # When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
4154
+ # When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
4155
+ DefaultToNil: true
3960
4156
 
3961
4157
  Style/FileEmpty:
3962
4158
  Description: >-
@@ -3971,6 +4167,12 @@ Style/FileNull:
3971
4167
  SafeAutoCorrect: false
3972
4168
  VersionAdded: '1.69'
3973
4169
 
4170
+ Style/FileOpen:
4171
+ Description: 'Checks for `File.open` without a block, which can leak file descriptors.'
4172
+ Enabled: pending
4173
+ Safe: false
4174
+ VersionAdded: '1.85'
4175
+
3974
4176
  Style/FileRead:
3975
4177
  Description: 'Favor `File.(bin)read` convenience methods.'
3976
4178
  StyleGuide: '#file-read'
@@ -3992,7 +4194,8 @@ Style/FileWrite:
3992
4194
  Style/FloatDivision:
3993
4195
  Description: 'For performing float division, coerce one side only.'
3994
4196
  StyleGuide: '#float-division'
3995
- Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
4197
+ References:
4198
+ - 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3996
4199
  Enabled: true
3997
4200
  VersionAdded: '0.72'
3998
4201
  VersionChanged: '1.9'
@@ -4031,6 +4234,8 @@ Style/FormatString:
4031
4234
  Style/FormatStringToken:
4032
4235
  Description: 'Use a consistent style for format string tokens.'
4033
4236
  Enabled: true
4237
+ VersionAdded: '0.49'
4238
+ VersionChanged: '1.74'
4034
4239
  EnforcedStyle: annotated
4035
4240
  SupportedStyles:
4036
4241
  # Prefer tokens which contain a sprintf like type annotation like
@@ -4043,8 +4248,12 @@ Style/FormatStringToken:
4043
4248
  # style token in a format string to be allowed when enforced style is not
4044
4249
  # `unannotated`.
4045
4250
  MaxUnannotatedPlaceholdersAllowed: 1
4046
- VersionAdded: '0.49'
4047
- VersionChanged: '1.0'
4251
+ # The mode the cop operates in. Two values are allowed:
4252
+ # * aggressive (default): all strings are considered
4253
+ # * conservative:
4254
+ # only register offenses for strings given to `printf`, `sprintf`,
4255
+ # format` and `%` methods. Other strings are not considered.
4256
+ Mode: aggressive
4048
4257
  AllowedMethods: []
4049
4258
  AllowedPatterns: []
4050
4259
 
@@ -4083,14 +4292,15 @@ Style/GlobalStdStream:
4083
4292
  Style/GlobalVars:
4084
4293
  Description: 'Do not introduce global variables.'
4085
4294
  StyleGuide: '#instance-vars'
4086
- Reference: 'https://www.zenspider.com/ruby/quickref.html'
4295
+ References:
4296
+ - 'https://www.zenspider.com/ruby/quickref.html'
4087
4297
  Enabled: true
4088
4298
  VersionAdded: '0.13'
4089
4299
  # Built-in global variables are allowed by default.
4090
4300
  AllowedVariables: []
4091
4301
 
4092
4302
  Style/GuardClause:
4093
- Description: 'Check for conditionals that can be replaced with guard clauses.'
4303
+ Description: 'Checks for conditionals that can be replaced with guard clauses.'
4094
4304
  StyleGuide: '#no-nested-conditionals'
4095
4305
  Enabled: true
4096
4306
  VersionAdded: '0.20'
@@ -4140,6 +4350,12 @@ Style/HashExcept:
4140
4350
  VersionAdded: '1.7'
4141
4351
  VersionChanged: '1.39'
4142
4352
 
4353
+ Style/HashFetchChain:
4354
+ Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
4355
+ Enabled: pending
4356
+ Safe: false
4357
+ VersionAdded: '1.75'
4358
+
4143
4359
  Style/HashLikeCase:
4144
4360
  Description: >-
4145
4361
  Checks for places where `case-when` represents a simple 1:1
@@ -4150,6 +4366,16 @@ Style/HashLikeCase:
4150
4366
  # to trigger this cop
4151
4367
  MinBranchesCount: 3
4152
4368
 
4369
+ Style/HashLookupMethod:
4370
+ Description: 'Enforces the use of either `Hash#[]` or `Hash#fetch` for hash lookup.'
4371
+ Enabled: false
4372
+ Safe: false
4373
+ VersionAdded: '1.84'
4374
+ EnforcedStyle: brackets
4375
+ SupportedStyles:
4376
+ - brackets
4377
+ - fetch
4378
+
4153
4379
  Style/HashSlice:
4154
4380
  Description: >-
4155
4381
  Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
@@ -4221,9 +4447,9 @@ Style/IdenticalConditionalBranches:
4221
4447
  Style/IfInsideElse:
4222
4448
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
4223
4449
  Enabled: true
4224
- AllowIfModifier: false
4225
4450
  VersionAdded: '0.36'
4226
4451
  VersionChanged: '1.3'
4452
+ AllowIfModifier: false
4227
4453
 
4228
4454
  Style/IfUnlessModifier:
4229
4455
  Description: >-
@@ -4247,6 +4473,7 @@ Style/IfWithBooleanLiteralBranches:
4247
4473
  VersionAdded: '1.9'
4248
4474
  SafeAutoCorrect: false
4249
4475
  AllowedMethods:
4476
+ - infinite?
4250
4477
  - nonzero?
4251
4478
 
4252
4479
  Style/IfWithSemicolon:
@@ -4346,10 +4573,22 @@ Style/IpAddresses:
4346
4573
  - '**/*.gemspec'
4347
4574
 
4348
4575
  Style/ItAssignment:
4349
- Description: 'Checks for assignment to `it` inside a block.'
4576
+ Description: 'Checks for local variables and method parameters named `it`.'
4350
4577
  Enabled: pending
4351
4578
  VersionAdded: '1.70'
4352
4579
 
4580
+ Style/ItBlockParameter:
4581
+ Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
4582
+ Enabled: pending
4583
+ VersionAdded: '1.75'
4584
+ VersionChanged: '1.76'
4585
+ EnforcedStyle: allow_single_line
4586
+ SupportedStyles:
4587
+ - allow_single_line
4588
+ - only_numbered_parameters
4589
+ - always
4590
+ - disallow
4591
+
4353
4592
  Style/KeywordArgumentsMerging:
4354
4593
  Description: >-
4355
4594
  When passing an existing hash as keyword arguments, provide additional arguments
@@ -4381,8 +4620,9 @@ Style/LambdaCall:
4381
4620
  Description: 'Use lambda.call(...) instead of lambda.(...).'
4382
4621
  StyleGuide: '#proc-call'
4383
4622
  Enabled: true
4623
+ AutoCorrect: contextual
4384
4624
  VersionAdded: '0.13'
4385
- VersionChanged: '0.14'
4625
+ VersionChanged: '1.81'
4386
4626
  EnforcedStyle: call
4387
4627
  SupportedStyles:
4388
4628
  - call
@@ -4420,7 +4660,9 @@ Style/MagicCommentFormat:
4420
4660
  Style/MapCompactWithConditionalBlock:
4421
4661
  Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
4422
4662
  Enabled: pending
4663
+ SafeAutoCorrect: false
4423
4664
  VersionAdded: '1.30'
4665
+ VersionChanged: '1.88'
4424
4666
 
4425
4667
  Style/MapIntoArray:
4426
4668
  Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
@@ -4430,6 +4672,12 @@ Style/MapIntoArray:
4430
4672
  VersionChanged: '1.67'
4431
4673
  Safe: false
4432
4674
 
4675
+ Style/MapJoin:
4676
+ Description: 'Checks for redundant `map(&:to_s)` before `join`.'
4677
+ Enabled: pending
4678
+ Safe: false
4679
+ VersionAdded: '1.85'
4680
+
4433
4681
  Style/MapToHash:
4434
4682
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
4435
4683
  Enabled: pending
@@ -4452,6 +4700,7 @@ Style/MethodCallWithArgsParentheses:
4452
4700
  AllowedMethods: []
4453
4701
  AllowedPatterns: []
4454
4702
  IncludedMacros: []
4703
+ IncludedMacroPatterns: []
4455
4704
  AllowParenthesesInMultilineCall: false
4456
4705
  AllowParenthesesInChaining: false
4457
4706
  AllowParenthesesInCamelCaseMethod: false
@@ -4465,10 +4714,10 @@ Style/MethodCallWithoutArgsParentheses:
4465
4714
  Description: 'Do not use parentheses for method calls with no arguments.'
4466
4715
  StyleGuide: '#method-invocation-parens'
4467
4716
  Enabled: true
4468
- AllowedMethods: []
4469
- AllowedPatterns: []
4470
4717
  VersionAdded: '0.47'
4471
4718
  VersionChanged: '0.55'
4719
+ AllowedMethods: []
4720
+ AllowedPatterns: []
4472
4721
 
4473
4722
  Style/MethodCalledOnDoEndBlock:
4474
4723
  Description: 'Avoid chaining a method call on a do...end block.'
@@ -4562,6 +4811,11 @@ Style/ModuleFunction:
4562
4811
  Autocorrect: false
4563
4812
  SafeAutoCorrect: false
4564
4813
 
4814
+ Style/ModuleMemberExistenceCheck:
4815
+ Description: 'Checks for usage of `Module` methods returning arrays that can be replaced with equivalent predicates.'
4816
+ Enabled: pending
4817
+ VersionAdded: '1.82'
4818
+
4565
4819
  Style/MultilineBlockChain:
4566
4820
  Description: 'Avoid multi-line chains of blocks.'
4567
4821
  StyleGuide: '#single-line-blocks'
@@ -4569,7 +4823,7 @@ Style/MultilineBlockChain:
4569
4823
  VersionAdded: '0.13'
4570
4824
 
4571
4825
  Style/MultilineIfModifier:
4572
- Description: 'Only use if/unless modifiers on single line statements.'
4826
+ Description: 'Checks for uses of `if`/`unless` modifiers with multiline bodies.'
4573
4827
  StyleGuide: '#no-multiline-if-modifiers'
4574
4828
  Enabled: true
4575
4829
  VersionAdded: '0.45'
@@ -4632,7 +4886,7 @@ Style/MutableConstant:
4632
4886
  Description: 'Do not assign mutable objects to constants.'
4633
4887
  Enabled: true
4634
4888
  VersionAdded: '0.34'
4635
- VersionChanged: '1.8'
4889
+ VersionChanged: '1.88'
4636
4890
  SafeAutoCorrect: false
4637
4891
  EnforcedStyle: literals
4638
4892
  SupportedStyles:
@@ -4644,6 +4898,9 @@ Style/MutableConstant:
4644
4898
  # no harm in freezing an already frozen object.
4645
4899
  - literals
4646
4900
  - strict
4901
+ # When `true`, recursively check and freeze mutable literals nested inside
4902
+ # arrays and hashes (e.g. `[{a: []}]` becomes `[{a: [].freeze}.freeze].freeze`).
4903
+ Recursive: false
4647
4904
 
4648
4905
  Style/NegatedIf:
4649
4906
  Description: >-
@@ -4689,6 +4946,14 @@ Style/NegatedWhile:
4689
4946
  Enabled: true
4690
4947
  VersionAdded: '0.20'
4691
4948
 
4949
+ Style/NegativeArrayIndex:
4950
+ Description: >-
4951
+ Use negative array indices instead of calculating array length minus a value.
4952
+ Also handles range patterns with length calculations. Recognizes preserving methods
4953
+ and their combinations, allowing safe replacement when the receiver matches.
4954
+ Enabled: pending
4955
+ VersionAdded: '1.84'
4956
+
4692
4957
  Style/NestedFileDirname:
4693
4958
  Description: 'Checks for nested `File.dirname`.'
4694
4959
  Enabled: pending
@@ -4738,7 +5003,7 @@ Style/Next:
4738
5003
  StyleGuide: '#no-nested-conditionals'
4739
5004
  Enabled: true
4740
5005
  VersionAdded: '0.22'
4741
- VersionChanged: '0.35'
5006
+ VersionChanged: '1.75'
4742
5007
  # With `always` all conditions at the end of an iteration needs to be
4743
5008
  # replaced by next - with `skip_modifier_ifs` the modifier if like this one
4744
5009
  # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
@@ -4746,6 +5011,7 @@ Style/Next:
4746
5011
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
4747
5012
  # needs to have to trigger this cop
4748
5013
  MinBodyLength: 3
5014
+ AllowConsecutiveConditionals: false
4749
5015
  SupportedStyles:
4750
5016
  - skip_modifier_ifs
4751
5017
  - always
@@ -4863,22 +5129,32 @@ Style/ObjectThen:
4863
5129
  - then
4864
5130
  - yield_self
4865
5131
 
5132
+ Style/OneClassPerFile:
5133
+ Description: 'Checks that each source file defines at most one top-level class or module.'
5134
+ Enabled: pending
5135
+ VersionAdded: '1.85'
5136
+ VersionChanged: '1.86'
5137
+ AllowedClasses: []
5138
+ Exclude:
5139
+ - 'spec/**/*'
5140
+ - 'test/**/*'
5141
+
4866
5142
  Style/OneLineConditional:
4867
5143
  Description: >-
4868
5144
  Favor the ternary operator (?:) or multi-line constructs over
4869
5145
  single-line if/then/else/end constructs.
4870
5146
  StyleGuide: '#ternary-operator'
4871
5147
  Enabled: true
4872
- AlwaysCorrectToMultiline: false
4873
5148
  VersionAdded: '0.9'
4874
5149
  VersionChanged: '0.90'
5150
+ AlwaysCorrectToMultiline: false
4875
5151
 
4876
5152
  Style/OpenStructUse:
4877
5153
  Description: >-
4878
5154
  Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4879
5155
  version compatibility, and potential security issues.
4880
- Reference:
4881
- - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
5156
+ References:
5157
+ - https://docs.ruby-lang.org/en/3.0/OpenStruct.html#class-OpenStruct-label-Caveats
4882
5158
 
4883
5159
  Enabled: pending
4884
5160
  Safe: false
@@ -4951,11 +5227,20 @@ Style/ParenthesesAroundCondition:
4951
5227
  AllowSafeAssignment: true
4952
5228
  AllowInMultilineConditions: false
4953
5229
 
5230
+ Style/PartitionInsteadOfDoubleSelect:
5231
+ Description: >-
5232
+ Checks for consecutive `select`/`filter`/`find_all` and `reject` calls
5233
+ on the same receiver with the same block body.
5234
+ Enabled: pending
5235
+ Safe: false
5236
+ VersionAdded: '1.85'
5237
+
4954
5238
  Style/PercentLiteralDelimiters:
4955
5239
  Description: 'Use `%`-literal delimiters consistently.'
4956
5240
  StyleGuide: '#percent-literal-braces'
4957
5241
  Enabled: true
4958
5242
  VersionAdded: '0.19'
5243
+ VersionChanged: '0.48'
4959
5244
  # Specify the default preferred delimiter for all types with the 'default' key
4960
5245
  # Override individual delimiters (even with default specified) by specifying
4961
5246
  # an individual key
@@ -4966,7 +5251,6 @@ Style/PercentLiteralDelimiters:
4966
5251
  '%r': '{}'
4967
5252
  '%w': '[]'
4968
5253
  '%W': '[]'
4969
- VersionChanged: '0.48'
4970
5254
 
4971
5255
  Style/PercentQLiterals:
4972
5256
  Description: 'Checks if uses of %Q/%q match the configured preference.'
@@ -4983,6 +5267,12 @@ Style/PerlBackrefs:
4983
5267
  Enabled: true
4984
5268
  VersionAdded: '0.13'
4985
5269
 
5270
+ Style/PredicateWithKind:
5271
+ Description: 'Prefer `any?(Klass)` to `any? { |x| x.is_a?(Klass) }`.'
5272
+ Enabled: pending
5273
+ SafeAutoCorrect: false
5274
+ VersionAdded: '1.85'
5275
+
4986
5276
  Style/PreferredHashMethods:
4987
5277
  Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
4988
5278
  StyleGuide: '#hash-key'
@@ -5033,8 +5323,14 @@ Style/RandomWithOffset:
5033
5323
  Enabled: true
5034
5324
  VersionAdded: '0.52'
5035
5325
 
5326
+ Style/ReduceToHash:
5327
+ Description: 'Use `to_h { ... }` instead of `each_with_object`, `inject`, or `reduce` to build a hash.'
5328
+ Enabled: pending
5329
+ Safe: false
5330
+ VersionAdded: '1.85'
5331
+
5036
5332
  Style/RedundantArgument:
5037
- Description: 'Check for a redundant argument passed to certain methods.'
5333
+ Description: 'Checks for a redundant argument passed to certain methods.'
5038
5334
  Enabled: pending
5039
5335
  Safe: false
5040
5336
  VersionAdded: '1.4'
@@ -5048,6 +5344,8 @@ Style/RedundantArgument:
5048
5344
  exit: true
5049
5345
  # Kernel.#exit!
5050
5346
  exit!: false
5347
+ # String#to_i
5348
+ to_i: 10
5051
5349
  # String#split
5052
5350
  split: ' '
5053
5351
  # String#chomp
@@ -5060,6 +5358,12 @@ Style/RedundantArrayConstructor:
5060
5358
  Enabled: pending
5061
5359
  VersionAdded: '1.52'
5062
5360
 
5361
+ Style/RedundantArrayFlatten:
5362
+ Description: 'Checks for redundant calls of `Array#flatten`.'
5363
+ Enabled: pending
5364
+ Safe: false
5365
+ VersionAdded: '1.76'
5366
+
5063
5367
  Style/RedundantAssignment:
5064
5368
  Description: 'Checks for redundant assignment before returning.'
5065
5369
  Enabled: true
@@ -5081,6 +5385,10 @@ Style/RedundantCondition:
5081
5385
  Description: 'Checks for unnecessary conditional expressions.'
5082
5386
  Enabled: true
5083
5387
  VersionAdded: '0.76'
5388
+ VersionChanged: '1.73'
5389
+ AllowedMethods:
5390
+ - infinite?
5391
+ - nonzero?
5084
5392
 
5085
5393
  Style/RedundantConditional:
5086
5394
  Description: "Don't return true/false from a conditional."
@@ -5119,7 +5427,8 @@ Style/RedundantFetchBlock:
5119
5427
  Description: >-
5120
5428
  Use `fetch(key, value)` instead of `fetch(key) { value }`
5121
5429
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
5122
- Reference: 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
5430
+ References:
5431
+ - 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
5123
5432
  Enabled: true
5124
5433
  Safe: false
5125
5434
  # If enabled, this cop will autocorrect usages of
@@ -5145,6 +5454,13 @@ Style/RedundantFilterChain:
5145
5454
  VersionAdded: '1.52'
5146
5455
  VersionChanged: '1.57'
5147
5456
 
5457
+ Style/RedundantFormat:
5458
+ Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
5459
+ Enabled: pending
5460
+ SafeAutoCorrect: false
5461
+ VersionAdded: '1.72'
5462
+ VersionChanged: '1.72'
5463
+
5148
5464
  Style/RedundantFreeze:
5149
5465
  Description: "Checks usages of Object#freeze on immutable objects."
5150
5466
  Enabled: true
@@ -5161,9 +5477,9 @@ Style/RedundantInitialize:
5161
5477
  Enabled: pending
5162
5478
  AutoCorrect: contextual
5163
5479
  Safe: false
5164
- AllowComments: true
5165
5480
  VersionAdded: '1.27'
5166
5481
  VersionChanged: '1.61'
5482
+ AllowComments: true
5167
5483
 
5168
5484
  Style/RedundantInterpolation:
5169
5485
  Description: 'Checks for strings that are just an interpolated expression.'
@@ -5178,10 +5494,15 @@ Style/RedundantInterpolationUnfreeze:
5178
5494
  VersionAdded: '1.66'
5179
5495
 
5180
5496
  Style/RedundantLineContinuation:
5181
- Description: 'Check for redundant line continuation.'
5497
+ Description: 'Checks for redundant line continuation.'
5182
5498
  Enabled: pending
5183
5499
  VersionAdded: '1.49'
5184
5500
 
5501
+ Style/RedundantMinMaxBy:
5502
+ Description: 'Identifies places where `max_by`/`min_by` can be replaced by `max`/`min`.'
5503
+ Enabled: pending
5504
+ VersionAdded: '1.85'
5505
+
5185
5506
  Style/RedundantParentheses:
5186
5507
  Description: "Checks for parentheses that seem not to serve any purpose."
5187
5508
  Enabled: true
@@ -5259,6 +5580,13 @@ Style/RedundantStringEscape:
5259
5580
  Enabled: pending
5260
5581
  VersionAdded: '1.37'
5261
5582
 
5583
+ Style/RedundantStructKeywordInit:
5584
+ Description: 'Checks for redundant `keyword_init` option for `Struct.new`.'
5585
+ Enabled: false
5586
+ SafeAutoCorrect: false
5587
+ VersionAdded: '1.85'
5588
+ VersionChanged: '1.86'
5589
+
5262
5590
  Style/RegexpLiteral:
5263
5591
  Description: 'Use / or %r around regular expressions.'
5264
5592
  StyleGuide: '#percent-r'
@@ -5315,10 +5643,16 @@ Style/ReturnNilInPredicateMethodDefinition:
5315
5643
  StyleGuide: '#bool-methods-qmark'
5316
5644
  Enabled: pending
5317
5645
  SafeAutoCorrect: false
5318
- AllowedMethods: []
5319
- AllowedPatterns: []
5320
5646
  VersionAdded: '1.53'
5321
5647
  VersionChanged: '1.67'
5648
+ AllowedMethods: []
5649
+ AllowedPatterns: []
5650
+
5651
+ Style/ReverseFind:
5652
+ Description: 'Use `array.rfind` instead of `array.reverse.find`.'
5653
+ Enabled: pending
5654
+ Safe: false
5655
+ VersionAdded: '1.84'
5322
5656
 
5323
5657
  Style/SafeNavigation:
5324
5658
  Description: >-
@@ -5354,12 +5688,25 @@ Style/Sample:
5354
5688
  Description: >-
5355
5689
  Use `sample` instead of `shuffle.first`,
5356
5690
  `shuffle.last`, and `shuffle[Integer]`.
5357
- Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5691
+ References:
5692
+ - 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5358
5693
  Enabled: true
5359
5694
  VersionAdded: '0.30'
5360
5695
 
5696
+ Style/SelectByKind:
5697
+ Description: 'Prefer grep/grep_v to select/reject/find/detect with a kind check.'
5698
+ Enabled: pending
5699
+ SafeAutoCorrect: false
5700
+ VersionAdded: '1.85'
5701
+
5702
+ Style/SelectByRange:
5703
+ Description: 'Prefer grep/grep_v to select/reject/find/detect with a range check.'
5704
+ Enabled: pending
5705
+ SafeAutoCorrect: false
5706
+ VersionAdded: '1.85'
5707
+
5361
5708
  Style/SelectByRegexp:
5362
- Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
5709
+ Description: 'Prefer grep/grep_v to select/reject/find/detect with a regexp match.'
5363
5710
  Enabled: pending
5364
5711
  SafeAutoCorrect: false
5365
5712
  VersionAdded: '1.22'
@@ -5471,7 +5818,7 @@ Style/SpecialGlobalVars:
5471
5818
  - use_builtin_english_names
5472
5819
 
5473
5820
  Style/StabbyLambdaParentheses:
5474
- Description: 'Check for the usage of parentheses around stabby lambda arguments.'
5821
+ Description: 'Checks for the usage of parentheses around stabby lambda arguments.'
5475
5822
  StyleGuide: '#stabby-lambda-with-args'
5476
5823
  Enabled: true
5477
5824
  VersionAdded: '0.35'
@@ -5618,6 +5965,12 @@ Style/SymbolProc:
5618
5965
  AllowedPatterns: []
5619
5966
  AllowComments: false
5620
5967
 
5968
+ Style/TallyMethod:
5969
+ Description: 'Prefer `Enumerable#tally` over manual counting patterns.'
5970
+ Enabled: pending
5971
+ Safe: false
5972
+ VersionAdded: '1.85'
5973
+
5621
5974
  Style/TernaryParentheses:
5622
5975
  Description: 'Checks for use of parentheses around ternary conditions.'
5623
5976
  Enabled: true
@@ -5642,12 +5995,12 @@ Style/TrailingBodyOnClass:
5642
5995
  VersionAdded: '0.53'
5643
5996
 
5644
5997
  Style/TrailingBodyOnMethodDefinition:
5645
- Description: 'Method body goes below definition.'
5998
+ Description: 'Checks for trailing code after the method definition.'
5646
5999
  Enabled: true
5647
6000
  VersionAdded: '0.52'
5648
6001
 
5649
6002
  Style/TrailingBodyOnModule:
5650
- Description: 'Module body goes below module statement.'
6003
+ Description: 'Checks for trailing code after the module definition.'
5651
6004
  Enabled: true
5652
6005
  VersionAdded: '0.53'
5653
6006
 
@@ -5660,10 +6013,14 @@ Style/TrailingCommaInArguments:
5660
6013
  # parenthesized method calls where each argument is on its own line.
5661
6014
  # If `consistent_comma`, the cop requires a comma after the last argument,
5662
6015
  # for all parenthesized method calls with arguments.
6016
+ # If `diff_comma`, the cop requires a comma after the last argument, but only
6017
+ # when that argument is followed by an immediate newline, even if
6018
+ # there is an inline comment.
5663
6019
  EnforcedStyleForMultiline: no_comma
5664
6020
  SupportedStylesForMultiline:
5665
6021
  - comma
5666
6022
  - consistent_comma
6023
+ - diff_comma
5667
6024
  - no_comma
5668
6025
 
5669
6026
  Style/TrailingCommaInArrayLiteral:
@@ -5671,14 +6028,17 @@ Style/TrailingCommaInArrayLiteral:
5671
6028
  StyleGuide: '#no-trailing-array-commas'
5672
6029
  Enabled: true
5673
6030
  VersionAdded: '0.53'
5674
- # If `comma`, the cop requires a comma after the last item in an array,
5675
- # but only when each item is on its own line.
5676
- # If `consistent_comma`, the cop requires a comma after the last item of all
5677
- # non-empty, multiline array literals.
6031
+ # If `comma`, the cop requires a comma after the last item in an array, but only when each item is
6032
+ # on its own line.
6033
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
6034
+ # array literals.
6035
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
6036
+ # literals, but only when that last item immediately precedes a newline.
5678
6037
  EnforcedStyleForMultiline: no_comma
5679
6038
  SupportedStylesForMultiline:
5680
6039
  - comma
5681
6040
  - consistent_comma
6041
+ - diff_comma
5682
6042
  - no_comma
5683
6043
 
5684
6044
  Style/TrailingCommaInBlockArgs:
@@ -5690,14 +6050,17 @@ Style/TrailingCommaInBlockArgs:
5690
6050
  Style/TrailingCommaInHashLiteral:
5691
6051
  Description: 'Checks for trailing comma in hash literals.'
5692
6052
  Enabled: true
5693
- # If `comma`, the cop requires a comma after the last item in a hash,
5694
- # but only when each item is on its own line.
5695
- # If `consistent_comma`, the cop requires a comma after the last item of all
5696
- # non-empty, multiline hash literals.
6053
+ # If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
6054
+ # on its own line.
6055
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
6056
+ # hash literals.
6057
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
6058
+ # literals, but only when that last item immediately precedes a newline.
5697
6059
  EnforcedStyleForMultiline: no_comma
5698
6060
  SupportedStylesForMultiline:
5699
6061
  - comma
5700
6062
  - consistent_comma
6063
+ - diff_comma
5701
6064
  - no_comma
5702
6065
  VersionAdded: '0.53'
5703
6066
 
@@ -5710,10 +6073,10 @@ Style/TrailingUnderscoreVariable:
5710
6073
  Description: >-
5711
6074
  Checks for the usage of unneeded trailing underscores at the
5712
6075
  end of parallel variable assignment.
5713
- AllowNamedUnderscoreVariables: true
5714
6076
  Enabled: true
5715
6077
  VersionAdded: '0.31'
5716
6078
  VersionChanged: '0.35'
6079
+ AllowNamedUnderscoreVariables: true
5717
6080
 
5718
6081
  # `TrivialAccessors` requires exact name matches and doesn't allow
5719
6082
  # predicated methods by default.
@@ -5843,8 +6206,12 @@ Style/YAMLFileRead:
5843
6206
 
5844
6207
  Style/YodaCondition:
5845
6208
  Description: 'Forbid or enforce yoda conditions.'
5846
- Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
6209
+ References:
6210
+ - 'https://en.wikipedia.org/wiki/Yoda_conditions'
5847
6211
  Enabled: true
6212
+ Safe: false
6213
+ VersionAdded: '0.49'
6214
+ VersionChanged: '0.75'
5848
6215
  EnforcedStyle: forbid_for_all_comparison_operators
5849
6216
  SupportedStyles:
5850
6217
  # check all comparison operators
@@ -5855,9 +6222,6 @@ Style/YodaCondition:
5855
6222
  - require_for_all_comparison_operators
5856
6223
  # enforce yoda only for equality operators: `!=` and `==`
5857
6224
  - require_for_equality_operators_only
5858
- Safe: false
5859
- VersionAdded: '0.49'
5860
- VersionChanged: '0.75'
5861
6225
 
5862
6226
  Style/YodaExpression:
5863
6227
  Description: 'Forbid the use of yoda expressions.'