rubocop 1.53.0 → 1.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (797) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +93 -88
  4. data/assets/output.css.erb +159 -0
  5. data/assets/output.html.erb +1 -160
  6. data/config/default.yml +949 -185
  7. data/config/internal_affairs.yml +31 -0
  8. data/config/obsoletion.yml +43 -4
  9. data/exe/rubocop +2 -8
  10. data/lib/rubocop/cache_config.rb +29 -0
  11. data/lib/rubocop/cached_data.rb +28 -7
  12. data/lib/rubocop/cli/command/auto_generate_config.rb +63 -18
  13. data/lib/rubocop/cli/command/execute_runner.rb +35 -4
  14. data/lib/rubocop/cli/command/list_enabled_cops_for.rb +40 -0
  15. data/lib/rubocop/cli/command/lsp.rb +4 -4
  16. data/lib/rubocop/cli/command/mcp.rb +19 -0
  17. data/lib/rubocop/cli/command/show_cops.rb +26 -4
  18. data/lib/rubocop/cli/command/show_docs_url.rb +5 -9
  19. data/lib/rubocop/cli/command/suggest_extensions.rb +8 -2
  20. data/lib/rubocop/cli/command/version.rb +2 -2
  21. data/lib/rubocop/cli.rb +60 -16
  22. data/lib/rubocop/comment_config/directive_range.rb +32 -0
  23. data/lib/rubocop/comment_config/disable_next.rb +97 -0
  24. data/lib/rubocop/comment_config.rb +123 -49
  25. data/lib/rubocop/config.rb +180 -35
  26. data/lib/rubocop/config_finder.rb +15 -5
  27. data/lib/rubocop/config_loader.rb +83 -59
  28. data/lib/rubocop/config_loader_resolver.rb +65 -25
  29. data/lib/rubocop/config_obsoletion/extracted_cop.rb +6 -3
  30. data/lib/rubocop/config_obsoletion/parameter_rule.rb +9 -1
  31. data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
  32. data/lib/rubocop/config_obsoletion.rb +56 -9
  33. data/lib/rubocop/config_store.rb +7 -2
  34. data/lib/rubocop/config_validator.rb +76 -21
  35. data/lib/rubocop/cop/autocorrect_logic.rb +70 -25
  36. data/lib/rubocop/cop/badge.rb +8 -0
  37. data/lib/rubocop/cop/base.rb +151 -30
  38. data/lib/rubocop/cop/bundler/duplicated_gem.rb +3 -2
  39. data/lib/rubocop/cop/bundler/duplicated_group.rb +127 -0
  40. data/lib/rubocop/cop/bundler/gem_comment.rb +6 -4
  41. data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
  42. data/lib/rubocop/cop/bundler/gem_version.rb +32 -33
  43. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
  44. data/lib/rubocop/cop/bundler/ordered_gems.rb +11 -4
  45. data/lib/rubocop/cop/bundler.rb +19 -0
  46. data/lib/rubocop/cop/commissioner.rb +13 -11
  47. data/lib/rubocop/cop/cop.rb +30 -4
  48. data/lib/rubocop/cop/corrector.rb +4 -4
  49. data/lib/rubocop/cop/correctors/alignment_corrector.rb +80 -22
  50. data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -1
  51. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +5 -9
  52. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +13 -16
  53. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +14 -5
  54. data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -0
  55. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +1 -5
  56. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +8 -1
  57. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +37 -3
  58. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
  59. data/lib/rubocop/cop/correctors.rb +28 -0
  60. data/lib/rubocop/cop/documentation.rb +31 -5
  61. data/lib/rubocop/cop/exclude_limit.rb +32 -6
  62. data/lib/rubocop/cop/force.rb +12 -0
  63. data/lib/rubocop/cop/gemspec/add_runtime_dependency.rb +38 -0
  64. data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
  65. data/lib/rubocop/cop/gemspec/dependency_version.rb +3 -5
  66. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +3 -4
  67. data/lib/rubocop/cop/gemspec/development_dependencies.rb +1 -1
  68. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +51 -19
  69. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +11 -4
  70. data/lib/rubocop/cop/gemspec/require_mfa.rb +22 -5
  71. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -3
  72. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +15 -10
  73. data/lib/rubocop/cop/gemspec.rb +22 -0
  74. data/lib/rubocop/cop/generator/registration_injector.rb +188 -0
  75. data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
  76. data/lib/rubocop/cop/generator.rb +10 -0
  77. data/lib/rubocop/cop/internal_affairs/cop_description.rb +0 -4
  78. data/lib/rubocop/cop/internal_affairs/cop_enabled.rb +85 -0
  79. data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +2 -1
  80. data/lib/rubocop/cop/internal_affairs/example_description.rb +51 -25
  81. data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +8 -8
  82. data/lib/rubocop/cop/internal_affairs/itblock_handler.rb +69 -0
  83. data/lib/rubocop/cop/internal_affairs/location_exists.rb +142 -0
  84. data/lib/rubocop/cop/internal_affairs/location_expression.rb +2 -1
  85. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +7 -5
  86. data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +8 -6
  87. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
  88. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +54 -0
  89. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +132 -39
  90. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +63 -0
  91. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +130 -0
  92. data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +233 -0
  93. data/lib/rubocop/cop/internal_affairs/node_type_group.rb +92 -0
  94. data/lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb +126 -0
  95. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +4 -3
  96. data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +1 -1
  97. data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +90 -0
  98. data/lib/rubocop/cop/internal_affairs/operator_keyword.rb +48 -0
  99. data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
  100. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +6 -5
  101. data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
  102. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +5 -3
  103. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +6 -21
  104. data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +11 -2
  105. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +11 -2
  106. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +5 -4
  107. data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +0 -2
  108. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +23 -2
  109. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +6 -9
  110. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
  111. data/lib/rubocop/cop/internal_affairs.rb +10 -0
  112. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +6 -2
  113. data/lib/rubocop/cop/layout/argument_alignment.rb +4 -11
  114. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  115. data/lib/rubocop/cop/layout/assignment_indentation.rb +3 -2
  116. data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -2
  117. data/lib/rubocop/cop/layout/block_alignment.rb +89 -17
  118. data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
  119. data/lib/rubocop/cop/layout/case_indentation.rb +4 -2
  120. data/lib/rubocop/cop/layout/class_structure.rb +171 -43
  121. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +5 -5
  122. data/lib/rubocop/cop/layout/comment_indentation.rb +10 -3
  123. data/lib/rubocop/cop/layout/condition_position.rb +13 -7
  124. data/lib/rubocop/cop/layout/def_end_alignment.rb +2 -2
  125. data/lib/rubocop/cop/layout/dot_position.rb +3 -7
  126. data/lib/rubocop/cop/layout/else_alignment.rb +2 -15
  127. data/lib/rubocop/cop/layout/empty_comment.rb +11 -11
  128. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +66 -15
  129. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +75 -10
  130. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
  131. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +71 -20
  132. data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +101 -0
  133. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +37 -7
  134. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +8 -29
  135. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -0
  136. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +5 -6
  137. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +13 -2
  138. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +17 -3
  139. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +12 -8
  140. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +23 -1
  141. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +16 -2
  142. data/lib/rubocop/cop/layout/end_alignment.rb +24 -6
  143. data/lib/rubocop/cop/layout/extra_spacing.rb +110 -14
  144. data/lib/rubocop/cop/layout/first_argument_indentation.rb +59 -11
  145. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +20 -11
  146. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +26 -0
  147. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +22 -22
  148. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +26 -26
  149. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +8 -0
  150. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +3 -3
  151. data/lib/rubocop/cop/layout/hash_alignment.rb +11 -12
  152. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +6 -5
  153. data/lib/rubocop/cop/layout/heredoc_indentation.rb +38 -5
  154. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  155. data/lib/rubocop/cop/layout/indentation_width.rb +168 -22
  156. data/lib/rubocop/cop/layout/leading_comment_space.rb +111 -2
  157. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +28 -11
  158. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +9 -4
  159. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +4 -2
  160. data/lib/rubocop/cop/layout/line_length.rb +271 -37
  161. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +57 -57
  162. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +8 -2
  163. data/lib/rubocop/cop/layout/multiline_block_layout.rb +3 -0
  164. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +56 -56
  165. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
  166. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +25 -0
  167. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +3 -2
  168. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +252 -32
  169. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
  170. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +1 -0
  171. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +11 -8
  172. data/lib/rubocop/cop/layout/parameter_alignment.rb +3 -4
  173. data/lib/rubocop/cop/layout/redundant_line_break.rb +117 -42
  174. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +17 -9
  175. data/lib/rubocop/cop/layout/single_line_block_chain.rb +6 -1
  176. data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
  177. data/lib/rubocop/cop/layout/space_after_comma.rb +3 -3
  178. data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
  179. data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
  180. data/lib/rubocop/cop/layout/space_after_semicolon.rb +12 -2
  181. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
  182. data/lib/rubocop/cop/layout/space_around_keyword.rb +12 -4
  183. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +3 -3
  184. data/lib/rubocop/cop/layout/space_around_operators.rb +94 -38
  185. data/lib/rubocop/cop/layout/space_before_block_braces.rb +20 -10
  186. data/lib/rubocop/cop/layout/space_before_brackets.rb +8 -41
  187. data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
  188. data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
  189. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +9 -8
  190. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +48 -36
  191. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -0
  192. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +8 -1
  193. data/lib/rubocop/cop/layout/space_inside_parens.rb +1 -1
  194. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +3 -5
  195. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +5 -0
  196. data/lib/rubocop/cop/layout/trailing_whitespace.rb +6 -4
  197. data/lib/rubocop/cop/layout.rb +114 -0
  198. data/lib/rubocop/cop/lazy_loader.rb +41 -0
  199. data/lib/rubocop/cop/legacy/corrector.rb +12 -2
  200. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +9 -17
  201. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +73 -4
  202. data/lib/rubocop/cop/lint/ambiguous_operator.rb +0 -2
  203. data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +1 -10
  204. data/lib/rubocop/cop/lint/ambiguous_range.rb +8 -1
  205. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +0 -2
  206. data/lib/rubocop/cop/lint/argument_mismatch.rb +89 -0
  207. data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +118 -0
  208. data/lib/rubocop/cop/lint/assignment_in_condition.rb +20 -10
  209. data/lib/rubocop/cop/lint/big_decimal_new.rb +4 -7
  210. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +11 -13
  211. data/lib/rubocop/cop/lint/boolean_symbol.rb +2 -4
  212. data/lib/rubocop/cop/lint/circular_argument_reference.rb +49 -17
  213. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
  214. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +4 -3
  215. data/lib/rubocop/cop/lint/constant_reassignment.rb +227 -0
  216. data/lib/rubocop/cop/lint/constant_resolution.rb +31 -6
  217. data/lib/rubocop/cop/lint/cop_directive_syntax.rb +166 -0
  218. data/lib/rubocop/cop/lint/data_define_override.rb +63 -0
  219. data/lib/rubocop/cop/lint/debugger.rb +53 -9
  220. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +2 -2
  221. data/lib/rubocop/cop/lint/deprecated_constants.rb +2 -8
  222. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +7 -13
  223. data/lib/rubocop/cop/lint/deprecated_reference.rb +194 -0
  224. data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
  225. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -5
  226. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +0 -4
  227. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +5 -5
  228. data/lib/rubocop/cop/lint/duplicate_methods.rb +504 -49
  229. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +6 -43
  230. data/lib/rubocop/cop/lint/duplicate_set_element.rb +87 -0
  231. data/lib/rubocop/cop/lint/each_with_object_argument.rb +0 -4
  232. data/lib/rubocop/cop/lint/else_layout.rb +19 -2
  233. data/lib/rubocop/cop/lint/empty_block.rb +5 -5
  234. data/lib/rubocop/cop/lint/empty_conditional_body.rb +33 -57
  235. data/lib/rubocop/cop/lint/empty_ensure.rb +2 -12
  236. data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
  237. data/lib/rubocop/cop/lint/empty_file.rb +0 -2
  238. data/lib/rubocop/cop/lint/empty_in_pattern.rb +8 -1
  239. data/lib/rubocop/cop/lint/empty_interpolation.rb +14 -5
  240. data/lib/rubocop/cop/lint/empty_when.rb +9 -4
  241. data/lib/rubocop/cop/lint/ensure_return.rb +20 -10
  242. data/lib/rubocop/cop/lint/erb_new_arguments.rb +28 -25
  243. data/lib/rubocop/cop/lint/float_comparison.rb +59 -15
  244. data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -8
  245. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +2 -12
  246. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
  247. data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
  248. data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
  249. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +22 -12
  250. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -1
  251. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -9
  252. data/lib/rubocop/cop/lint/inherit_exception.rb +53 -7
  253. data/lib/rubocop/cop/lint/interpolation_check.rb +30 -6
  254. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +50 -0
  255. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
  256. data/lib/rubocop/cop/lint/literal_as_condition.rb +133 -12
  257. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +95 -0
  258. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +61 -30
  259. data/lib/rubocop/cop/lint/loop.rb +6 -12
  260. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +44 -22
  261. data/lib/rubocop/cop/lint/missing_super.rb +33 -3
  262. data/lib/rubocop/cop/lint/mixed_case_range.rb +16 -12
  263. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
  264. data/lib/rubocop/cop/lint/multiple_comparison.rb +2 -2
  265. data/lib/rubocop/cop/lint/name_typo.rb +270 -0
  266. data/lib/rubocop/cop/lint/nested_method_definition.rb +10 -12
  267. data/lib/rubocop/cop/lint/next_without_accumulator.rb +8 -25
  268. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +22 -7
  269. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +22 -10
  270. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +10 -10
  271. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +4 -4
  272. data/lib/rubocop/cop/lint/number_conversion.rb +28 -15
  273. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -3
  274. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +104 -0
  275. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -3
  276. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +7 -7
  277. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +18 -6
  278. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +9 -24
  279. data/lib/rubocop/cop/lint/percent_string_array.rb +0 -4
  280. data/lib/rubocop/cop/lint/percent_symbol_array.rb +0 -4
  281. data/lib/rubocop/cop/lint/raise_exception.rb +30 -11
  282. data/lib/rubocop/cop/lint/rand_one.rb +1 -5
  283. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +126 -30
  284. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +57 -21
  285. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +15 -4
  286. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +12 -2
  287. data/lib/rubocop/cop/lint/redundant_require_statement.rb +5 -21
  288. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +206 -15
  289. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +20 -10
  290. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -6
  291. data/lib/rubocop/cop/lint/redundant_type_conversion.rb +267 -0
  292. data/lib/rubocop/cop/lint/redundant_with_index.rb +9 -3
  293. data/lib/rubocop/cop/lint/redundant_with_object.rb +10 -2
  294. data/lib/rubocop/cop/lint/refinement_import_methods.rb +9 -2
  295. data/lib/rubocop/cop/lint/regexp_as_condition.rb +9 -2
  296. data/lib/rubocop/cop/lint/require_parentheses.rb +13 -8
  297. data/lib/rubocop/cop/lint/require_range_parentheses.rb +3 -2
  298. data/lib/rubocop/cop/lint/require_relative_self_path.rb +7 -5
  299. data/lib/rubocop/cop/lint/rescue_exception.rb +2 -9
  300. data/lib/rubocop/cop/lint/rescue_type.rb +6 -12
  301. data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -13
  302. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +55 -13
  303. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +113 -41
  304. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  305. data/lib/rubocop/cop/lint/script_permission.rb +7 -3
  306. data/lib/rubocop/cop/lint/self_assignment.rb +103 -10
  307. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -1
  308. data/lib/rubocop/cop/lint/shadowed_argument.rb +8 -7
  309. data/lib/rubocop/cop/lint/shadowed_exception.rb +2 -2
  310. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +40 -12
  311. data/lib/rubocop/cop/lint/shared_mutable_default.rb +78 -0
  312. data/lib/rubocop/cop/lint/struct_new_override.rb +29 -13
  313. data/lib/rubocop/cop/lint/super_argument_mismatch.rb +179 -0
  314. data/lib/rubocop/cop/lint/suppressed_exception.rb +2 -2
  315. data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +122 -0
  316. data/lib/rubocop/cop/lint/symbol_conversion.rb +26 -4
  317. data/lib/rubocop/cop/lint/syntax.rb +35 -5
  318. data/lib/rubocop/cop/lint/to_enum_arguments.rb +77 -9
  319. data/lib/rubocop/cop/lint/to_json.rb +20 -17
  320. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
  321. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +5 -1
  322. data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +114 -0
  323. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +3 -1
  324. data/lib/rubocop/cop/lint/unified_integer.rb +0 -4
  325. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +5 -3
  326. data/lib/rubocop/cop/lint/unreachable_code.rb +68 -15
  327. data/lib/rubocop/cop/lint/unreachable_loop.rb +14 -8
  328. data/lib/rubocop/cop/lint/unreachable_pattern_branch.rb +113 -0
  329. data/lib/rubocop/cop/lint/unused_method_argument.rb +28 -2
  330. data/lib/rubocop/cop/lint/unused_private_method.rb +234 -0
  331. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +2 -0
  332. data/lib/rubocop/cop/lint/uri_regexp.rb +25 -7
  333. data/lib/rubocop/cop/lint/useless_access_modifier.rb +37 -12
  334. data/lib/rubocop/cop/lint/useless_assignment.rb +92 -34
  335. data/lib/rubocop/cop/lint/useless_constant_scoping.rb +107 -0
  336. data/lib/rubocop/cop/lint/useless_default_value_argument.rb +92 -0
  337. data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
  338. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -4
  339. data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
  340. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +79 -0
  341. data/lib/rubocop/cop/lint/useless_or.rb +111 -0
  342. data/lib/rubocop/cop/lint/useless_rescue.rb +3 -4
  343. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +14 -8
  344. data/lib/rubocop/cop/lint/useless_setter_call.rb +17 -29
  345. data/lib/rubocop/cop/lint/useless_times.rb +24 -3
  346. data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +201 -0
  347. data/lib/rubocop/cop/lint/void.rb +127 -29
  348. data/lib/rubocop/cop/lint.rb +178 -0
  349. data/lib/rubocop/cop/message_annotator.rb +7 -3
  350. data/lib/rubocop/cop/metrics/abc_size.rb +4 -4
  351. data/lib/rubocop/cop/metrics/block_length.rb +9 -7
  352. data/lib/rubocop/cop/metrics/block_nesting.rb +43 -8
  353. data/lib/rubocop/cop/metrics/class_length.rb +23 -17
  354. data/lib/rubocop/cop/metrics/collection_literal_length.rb +8 -1
  355. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +5 -2
  356. data/lib/rubocop/cop/metrics/method_length.rb +17 -8
  357. data/lib/rubocop/cop/metrics/module_length.rb +7 -6
  358. data/lib/rubocop/cop/metrics/perceived_complexity.rb +38 -8
  359. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +5 -4
  360. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +39 -12
  361. data/lib/rubocop/cop/metrics/utils/iterating_block.rb +1 -1
  362. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
  363. data/lib/rubocop/cop/metrics.rb +31 -0
  364. data/lib/rubocop/cop/migration/department_name.rb +11 -5
  365. data/lib/rubocop/cop/migration.rb +13 -0
  366. data/lib/rubocop/cop/mixin/alignment.rb +8 -4
  367. data/lib/rubocop/cop/mixin/allowed_methods.rb +12 -6
  368. data/lib/rubocop/cop/mixin/allowed_pattern.rb +20 -4
  369. data/lib/rubocop/cop/mixin/annotation_comment.rb +0 -2
  370. data/lib/rubocop/cop/mixin/check_assignment.rb +4 -12
  371. data/lib/rubocop/cop/mixin/check_line_breakable.rb +46 -18
  372. data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +47 -0
  373. data/lib/rubocop/cop/mixin/code_length.rb +12 -1
  374. data/lib/rubocop/cop/mixin/comments_help.rb +22 -14
  375. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +1 -2
  376. data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
  377. data/lib/rubocop/cop/mixin/configurable_max.rb +11 -6
  378. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  379. data/lib/rubocop/cop/mixin/dig_help.rb +27 -0
  380. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
  381. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -7
  382. data/lib/rubocop/cop/mixin/endless_method_rewriter.rb +32 -0
  383. data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
  384. data/lib/rubocop/cop/mixin/forbidden_pattern.rb +20 -0
  385. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +23 -12
  386. data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
  387. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +33 -15
  388. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +49 -40
  389. data/lib/rubocop/cop/mixin/hash_subset.rb +210 -0
  390. data/lib/rubocop/cop/mixin/hash_transform_method/autocorrection.rb +63 -0
  391. data/lib/rubocop/cop/mixin/hash_transform_method.rb +32 -78
  392. data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
  393. data/lib/rubocop/cop/mixin/indexed_method_arity.rb +94 -0
  394. data/lib/rubocop/cop/mixin/line_length_help.rb +61 -14
  395. data/lib/rubocop/cop/mixin/method_complexity.rb +17 -7
  396. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +11 -12
  397. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -1
  398. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  399. data/lib/rubocop/cop/mixin/percent_array.rb +1 -1
  400. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  401. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +120 -39
  402. data/lib/rubocop/cop/mixin/project_index_help.rb +188 -0
  403. data/lib/rubocop/cop/mixin/range_help.rb +16 -6
  404. data/lib/rubocop/cop/mixin/reparsed_equivalence.rb +171 -0
  405. data/lib/rubocop/cop/mixin/rescue_node.rb +4 -0
  406. data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
  407. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +5 -4
  408. data/lib/rubocop/cop/mixin/statement_modifier.rb +57 -15
  409. data/lib/rubocop/cop/mixin/string_help.rb +5 -3
  410. data/lib/rubocop/cop/mixin/string_literals_help.rb +12 -0
  411. data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
  412. data/lib/rubocop/cop/mixin/trailing_comma.rb +27 -10
  413. data/lib/rubocop/cop/mixin.rb +91 -0
  414. data/lib/rubocop/cop/naming/accessor_method_name.rb +35 -6
  415. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +17 -1
  416. data/lib/rubocop/cop/naming/block_forwarding.rb +39 -8
  417. data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
  418. data/lib/rubocop/cop/naming/constant_name.rb +7 -9
  419. data/lib/rubocop/cop/naming/file_name.rb +9 -10
  420. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -1
  421. data/lib/rubocop/cop/naming/inclusive_language.rb +21 -7
  422. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +25 -19
  423. data/lib/rubocop/cop/naming/method_name.rb +190 -15
  424. data/lib/rubocop/cop/naming/predicate_method.rb +330 -0
  425. data/lib/rubocop/cop/naming/predicate_prefix.rb +232 -0
  426. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +23 -17
  427. data/lib/rubocop/cop/naming/variable_name.rb +50 -6
  428. data/lib/rubocop/cop/naming/variable_number.rb +5 -4
  429. data/lib/rubocop/cop/naming.rb +31 -0
  430. data/lib/rubocop/cop/offense.rb +56 -14
  431. data/lib/rubocop/cop/registry.rb +225 -64
  432. data/lib/rubocop/cop/security/compound_hash.rb +4 -2
  433. data/lib/rubocop/cop/security/eval.rb +17 -3
  434. data/lib/rubocop/cop/security/io_methods.rb +2 -2
  435. data/lib/rubocop/cop/security/json_load.rb +33 -11
  436. data/lib/rubocop/cop/security/marshal_load.rb +1 -1
  437. data/lib/rubocop/cop/security/open.rb +3 -2
  438. data/lib/rubocop/cop/security/yaml_load.rb +3 -2
  439. data/lib/rubocop/cop/security.rb +19 -0
  440. data/lib/rubocop/cop/style/access_modifier_declarations.rb +184 -33
  441. data/lib/rubocop/cop/style/accessor_grouping.rb +56 -11
  442. data/lib/rubocop/cop/style/alias.rb +26 -12
  443. data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +79 -0
  444. data/lib/rubocop/cop/style/and_or.rb +3 -2
  445. data/lib/rubocop/cop/style/arguments_forwarding.rb +487 -63
  446. data/lib/rubocop/cop/style/array_first_last.rb +90 -0
  447. data/lib/rubocop/cop/style/array_intersect.rb +148 -41
  448. data/lib/rubocop/cop/style/array_intersect_with_single_element.rb +50 -0
  449. data/lib/rubocop/cop/style/array_join.rb +4 -2
  450. data/lib/rubocop/cop/style/ascii_comments.rb +6 -3
  451. data/lib/rubocop/cop/style/attr.rb +5 -2
  452. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
  453. data/lib/rubocop/cop/style/bare_percent_literals.rb +4 -3
  454. data/lib/rubocop/cop/style/begin_block.rb +3 -1
  455. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +2 -2
  456. data/lib/rubocop/cop/style/bitwise_predicate.rb +106 -0
  457. data/lib/rubocop/cop/style/block_delimiters.rb +89 -53
  458. data/lib/rubocop/cop/style/case_equality.rb +29 -15
  459. data/lib/rubocop/cop/style/case_like_if.rb +16 -21
  460. data/lib/rubocop/cop/style/character_literal.rb +2 -2
  461. data/lib/rubocop/cop/style/class_and_module_children.rb +139 -22
  462. data/lib/rubocop/cop/style/class_check.rb +1 -0
  463. data/lib/rubocop/cop/style/class_equality_comparison.rb +29 -14
  464. data/lib/rubocop/cop/style/class_methods_definitions.rb +11 -5
  465. data/lib/rubocop/cop/style/class_vars.rb +3 -3
  466. data/lib/rubocop/cop/style/collection_compact.rb +53 -23
  467. data/lib/rubocop/cop/style/collection_methods.rb +4 -1
  468. data/lib/rubocop/cop/style/collection_querying.rb +167 -0
  469. data/lib/rubocop/cop/style/colon_method_call.rb +16 -7
  470. data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
  471. data/lib/rubocop/cop/style/combinable_loops.rb +29 -9
  472. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  473. data/lib/rubocop/cop/style/commented_keyword.rb +30 -4
  474. data/lib/rubocop/cop/style/comparable_between.rb +78 -0
  475. data/lib/rubocop/cop/style/comparable_clamp.rb +12 -1
  476. data/lib/rubocop/cop/style/concat_array_literals.rb +11 -5
  477. data/lib/rubocop/cop/style/conditional_assignment.rb +85 -56
  478. data/lib/rubocop/cop/style/constant_visibility.rb +21 -23
  479. data/lib/rubocop/cop/style/copyright.rb +49 -24
  480. data/lib/rubocop/cop/style/data_inheritance.rb +12 -1
  481. data/lib/rubocop/cop/style/date_time.rb +8 -7
  482. data/lib/rubocop/cop/style/def_with_parentheses.rb +22 -7
  483. data/lib/rubocop/cop/style/dig_chain.rb +94 -0
  484. data/lib/rubocop/cop/style/dir_empty.rb +4 -0
  485. data/lib/rubocop/cop/style/directive_scope.rb +171 -0
  486. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +77 -13
  487. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +6 -1
  488. data/lib/rubocop/cop/style/documentation.rb +76 -29
  489. data/lib/rubocop/cop/style/documentation_method.rb +24 -0
  490. data/lib/rubocop/cop/style/double_negation.rb +5 -5
  491. data/lib/rubocop/cop/style/each_for_simple_loop.rb +12 -16
  492. data/lib/rubocop/cop/style/each_with_object.rb +5 -4
  493. data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
  494. data/lib/rubocop/cop/style/empty_case_condition.rb +16 -2
  495. data/lib/rubocop/cop/style/empty_class_definition.rb +126 -0
  496. data/lib/rubocop/cop/style/empty_else.rb +10 -7
  497. data/lib/rubocop/cop/style/empty_heredoc.rb +5 -14
  498. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
  499. data/lib/rubocop/cop/style/empty_literal.rb +43 -25
  500. data/lib/rubocop/cop/style/empty_method.rb +0 -6
  501. data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +110 -0
  502. data/lib/rubocop/cop/style/encoding.rb +7 -1
  503. data/lib/rubocop/cop/style/end_block.rb +3 -1
  504. data/lib/rubocop/cop/style/endless_method.rb +164 -24
  505. data/lib/rubocop/cop/style/env_home.rb +4 -0
  506. data/lib/rubocop/cop/style/eval_with_location.rb +23 -31
  507. data/lib/rubocop/cop/style/even_odd.rb +11 -1
  508. data/lib/rubocop/cop/style/exact_regexp_match.rb +13 -5
  509. data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
  510. data/lib/rubocop/cop/style/explicit_block_argument.rb +19 -6
  511. data/lib/rubocop/cop/style/exponential_notation.rb +6 -5
  512. data/lib/rubocop/cop/style/fetch_env_var.rb +35 -8
  513. data/lib/rubocop/cop/style/file_null.rb +91 -0
  514. data/lib/rubocop/cop/style/file_open.rb +84 -0
  515. data/lib/rubocop/cop/style/file_read.rb +2 -5
  516. data/lib/rubocop/cop/style/file_touch.rb +75 -0
  517. data/lib/rubocop/cop/style/file_write.rb +23 -21
  518. data/lib/rubocop/cop/style/float_division.rb +23 -5
  519. data/lib/rubocop/cop/style/for.rb +7 -2
  520. data/lib/rubocop/cop/style/format_string.rb +47 -13
  521. data/lib/rubocop/cop/style/format_string_token.rb +86 -16
  522. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +6 -3
  523. data/lib/rubocop/cop/style/global_std_stream.rb +10 -1
  524. data/lib/rubocop/cop/style/global_vars.rb +6 -5
  525. data/lib/rubocop/cop/style/guard_clause.rb +67 -21
  526. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +27 -9
  527. data/lib/rubocop/cop/style/hash_conversion.rb +38 -13
  528. data/lib/rubocop/cop/style/hash_each_methods.rb +109 -12
  529. data/lib/rubocop/cop/style/hash_except.rb +38 -146
  530. data/lib/rubocop/cop/style/hash_fetch_chain.rb +104 -0
  531. data/lib/rubocop/cop/style/hash_lookup_method.rb +102 -0
  532. data/lib/rubocop/cop/style/hash_slice.rb +96 -0
  533. data/lib/rubocop/cop/style/hash_syntax.rb +36 -7
  534. data/lib/rubocop/cop/style/hash_transform_keys.rb +19 -9
  535. data/lib/rubocop/cop/style/hash_transform_values.rb +19 -9
  536. data/lib/rubocop/cop/style/identical_conditional_branches.rb +62 -9
  537. data/lib/rubocop/cop/style/if_inside_else.rb +26 -22
  538. data/lib/rubocop/cop/style/if_unless_modifier.rb +72 -47
  539. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +15 -19
  540. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +12 -9
  541. data/lib/rubocop/cop/style/if_with_semicolon.rb +75 -11
  542. data/lib/rubocop/cop/style/in_pattern_then.rb +6 -2
  543. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  544. data/lib/rubocop/cop/style/inline_comment.rb +5 -2
  545. data/lib/rubocop/cop/style/inverse_methods.rb +22 -18
  546. data/lib/rubocop/cop/style/invertible_unless_condition.rb +71 -9
  547. data/lib/rubocop/cop/style/ip_addresses.rb +3 -4
  548. data/lib/rubocop/cop/style/it_assignment.rb +93 -0
  549. data/lib/rubocop/cop/style/it_block_parameter.rb +121 -0
  550. data/lib/rubocop/cop/style/keyword_arguments_merging.rb +71 -0
  551. data/lib/rubocop/cop/style/keyword_parameters_order.rb +20 -10
  552. data/lib/rubocop/cop/style/lambda.rb +16 -5
  553. data/lib/rubocop/cop/style/lambda_call.rb +33 -11
  554. data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
  555. data/lib/rubocop/cop/style/magic_comment_format.rb +4 -4
  556. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +93 -50
  557. data/lib/rubocop/cop/style/map_into_array.rb +236 -0
  558. data/lib/rubocop/cop/style/map_join.rb +123 -0
  559. data/lib/rubocop/cop/style/map_to_hash.rb +28 -10
  560. data/lib/rubocop/cop/style/map_to_set.rb +4 -5
  561. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +77 -28
  562. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +15 -2
  563. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +38 -9
  564. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +37 -15
  565. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -4
  566. data/lib/rubocop/cop/style/method_def_parentheses.rb +8 -6
  567. data/lib/rubocop/cop/style/min_max_comparison.rb +17 -6
  568. data/lib/rubocop/cop/style/missing_else.rb +2 -4
  569. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +75 -12
  570. data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
  571. data/lib/rubocop/cop/style/mixin_usage.rb +1 -1
  572. data/lib/rubocop/cop/style/module_function.rb +4 -2
  573. data/lib/rubocop/cop/style/module_member_existence_check.rb +110 -0
  574. data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -2
  575. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -0
  576. data/lib/rubocop/cop/style/multiline_if_then.rb +10 -4
  577. data/lib/rubocop/cop/style/multiline_memoization.rb +9 -3
  578. data/lib/rubocop/cop/style/multiline_method_signature.rb +18 -13
  579. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +6 -4
  580. data/lib/rubocop/cop/style/multiline_when_then.rb +0 -4
  581. data/lib/rubocop/cop/style/multiple_comparison.rb +63 -59
  582. data/lib/rubocop/cop/style/mutable_constant.rb +117 -19
  583. data/lib/rubocop/cop/style/negated_if_else_condition.rb +6 -5
  584. data/lib/rubocop/cop/style/negative_array_index.rb +220 -0
  585. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  586. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +2 -2
  587. data/lib/rubocop/cop/style/nested_ternary_operator.rb +8 -15
  588. data/lib/rubocop/cop/style/next.rb +45 -1
  589. data/lib/rubocop/cop/style/nil_comparison.rb +12 -10
  590. data/lib/rubocop/cop/style/nil_lambda.rb +9 -1
  591. data/lib/rubocop/cop/style/non_nil_check.rb +5 -11
  592. data/lib/rubocop/cop/style/not.rb +3 -1
  593. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
  594. data/lib/rubocop/cop/style/numeric_literals.rb +3 -2
  595. data/lib/rubocop/cop/style/numeric_predicate.rb +13 -5
  596. data/lib/rubocop/cop/style/object_then.rb +16 -14
  597. data/lib/rubocop/cop/style/one_class_per_file.rb +115 -0
  598. data/lib/rubocop/cop/style/one_line_conditional.rb +50 -16
  599. data/lib/rubocop/cop/style/open_struct_use.rb +6 -6
  600. data/lib/rubocop/cop/style/operator_method_call.rb +40 -8
  601. data/lib/rubocop/cop/style/option_hash.rb +1 -1
  602. data/lib/rubocop/cop/style/optional_arguments.rb +1 -0
  603. data/lib/rubocop/cop/style/or_assignment.rb +3 -6
  604. data/lib/rubocop/cop/style/parallel_assignment.rb +69 -48
  605. data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -0
  606. data/lib/rubocop/cop/style/partition_instead_of_double_select.rb +270 -0
  607. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +5 -1
  608. data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
  609. data/lib/rubocop/cop/style/perl_backrefs.rb +5 -3
  610. data/lib/rubocop/cop/style/predicate_with_kind.rb +84 -0
  611. data/lib/rubocop/cop/style/preferred_hash_methods.rb +12 -12
  612. data/lib/rubocop/cop/style/proc.rb +5 -4
  613. data/lib/rubocop/cop/style/quoted_symbols.rb +2 -4
  614. data/lib/rubocop/cop/style/raise_args.rb +19 -14
  615. data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
  616. data/lib/rubocop/cop/style/reduce_to_hash.rb +200 -0
  617. data/lib/rubocop/cop/style/redundant_argument.rb +37 -4
  618. data/lib/rubocop/cop/style/redundant_array_constructor.rb +2 -2
  619. data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
  620. data/lib/rubocop/cop/style/redundant_assignment.rb +21 -3
  621. data/lib/rubocop/cop/style/redundant_begin.rb +53 -6
  622. data/lib/rubocop/cop/style/redundant_condition.rb +98 -25
  623. data/lib/rubocop/cop/style/redundant_conditional.rb +1 -9
  624. data/lib/rubocop/cop/style/redundant_constant_base.rb +42 -6
  625. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +31 -7
  626. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +88 -5
  627. data/lib/rubocop/cop/style/redundant_each.rb +11 -9
  628. data/lib/rubocop/cop/style/redundant_exception.rb +39 -13
  629. data/lib/rubocop/cop/style/redundant_fetch_block.rb +5 -13
  630. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +10 -1
  631. data/lib/rubocop/cop/style/redundant_filter_chain.rb +23 -6
  632. data/lib/rubocop/cop/style/redundant_format.rb +319 -0
  633. data/lib/rubocop/cop/style/redundant_freeze.rb +4 -4
  634. data/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb +6 -1
  635. data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
  636. data/lib/rubocop/cop/style/redundant_interpolation.rb +12 -3
  637. data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +62 -0
  638. data/lib/rubocop/cop/style/redundant_line_continuation.rb +92 -72
  639. data/lib/rubocop/cop/style/redundant_min_max_by.rb +93 -0
  640. data/lib/rubocop/cop/style/redundant_parentheses.rb +203 -84
  641. data/lib/rubocop/cop/style/redundant_percent_q.rb +6 -4
  642. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +33 -4
  643. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
  644. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +2 -2
  645. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +20 -24
  646. data/lib/rubocop/cop/style/redundant_return.rb +20 -8
  647. data/lib/rubocop/cop/style/redundant_self.rb +43 -22
  648. data/lib/rubocop/cop/style/redundant_self_assignment.rb +19 -32
  649. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +9 -9
  650. data/lib/rubocop/cop/style/redundant_sort.rb +17 -16
  651. data/lib/rubocop/cop/style/redundant_sort_by.rb +19 -3
  652. data/lib/rubocop/cop/style/redundant_string_escape.rb +4 -5
  653. data/lib/rubocop/cop/style/redundant_struct_keyword_init.rb +133 -0
  654. data/lib/rubocop/cop/style/regexp_literal.rb +32 -3
  655. data/lib/rubocop/cop/style/require_order.rb +2 -2
  656. data/lib/rubocop/cop/style/rescue_modifier.rb +20 -7
  657. data/lib/rubocop/cop/style/return_nil.rb +8 -4
  658. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +67 -11
  659. data/lib/rubocop/cop/style/reverse_find.rb +51 -0
  660. data/lib/rubocop/cop/style/safe_navigation.rb +176 -66
  661. data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
  662. data/lib/rubocop/cop/style/sample.rb +14 -10
  663. data/lib/rubocop/cop/style/select_by_kind.rb +158 -0
  664. data/lib/rubocop/cop/style/select_by_range.rb +197 -0
  665. data/lib/rubocop/cop/style/select_by_regexp.rb +62 -26
  666. data/lib/rubocop/cop/style/self_assignment.rb +13 -19
  667. data/lib/rubocop/cop/style/semicolon.rb +53 -17
  668. data/lib/rubocop/cop/style/send.rb +4 -4
  669. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +105 -0
  670. data/lib/rubocop/cop/style/signal_exception.rb +2 -3
  671. data/lib/rubocop/cop/style/single_argument_dig.rb +16 -8
  672. data/lib/rubocop/cop/style/single_line_block_params.rb +3 -3
  673. data/lib/rubocop/cop/style/single_line_do_end_block.rb +90 -0
  674. data/lib/rubocop/cop/style/single_line_methods.rb +16 -12
  675. data/lib/rubocop/cop/style/slicing_with_range.rb +105 -10
  676. data/lib/rubocop/cop/style/sole_nested_conditional.rb +103 -91
  677. data/lib/rubocop/cop/style/special_global_vars.rb +8 -4
  678. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +3 -1
  679. data/lib/rubocop/cop/style/static_class.rb +21 -0
  680. data/lib/rubocop/cop/style/string_chars.rb +1 -0
  681. data/lib/rubocop/cop/style/string_concatenation.rb +34 -17
  682. data/lib/rubocop/cop/style/string_hash_keys.rb +1 -0
  683. data/lib/rubocop/cop/style/string_literals.rb +1 -1
  684. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
  685. data/lib/rubocop/cop/style/string_methods.rb +1 -1
  686. data/lib/rubocop/cop/style/strip.rb +7 -4
  687. data/lib/rubocop/cop/style/struct_inheritance.rb +25 -3
  688. data/lib/rubocop/cop/style/super_arguments.rb +220 -0
  689. data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
  690. data/lib/rubocop/cop/style/swap_values.rb +4 -15
  691. data/lib/rubocop/cop/style/symbol_array.rb +35 -15
  692. data/lib/rubocop/cop/style/symbol_proc.rb +86 -14
  693. data/lib/rubocop/cop/style/tally_method.rb +181 -0
  694. data/lib/rubocop/cop/style/ternary_parentheses.rb +37 -5
  695. data/lib/rubocop/cop/style/time_now.rb +41 -0
  696. data/lib/rubocop/cop/style/top_level_method_definition.rb +4 -3
  697. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +56 -2
  698. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
  699. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +2 -2
  700. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
  701. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +1 -0
  702. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +21 -22
  703. data/lib/rubocop/cop/style/trivial_accessors.rb +3 -3
  704. data/lib/rubocop/cop/style/unless_else.rb +10 -9
  705. data/lib/rubocop/cop/style/unless_logical_operators.rb +3 -3
  706. data/lib/rubocop/cop/style/unpack_first.rb +11 -14
  707. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
  708. data/lib/rubocop/cop/style/while_until_do.rb +7 -2
  709. data/lib/rubocop/cop/style/while_until_modifier.rb +16 -2
  710. data/lib/rubocop/cop/style/word_array.rb +1 -0
  711. data/lib/rubocop/cop/style/yoda_condition.rb +12 -7
  712. data/lib/rubocop/cop/style/yoda_expression.rb +11 -9
  713. data/lib/rubocop/cop/style/zero_length_predicate.rb +38 -27
  714. data/lib/rubocop/cop/style.rb +312 -0
  715. data/lib/rubocop/cop/team.rb +188 -46
  716. data/lib/rubocop/cop/util.rb +23 -13
  717. data/lib/rubocop/cop/utils/format_string.rb +20 -5
  718. data/lib/rubocop/cop/variable_force/assignment.rb +35 -7
  719. data/lib/rubocop/cop/variable_force/branch.rb +31 -7
  720. data/lib/rubocop/cop/variable_force/scope.rb +1 -1
  721. data/lib/rubocop/cop/variable_force/variable.rb +32 -10
  722. data/lib/rubocop/cop/variable_force/variable_table.rb +5 -5
  723. data/lib/rubocop/cop/variable_force.rb +43 -20
  724. data/lib/rubocop/cops_documentation_generator.rb +137 -63
  725. data/lib/rubocop/core_ext/string.rb +2 -6
  726. data/lib/rubocop/directive_comment.rb +135 -19
  727. data/lib/rubocop/ext/regexp_node.rb +17 -35
  728. data/lib/rubocop/ext/regexp_parser.rb +4 -21
  729. data/lib/rubocop/feature_loader.rb +0 -6
  730. data/lib/rubocop/file_finder.rb +11 -9
  731. data/lib/rubocop/file_patterns.rb +9 -1
  732. data/lib/rubocop/formatter/clang_style_formatter.rb +8 -9
  733. data/lib/rubocop/formatter/disabled_config_formatter.rb +62 -22
  734. data/lib/rubocop/formatter/emacs_style_formatter.rb +3 -1
  735. data/lib/rubocop/formatter/formatter_set.rb +10 -4
  736. data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
  737. data/lib/rubocop/formatter/html_formatter.rb +38 -17
  738. data/lib/rubocop/formatter/json_formatter.rb +11 -7
  739. data/lib/rubocop/formatter/junit_formatter.rb +94 -30
  740. data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
  741. data/lib/rubocop/formatter/offense_count_formatter.rb +14 -5
  742. data/lib/rubocop/formatter/pacman_formatter.rb +2 -1
  743. data/lib/rubocop/formatter/simple_text_formatter.rb +4 -5
  744. data/lib/rubocop/formatter/tap_formatter.rb +11 -10
  745. data/lib/rubocop/formatter/worst_offenders_formatter.rb +2 -3
  746. data/lib/rubocop/formatter.rb +22 -21
  747. data/lib/rubocop/lockfile.rb +76 -7
  748. data/lib/rubocop/lsp/diagnostic.rb +170 -0
  749. data/lib/rubocop/lsp/disable_comment_edits.rb +135 -0
  750. data/lib/rubocop/lsp/logger.rb +3 -3
  751. data/lib/rubocop/lsp/routes.rb +163 -56
  752. data/lib/rubocop/lsp/runtime.rb +47 -44
  753. data/lib/rubocop/lsp/server.rb +18 -6
  754. data/lib/rubocop/lsp/severity.rb +1 -1
  755. data/lib/rubocop/lsp/stdin_runner.rb +96 -0
  756. data/lib/rubocop/lsp.rb +36 -0
  757. data/lib/rubocop/magic_comment.rb +44 -14
  758. data/lib/rubocop/mcp/server.rb +199 -0
  759. data/lib/rubocop/options.rb +88 -32
  760. data/lib/rubocop/path_util.rb +33 -11
  761. data/lib/rubocop/pending_cops_reporter.rb +51 -0
  762. data/lib/rubocop/plugin/configuration_integrator.rb +146 -0
  763. data/lib/rubocop/plugin/load_error.rb +26 -0
  764. data/lib/rubocop/plugin/loader.rb +100 -0
  765. data/lib/rubocop/plugin/not_supported_error.rb +29 -0
  766. data/lib/rubocop/plugin.rb +46 -0
  767. data/lib/rubocop/project_index_loader.rb +82 -0
  768. data/lib/rubocop/rake_task.rb +7 -5
  769. data/lib/rubocop/remote_config.rb +15 -9
  770. data/lib/rubocop/result_cache.rb +85 -61
  771. data/lib/rubocop/rspec/cop_helper.rb +28 -2
  772. data/lib/rubocop/rspec/expect_offense.rb +29 -12
  773. data/lib/rubocop/rspec/shared_contexts.rb +165 -24
  774. data/lib/rubocop/rspec/support.rb +8 -2
  775. data/lib/rubocop/runner.rb +273 -99
  776. data/lib/rubocop/server/cache.rb +76 -42
  777. data/lib/rubocop/server/cli.rb +2 -4
  778. data/lib/rubocop/server/client_command/base.rb +10 -0
  779. data/lib/rubocop/server/client_command/exec.rb +4 -4
  780. data/lib/rubocop/server/client_command/start.rb +11 -1
  781. data/lib/rubocop/server/core.rb +13 -0
  782. data/lib/rubocop/server/server_command/exec.rb +0 -1
  783. data/lib/rubocop/server.rb +14 -0
  784. data/lib/rubocop/string_interpreter.rb +3 -3
  785. data/lib/rubocop/target_finder.rb +111 -86
  786. data/lib/rubocop/target_ruby.rb +131 -89
  787. data/lib/rubocop/todo_audit.rb +111 -0
  788. data/lib/rubocop/version.rb +84 -10
  789. data/lib/rubocop/yaml_duplication_checker.rb +20 -26
  790. data/lib/rubocop.rb +33 -648
  791. data/lib/ruby_lsp/rubocop/addon.rb +89 -0
  792. data/lib/ruby_lsp/rubocop/runtime_adapter.rb +99 -0
  793. metadata +169 -50
  794. data/lib/rubocop/cop/naming/predicate_name.rb +0 -134
  795. data/lib/rubocop/cop/utils/regexp_ranges.rb +0 -100
  796. data/lib/rubocop/rspec/host_environment_simulation_helper.rb +0 -28
  797. /data/lib/rubocop/formatter/{git_hub_actions_formatter.rb → github_actions_formatter.rb} +0 -0
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,14 +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'
27
+ - '**/*.schema'
33
28
  - '**/*.spec'
34
29
  - '**/*.thor'
35
- - '**/*.watchr'
36
30
  - '**/.irbrc'
37
31
  - '**/.pryrc'
38
32
  - '**/.simplecov'
@@ -42,7 +36,6 @@ AllCops:
42
36
  - '**/Brewfile'
43
37
  - '**/Buildfile'
44
38
  - '**/Capfile'
45
- - '**/Cheffile'
46
39
  - '**/Dangerfile'
47
40
  - '**/Deliverfile'
48
41
  - '**/Fastfile'
@@ -55,10 +48,10 @@ AllCops:
55
48
  - '**/Puppetfile'
56
49
  - '**/Rakefile'
57
50
  - '**/rakefile'
51
+ - '**/Schemafile'
58
52
  - '**/Snapfile'
59
53
  - '**/Steepfile'
60
54
  - '**/Thorfile'
61
- - '**/Vagabondfile'
62
55
  - '**/Vagrantfile'
63
56
  Exclude:
64
57
  - 'node_modules/**/*'
@@ -80,6 +73,8 @@ AllCops:
80
73
  StyleGuideBaseURL: https://rubystyle.guide
81
74
  # Documentation URLs will be constructed using the base URL.
82
75
  DocumentationBaseURL: https://docs.rubocop.org/rubocop
76
+ # Documentation URLs will end with this extension.
77
+ DocumentationExtension: .html
83
78
  # Extra details are not displayed in offense messages by default. Change
84
79
  # behavior by overriding ExtraDetails, or by giving the
85
80
  # `-E/--extra-details` option.
@@ -109,11 +104,23 @@ AllCops:
109
104
  # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
110
105
  # the `--disable-pending-cops` command-line option.
111
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
113
+ # When the project index is enabled, also index the sources of the gems in
114
+ # the project's bundle. This lets index-aware cops resolve ancestry chains
115
+ # and members that live in gems (e.g. framework base classes), at the cost
116
+ # of extra memory proportional to the bundle's size. Has no effect when
117
+ # `UseProjectIndex` is `false` or when RuboCop does not run inside Bundler.
118
+ ProjectIndexIncludesGems: false
112
119
  # Enables the result cache if `true`. Can be overridden by the `--cache` command
113
120
  # line option.
114
121
  UseCache: true
115
122
  # Threshold for how many files can be stored in the result cache before some
116
- # of the files are automatically removed.
123
+ # of the files are automatically removed. Set to false to disable cache pruning.
117
124
  MaxFilesInCache: 20000
118
125
  # The cache will be stored in "rubocop_cache" under this directory. If
119
126
  # CacheRootDirectory is ~ (nil), which it is by default, the root will be
@@ -142,6 +149,14 @@ AllCops:
142
149
  # Ruby version is still unresolved, RuboCop will use the oldest officially
143
150
  # supported Ruby version (currently Ruby 2.7).
144
151
  TargetRubyVersion: ~
152
+ # RuboCop choses the parser engine automatically but you can also specify it yourself.
153
+ # These options are available:
154
+ # - `default`
155
+ # - `parser_whitequark` ... https://github.com/whitequark/parser
156
+ # - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
157
+ # Not every parser engine can handle every `TargetRubyVersion`. `parser_whitequark`
158
+ # only works with versions 3.4 and below, `parser_prism` with versions 3.3 and above.
159
+ ParserEngine: default
145
160
  # Determines if a notification for extension libraries should be shown when
146
161
  # rubocop is run. Keys are the name of the extension, and values are an array
147
162
  # of gems in the Gemfile that the extension is suggested for, if not already
@@ -155,8 +170,15 @@ AllCops:
155
170
  rubocop-graphql: [graphql]
156
171
  rubocop-capybara: [capybara]
157
172
  rubocop-factory_bot: [factory_bot, factory_bot_rails]
173
+ rubocop-rspec_rails: [rspec-rails]
174
+ rubocop-i18n: [i18n, gettext]
158
175
  # Enable/Disable checking the methods extended by Active Support.
159
176
  ActiveSupportExtensionsEnabled: false
177
+ # Future version of Ruby will freeze string literals by default.
178
+ # This allows to opt in early, for example when enabled through RUBYOPT.
179
+ # For now this will behave as if set to false but in future ruby versions
180
+ # (likely 4.0) it will be true by default.
181
+ StringLiteralsFrozenByDefault: ~
160
182
 
161
183
  #################### Bundler ###############################
162
184
 
@@ -171,16 +193,26 @@ Bundler/DuplicatedGem:
171
193
  - '**/Gemfile'
172
194
  - '**/gems.rb'
173
195
 
196
+ Bundler/DuplicatedGroup:
197
+ Description: 'Checks for duplicate group entries in Gemfile.'
198
+ Enabled: true
199
+ Severity: warning
200
+ VersionAdded: '1.56'
201
+ Include:
202
+ - '**/*.gemfile'
203
+ - '**/Gemfile'
204
+ - '**/gems.rb'
205
+
174
206
  Bundler/GemComment:
175
207
  Description: 'Add a comment describing each gem.'
176
208
  Enabled: false
177
209
  VersionAdded: '0.59'
178
- VersionChanged: '0.85'
210
+ VersionChanged: '1.88'
179
211
  Include:
180
212
  - '**/*.gemfile'
181
213
  - '**/Gemfile'
182
214
  - '**/gems.rb'
183
- IgnoredGems: []
215
+ AllowedGems: []
184
216
  OnlyFor: []
185
217
 
186
218
  Bundler/GemFilename:
@@ -243,6 +275,23 @@ Bundler/OrderedGems:
243
275
 
244
276
  #################### Gemspec ###############################
245
277
 
278
+ Gemspec/AddRuntimeDependency:
279
+ Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
280
+ StyleGuide: '#add_dependency_vs_add_runtime_dependency'
281
+ References:
282
+ - https://github.com/ruby/rubygems/issues/7799#issuecomment-2192720316
283
+ Enabled: pending
284
+ VersionAdded: '1.65'
285
+ Include:
286
+ - '**/*.gemspec'
287
+
288
+ Gemspec/AttributeAssignment:
289
+ Description: 'Use consistent style for Gemspec attributes assignment.'
290
+ Enabled: pending
291
+ VersionAdded: '1.77'
292
+ Include:
293
+ - '**/*.gemspec'
294
+
246
295
  Gemspec/DependencyVersion:
247
296
  Description: 'Requires or forbids specifying gem dependency versions.'
248
297
  Enabled: false
@@ -306,7 +355,7 @@ Gemspec/RequireMFA:
306
355
  Severity: warning
307
356
  VersionAdded: '1.23'
308
357
  VersionChanged: '1.40'
309
- Reference:
358
+ References:
310
359
  - https://guides.rubygems.org/mfa-requirement-opt-in/
311
360
  Include:
312
361
  - '**/*.gemspec'
@@ -330,10 +379,10 @@ Gemspec/RubyVersionGlobalsUsage:
330
379
  Include:
331
380
  - '**/*.gemspec'
332
381
 
333
- #################### Layout ###########################
382
+ #################### Layout ################################
334
383
 
335
384
  Layout/AccessModifierIndentation:
336
- Description: Check indentation of private/protected visibility modifiers.
385
+ Description: Checks indentation of private/protected visibility modifiers.
337
386
  StyleGuide: '#indent-public-private-protected'
338
387
  Enabled: true
339
388
  VersionAdded: '0.49'
@@ -378,7 +427,7 @@ Layout/ArrayAlignment:
378
427
  Description: >-
379
428
  Align the elements of an array literal if they span more than
380
429
  one line.
381
- StyleGuide: '#no-double-indent'
430
+ StyleGuide: '#align-multiline-arrays'
382
431
  Enabled: true
383
432
  VersionAdded: '0.49'
384
433
  VersionChanged: '0.77'
@@ -448,7 +497,7 @@ Layout/BlockEndNewline:
448
497
  VersionAdded: '0.49'
449
498
 
450
499
  Layout/CaseIndentation:
451
- Description: 'Indentation of when in a case/(when|in)/[else/]end.'
500
+ Description: 'Checks how the `when` and `in` clauses of a `case` expression are indented.'
452
501
  StyleGuide: '#indent-when-to-case'
453
502
  Enabled: true
454
503
  VersionAdded: '0.49'
@@ -469,7 +518,7 @@ Layout/ClassStructure:
469
518
  Enabled: false
470
519
  SafeAutoCorrect: false
471
520
  VersionAdded: '0.52'
472
- VersionChanged: '1.53'
521
+ VersionChanged: '1.89'
473
522
  Categories:
474
523
  module_inclusion:
475
524
  - include
@@ -482,6 +531,7 @@ Layout/ClassStructure:
482
531
  - initializer
483
532
  - public_methods
484
533
  - protected_methods
534
+ - private_class_methods
485
535
  - private_methods
486
536
 
487
537
  Layout/ClosingHeredocIndentation:
@@ -493,15 +543,22 @@ Layout/ClosingParenthesisIndentation:
493
543
  Description: 'Checks the indentation of hanging closing parentheses.'
494
544
  Enabled: true
495
545
  VersionAdded: '0.49'
546
+ VersionChanged: '1.86'
547
+ # By default the indentation width from `Layout/IndentationWidth` is used,
548
+ # but it can be overridden by setting this parameter.
549
+ IndentationWidth: ~
496
550
 
497
551
  Layout/CommentIndentation:
498
- Description: 'Indentation of comments.'
552
+ Description: 'Checks the indentation of comments.'
499
553
  Enabled: true
554
+ VersionAdded: '0.49'
555
+ VersionChanged: '1.86'
500
556
  # When true, allows comments to have extra indentation if that aligns them
501
557
  # with a comment on the preceding line.
502
558
  AllowForAlignment: false
503
- VersionAdded: '0.49'
504
- VersionChanged: '1.24'
559
+ # By default the indentation width from `Layout/IndentationWidth` is used,
560
+ # but it can be overridden by setting this parameter.
561
+ IndentationWidth: ~
505
562
 
506
563
  Layout/ConditionPosition:
507
564
  Description: >-
@@ -544,7 +601,9 @@ Layout/ElseAlignment:
544
601
  Layout/EmptyComment:
545
602
  Description: 'Checks empty comment.'
546
603
  Enabled: true
604
+ AutoCorrect: contextual
547
605
  VersionAdded: '0.53'
606
+ VersionChanged: '1.61'
548
607
  AllowBorderComment: true
549
608
  AllowMarginComment: true
550
609
 
@@ -559,13 +618,19 @@ Layout/EmptyLineAfterMagicComment:
559
618
  StyleGuide: '#separate-magic-comments-from-code'
560
619
  Enabled: true
561
620
  VersionAdded: '0.49'
621
+ VersionChanged: '1.90'
622
+ # The minimum number of empty lines required after the last magic comment. Set this
623
+ # to `2` when using YARD, which otherwise treats the magic comments as documentation
624
+ # for the first module or class in the file. `Layout/EmptyLines` has to be disabled
625
+ # for values greater than `1`.
626
+ NumberOfEmptyLines: 1
562
627
 
563
628
  Layout/EmptyLineAfterMultilineCondition:
564
629
  Description: 'Enforces empty line after multiline condition.'
565
630
  # This is disabled, because this style is not very common in practice.
566
631
  Enabled: false
567
632
  VersionAdded: '0.90'
568
- Reference:
633
+ References:
569
634
  - https://github.com/airbnb/ruby#multiline-if-newline
570
635
 
571
636
  Layout/EmptyLineBetweenDefs:
@@ -577,6 +642,8 @@ Layout/EmptyLineBetweenDefs:
577
642
  EmptyLineBetweenMethodDefs: true
578
643
  EmptyLineBetweenClassDefs: true
579
644
  EmptyLineBetweenModuleDefs: true
645
+ # `DefLikeMacros` takes the name of any macro that you want to treat like a def.
646
+ DefLikeMacros: []
580
647
  # `AllowAdjacentOneLineDefs` means that single line method definitions don't
581
648
  # need an empty line between them. `true` by default.
582
649
  AllowAdjacentOneLineDefs: true
@@ -589,6 +656,12 @@ Layout/EmptyLines:
589
656
  Enabled: true
590
657
  VersionAdded: '0.49'
591
658
 
659
+ Layout/EmptyLinesAfterModuleInclusion:
660
+ Description: 'Keeps track of empty lines after module inclusion methods.'
661
+ StyleGuide: '#empty-lines-after-module-inclusion'
662
+ Enabled: pending
663
+ VersionAdded: '1.79'
664
+
592
665
  Layout/EmptyLinesAroundAccessModifier:
593
666
  Description: "Keep blank lines around access modifiers."
594
667
  StyleGuide: '#empty-lines-around-access-modifier'
@@ -598,7 +671,7 @@ Layout/EmptyLinesAroundAccessModifier:
598
671
  SupportedStyles:
599
672
  - around
600
673
  - only_before
601
- Reference:
674
+ References:
602
675
  # A reference to `EnforcedStyle: only_before`.
603
676
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
604
677
 
@@ -780,6 +853,7 @@ Layout/FirstArrayElementLineBreak:
780
853
  multi-line array.
781
854
  Enabled: false
782
855
  VersionAdded: '0.49'
856
+ AllowImplicitArrayLiterals: false
783
857
  AllowMultilineFinalElement: false
784
858
 
785
859
  Layout/FirstHashElementIndentation:
@@ -822,6 +896,7 @@ Layout/FirstMethodArgumentLineBreak:
822
896
  Enabled: false
823
897
  VersionAdded: '0.49'
824
898
  AllowMultilineFinalElement: false
899
+ AllowedMethods: []
825
900
 
826
901
  Layout/FirstMethodParameterLineBreak:
827
902
  Description: >-
@@ -851,9 +926,9 @@ Layout/HashAlignment:
851
926
  Align the elements of a hash literal if they span more than
852
927
  one line.
853
928
  Enabled: true
854
- AllowMultipleStyles: true
855
929
  VersionAdded: '0.49'
856
930
  VersionChanged: '1.16'
931
+ AllowMultipleStyles: true
857
932
  # Alignment of entries using hash rocket as separator. Valid values are:
858
933
  #
859
934
  # key - left alignment of keys
@@ -928,8 +1003,8 @@ Layout/HeredocArgumentClosingParenthesis:
928
1003
  Description: >-
929
1004
  Checks for the placement of the closing parenthesis in a
930
1005
  method call that passes a HEREDOC string as an argument.
931
- Enabled: false
932
1006
  StyleGuide: '#heredoc-argument-closing-parentheses'
1007
+ Enabled: false
933
1008
  VersionAdded: '0.68'
934
1009
 
935
1010
  Layout/HeredocIndentation:
@@ -954,7 +1029,7 @@ Layout/IndentationConsistency:
954
1029
  SupportedStyles:
955
1030
  - normal
956
1031
  - indented_internal_methods
957
- Reference:
1032
+ References:
958
1033
  # A reference to `EnforcedStyle: indented_internal_methods`.
959
1034
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
960
1035
 
@@ -981,6 +1056,15 @@ Layout/IndentationWidth:
981
1056
  VersionAdded: '0.49'
982
1057
  # Number of spaces for each indentation level.
983
1058
  Width: 2
1059
+ # Block body indentation for method chain blocks.
1060
+ # The value `start_of_line` means that block bodies are indented
1061
+ # relative to the start of the line where the block starts.
1062
+ # The value `relative_to_receiver` means that block bodies are indented
1063
+ # relative to the method call position in the chain.
1064
+ EnforcedStyleAlignWith: start_of_line
1065
+ SupportedStylesAlignWith:
1066
+ - start_of_line
1067
+ - relative_to_receiver
984
1068
  AllowedPatterns: []
985
1069
 
986
1070
  Layout/InitialIndentation:
@@ -997,9 +1081,12 @@ Layout/LeadingCommentSpace:
997
1081
  VersionChanged: '0.73'
998
1082
  AllowDoxygenCommentStyle: false
999
1083
  AllowGemfileRubyComment: false
1084
+ AllowRBSInlineAnnotation: false
1085
+ AllowSteepAnnotation: false
1086
+ AllowYARDCommentBlockSeparator: false
1000
1087
 
1001
1088
  Layout/LeadingEmptyLines:
1002
- Description: Check for unnecessary blank lines at the beginning of a file.
1089
+ Description: Checks for unnecessary blank lines at the beginning of a file.
1003
1090
  Enabled: true
1004
1091
  VersionAdded: '0.57'
1005
1092
  VersionChanged: '0.77'
@@ -1044,22 +1131,28 @@ Layout/LineLength:
1044
1131
  StyleGuide: '#max-line-length'
1045
1132
  Enabled: true
1046
1133
  VersionAdded: '0.25'
1047
- VersionChanged: '1.4'
1134
+ VersionChanged: '1.82'
1048
1135
  Max: 120
1136
+ AllowHeredoc: true
1049
1137
  # To make it possible to copy or click on URIs in the code, we allow lines
1050
1138
  # containing a URI to be longer than Max.
1051
- AllowHeredoc: true
1052
1139
  AllowURI: true
1140
+ AllowQualifiedName: true
1053
1141
  URISchemes:
1054
1142
  - http
1055
1143
  - https
1056
- # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1144
+ # The AllowRBSInlineAnnotation option makes LineLength allow RBS::Inline annotations
1145
+ # such as `#: (?date: Date) -> Foo` when calculating line length.
1146
+ AllowRBSInlineAnnotation: false
1147
+ # The AllowCopDirectives option causes the LineLength rule to ignore cop
1057
1148
  # directives like '# rubocop: enable ...' when calculating a line's length.
1058
- IgnoreCopDirectives: true
1149
+ AllowCopDirectives: true
1059
1150
  # The AllowedPatterns option is a list of !ruby/regexp and/or string
1060
1151
  # elements. Strings will be converted to Regexp objects. A line that matches
1061
1152
  # any regular expression listed in this option will be ignored by LineLength.
1062
1153
  AllowedPatterns: []
1154
+ # If SplitStrings is true, long strings will be split using continuations
1155
+ SplitStrings: false
1063
1156
 
1064
1157
  Layout/MultilineArrayBraceLayout:
1065
1158
  Description: >-
@@ -1086,7 +1179,7 @@ Layout/MultilineArrayLineBreaks:
1086
1179
  AllowMultilineFinalElement: false
1087
1180
 
1088
1181
  Layout/MultilineAssignmentLayout:
1089
- Description: 'Check for a newline after the assignment operator in multi-line assignments.'
1182
+ Description: 'Checks for a newline after the assignment operator in multi-line assignments.'
1090
1183
  StyleGuide: '#indent-conditional-assignment'
1091
1184
  Enabled: false
1092
1185
  VersionAdded: '0.49'
@@ -1329,6 +1422,7 @@ Layout/SpaceAroundOperators:
1329
1422
  StyleGuide: '#spaces-operators'
1330
1423
  Enabled: true
1331
1424
  VersionAdded: '0.49'
1425
+ VersionChanged: '1.90'
1332
1426
  # When `true`, allows most uses of extra spacing if the intent is to align
1333
1427
  # with an operator on the previous or next line, not counting empty lines
1334
1428
  # or comment lines.
@@ -1337,6 +1431,10 @@ Layout/SpaceAroundOperators:
1337
1431
  SupportedStylesForExponentOperator:
1338
1432
  - space
1339
1433
  - no_space
1434
+ EnforcedStyleForRationalLiterals: no_space
1435
+ SupportedStylesForRationalLiterals:
1436
+ - space
1437
+ - no_space
1340
1438
 
1341
1439
  Layout/SpaceBeforeBlockBraces:
1342
1440
  Description: >-
@@ -1344,6 +1442,7 @@ Layout/SpaceBeforeBlockBraces:
1344
1442
  before it.
1345
1443
  Enabled: true
1346
1444
  VersionAdded: '0.49'
1445
+ VersionChanged: '0.52'
1347
1446
  EnforcedStyle: space
1348
1447
  SupportedStyles:
1349
1448
  - space
@@ -1352,7 +1451,6 @@ Layout/SpaceBeforeBlockBraces:
1352
1451
  SupportedStylesForEmptyBraces:
1353
1452
  - space
1354
1453
  - no_space
1355
- VersionChanged: '0.52'
1356
1454
 
1357
1455
  Layout/SpaceBeforeBrackets:
1358
1456
  Description: 'Checks for receiver with a space before the opening brackets.'
@@ -1453,7 +1551,6 @@ Layout/SpaceInsideHashLiteralBraces:
1453
1551
  - space
1454
1552
  - no_space
1455
1553
 
1456
-
1457
1554
  Layout/SpaceInsideParens:
1458
1555
  Description: 'No spaces after ( or before ).'
1459
1556
  StyleGuide: '#spaces-braces'
@@ -1534,7 +1631,7 @@ Lint/AmbiguousBlockAssociation:
1534
1631
  parentheses.
1535
1632
  Enabled: true
1536
1633
  VersionAdded: '0.48'
1537
- VersionChanged: '1.13'
1634
+ VersionChanged: '1.89'
1538
1635
  AllowedMethods: []
1539
1636
  AllowedPatterns: []
1540
1637
 
@@ -1569,6 +1666,19 @@ Lint/AmbiguousRegexpLiteral:
1569
1666
  VersionAdded: '0.17'
1570
1667
  VersionChanged: '0.83'
1571
1668
 
1669
+ Lint/ArgumentMismatch:
1670
+ Description: >-
1671
+ Checks for calls that pass the wrong number of positional arguments
1672
+ to a method, using the project index.
1673
+ Enabled: pending
1674
+ VersionAdded: '1.90'
1675
+
1676
+ Lint/ArrayLiteralInRegexp:
1677
+ Description: 'Checks for an array literal interpolated inside a regexp.'
1678
+ Enabled: pending
1679
+ VersionAdded: '1.71'
1680
+ SafeAutoCorrect: false
1681
+
1572
1682
  Lint/AssignmentInCondition:
1573
1683
  Description: "Don't use assignment in conditions."
1574
1684
  StyleGuide: '#safe-assignment-in-condition'
@@ -1588,10 +1698,10 @@ Lint/BinaryOperatorWithIdenticalOperands:
1588
1698
  Enabled: true
1589
1699
  Safe: false
1590
1700
  VersionAdded: '0.89'
1591
- VersionChanged: '1.7'
1701
+ VersionChanged: '1.69'
1592
1702
 
1593
1703
  Lint/BooleanSymbol:
1594
- Description: 'Check for `:true` and `:false` symbols.'
1704
+ Description: 'Checks for `:true` and `:false` symbols.'
1595
1705
  Enabled: true
1596
1706
  SafeAutoCorrect: false
1597
1707
  VersionAdded: '0.50'
@@ -1618,8 +1728,15 @@ Lint/ConstantOverwrittenInRescue:
1618
1728
  Enabled: pending
1619
1729
  VersionAdded: '1.31'
1620
1730
 
1731
+ Lint/ConstantReassignment:
1732
+ Description: 'Checks for constant reassignments.'
1733
+ Enabled: pending
1734
+ VersionAdded: '1.70'
1735
+ VersionChanged: '1.87'
1736
+
1621
1737
  Lint/ConstantResolution:
1622
- Description: 'Check that constants are fully qualified with `::`.'
1738
+ Description: 'Checks that constants are fully qualified with `::`.'
1739
+ VersionChanged: '1.89'
1623
1740
  Enabled: false
1624
1741
  VersionAdded: '0.86'
1625
1742
  # Restrict this cop to only looking at certain names
@@ -1627,11 +1744,22 @@ Lint/ConstantResolution:
1627
1744
  # Restrict this cop from only looking at certain names
1628
1745
  Ignore: []
1629
1746
 
1747
+ Lint/CopDirectiveSyntax:
1748
+ Description: 'Checks that `# rubocop:` directives are strictly formatted.'
1749
+ Enabled: pending
1750
+ VersionAdded: '1.72'
1751
+ VersionChanged: '1.90'
1752
+
1753
+ Lint/DataDefineOverride:
1754
+ Description: 'Disallow overriding the `Data` built-in methods via `Data.define`.'
1755
+ Enabled: pending
1756
+ VersionAdded: '1.85'
1757
+
1630
1758
  Lint/Debugger:
1631
- Description: 'Check for debugger calls.'
1759
+ Description: 'Checks for debugger calls.'
1632
1760
  Enabled: true
1633
1761
  VersionAdded: '0.14'
1634
- VersionChanged: '1.46'
1762
+ VersionChanged: '1.63'
1635
1763
  DebuggerMethods:
1636
1764
  # Groups are available so that a specific group can be disabled in
1637
1765
  # a user's configuration, but are otherwise not significant.
@@ -1644,8 +1772,14 @@ Lint/Debugger:
1644
1772
  - Kernel.byebug
1645
1773
  - Kernel.remote_byebug
1646
1774
  Capybara:
1775
+ - page.save_and_open_page
1776
+ - page.save_and_open_screenshot
1777
+ - page.save_page
1778
+ - page.save_screenshot
1647
1779
  - save_and_open_page
1648
1780
  - save_and_open_screenshot
1781
+ - save_page
1782
+ - save_screenshot
1649
1783
  debug.rb:
1650
1784
  - binding.b
1651
1785
  - binding.break
@@ -1667,9 +1801,13 @@ Lint/Debugger:
1667
1801
  - jard
1668
1802
  WebConsole:
1669
1803
  - binding.console
1804
+ DebuggerRequires:
1805
+ debug.rb:
1806
+ - debug/open
1807
+ - debug/start
1670
1808
 
1671
1809
  Lint/DeprecatedClassMethods:
1672
- Description: 'Check for deprecated class method calls.'
1810
+ Description: 'Checks for deprecated class method calls.'
1673
1811
  Enabled: true
1674
1812
  VersionAdded: '0.19'
1675
1813
 
@@ -1716,8 +1854,17 @@ Lint/DeprecatedOpenSSLConstant:
1716
1854
  Enabled: true
1717
1855
  VersionAdded: '0.84'
1718
1856
 
1857
+ Lint/DeprecatedReference:
1858
+ Description: >-
1859
+ Checks for references to methods and constants documented
1860
+ as deprecated with a YARD `@deprecated` tag.
1861
+ Requires `AllCops/UseProjectIndex` to be enabled.
1862
+ Enabled: pending
1863
+ VersionAdded: '1.89'
1864
+
1719
1865
  Lint/DisjunctiveAssignmentInConstructor:
1720
1866
  Description: 'In constructor, plain assignment is preferred over disjunctive.'
1867
+ StyleGuide: '#disjunctive-assignment-in-constructor'
1721
1868
  Enabled: true
1722
1869
  Safe: false
1723
1870
  VersionAdded: '0.62'
@@ -1730,6 +1877,7 @@ Lint/DuplicateBranch:
1730
1877
  VersionChanged: '1.7'
1731
1878
  IgnoreLiteralBranches: false
1732
1879
  IgnoreConstantBranches: false
1880
+ IgnoreDuplicateElseBranch: false
1733
1881
 
1734
1882
  Lint/DuplicateCaseCondition:
1735
1883
  Description: 'Do not repeat values in case conditionals.'
@@ -1742,13 +1890,13 @@ Lint/DuplicateElsifCondition:
1742
1890
  VersionAdded: '0.88'
1743
1891
 
1744
1892
  Lint/DuplicateHashKey:
1745
- Description: 'Check for duplicate keys in hash literals.'
1893
+ Description: 'Checks for duplicate keys in hash literals.'
1746
1894
  Enabled: true
1747
1895
  VersionAdded: '0.34'
1748
1896
  VersionChanged: '0.77'
1749
1897
 
1750
1898
  Lint/DuplicateMagicComment:
1751
- Description: 'Check for duplicated magic comments.'
1899
+ Description: 'Checks for duplicated magic comments.'
1752
1900
  Enabled: pending
1753
1901
  VersionAdded: '1.37'
1754
1902
 
@@ -1758,9 +1906,25 @@ Lint/DuplicateMatchPattern:
1758
1906
  VersionAdded: '1.50'
1759
1907
 
1760
1908
  Lint/DuplicateMethods:
1761
- Description: 'Check for duplicate method definitions.'
1909
+ Description: 'Checks for duplicate method definitions.'
1762
1910
  Enabled: true
1763
1911
  VersionAdded: '0.29'
1912
+ VersionChanged: '1.90'
1913
+ # Methods that define instance methods by delegation, in the style of
1914
+ # Active Support's `delegate` (`delegate :foo, :bar, to: :target`). Register
1915
+ # a project's own `delegate`-shaped macros here so the cop recognizes the
1916
+ # methods they define. Only takes effect when `AllCops/ActiveSupportExtensionsEnabled`
1917
+ # is `true`.
1918
+ DelegatingMethods:
1919
+ - delegate
1920
+ # Cross-file duplicates (detected with `AllCops/UseProjectIndex`) whose other
1921
+ # definition lives in a file matching one of these patterns are not reported.
1922
+ # Useful for files that redefine application methods but are never loaded
1923
+ # together with them, such as standalone scripts. Patterns follow the same
1924
+ # glob (or regexp) semantics as `Exclude` and are matched against the other
1925
+ # file's path relative to the directory of the config file; absolute patterns
1926
+ # are matched against the absolute path.
1927
+ AllowedCrossFilePaths: []
1764
1928
 
1765
1929
  Lint/DuplicateRegexpCharacterClassElement:
1766
1930
  Description: 'Checks for duplicate elements in Regexp character classes.'
@@ -1768,7 +1932,7 @@ Lint/DuplicateRegexpCharacterClassElement:
1768
1932
  VersionAdded: '1.1'
1769
1933
 
1770
1934
  Lint/DuplicateRequire:
1771
- Description: 'Check for duplicate `require`s and `require_relative`s.'
1935
+ Description: 'Checks for duplicate `require`s and `require_relative`s.'
1772
1936
  Enabled: true
1773
1937
  SafeAutoCorrect: false
1774
1938
  VersionAdded: '0.90'
@@ -1779,13 +1943,18 @@ Lint/DuplicateRescueException:
1779
1943
  Enabled: true
1780
1944
  VersionAdded: '0.89'
1781
1945
 
1946
+ Lint/DuplicateSetElement:
1947
+ Description: 'Checks for duplicate elements in Set.'
1948
+ Enabled: pending
1949
+ VersionAdded: '1.67'
1950
+
1782
1951
  Lint/EachWithObjectArgument:
1783
- Description: 'Check for immutable argument given to each_with_object.'
1952
+ Description: 'Checks for immutable argument given to each_with_object.'
1784
1953
  Enabled: true
1785
1954
  VersionAdded: '0.31'
1786
1955
 
1787
1956
  Lint/ElseLayout:
1788
- Description: 'Check for odd code arrangement in an else block.'
1957
+ Description: 'Checks for odd code arrangement in an else block.'
1789
1958
  Enabled: true
1790
1959
  VersionAdded: '0.17'
1791
1960
  VersionChanged: '1.2'
@@ -1807,16 +1976,17 @@ Lint/EmptyClass:
1807
1976
  Lint/EmptyConditionalBody:
1808
1977
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1809
1978
  Enabled: true
1810
- SafeAutoCorrect: false
1811
- AllowComments: true
1979
+ AutoCorrect: contextual
1812
1980
  VersionAdded: '0.89'
1813
- VersionChanged: '1.34'
1981
+ VersionChanged: '1.73'
1982
+ AllowComments: true
1814
1983
 
1815
1984
  Lint/EmptyEnsure:
1816
1985
  Description: 'Checks for empty ensure block.'
1817
1986
  Enabled: true
1987
+ AutoCorrect: contextual
1818
1988
  VersionAdded: '0.10'
1819
- VersionChanged: '0.48'
1989
+ VersionChanged: '1.61'
1820
1990
 
1821
1991
  Lint/EmptyExpression:
1822
1992
  Description: 'Checks for empty expressions.'
@@ -1838,15 +2008,16 @@ Lint/EmptyInPattern:
1838
2008
  Lint/EmptyInterpolation:
1839
2009
  Description: 'Checks for empty string interpolation.'
1840
2010
  Enabled: true
2011
+ AutoCorrect: contextual
1841
2012
  VersionAdded: '0.20'
1842
- VersionChanged: '0.45'
2013
+ VersionChanged: '1.76'
1843
2014
 
1844
2015
  Lint/EmptyWhen:
1845
2016
  Description: 'Checks for `when` branches with empty bodies.'
1846
2017
  Enabled: true
1847
- AllowComments: true
1848
2018
  VersionAdded: '0.45'
1849
2019
  VersionChanged: '0.83'
2020
+ AllowComments: true
1850
2021
 
1851
2022
  Lint/EnsureReturn:
1852
2023
  Description: 'Do not use return in an ensure block.'
@@ -1880,7 +2051,7 @@ Lint/FloatOutOfRange:
1880
2051
  VersionAdded: '0.36'
1881
2052
 
1882
2053
  Lint/FormatParameterMismatch:
1883
- Description: 'The number of parameters to format/sprint must match the fields.'
2054
+ Description: 'Checks for a mismatch between the format fields and the arguments to `format`/`sprintf`/`%`.'
1884
2055
  Enabled: true
1885
2056
  VersionAdded: '0.33'
1886
2057
 
@@ -1891,18 +2062,23 @@ Lint/HashCompareByIdentity:
1891
2062
  Safe: false
1892
2063
  VersionAdded: '0.93'
1893
2064
 
2065
+ Lint/HashNewWithKeywordArgumentsAsDefault:
2066
+ Description: 'Checks for the deprecated use of keyword arguments for hash default in `Hash.new`.'
2067
+ Enabled: pending
2068
+ VersionAdded: '1.69'
2069
+
1894
2070
  Lint/HeredocMethodCallPosition:
1895
2071
  Description: >-
1896
2072
  Checks for the ordering of a method call where
1897
2073
  the receiver of the call is a HEREDOC.
1898
- Enabled: false
1899
2074
  StyleGuide: '#heredoc-method-calls'
2075
+ Enabled: false
1900
2076
  VersionAdded: '0.68'
1901
2077
 
1902
2078
  Lint/IdentityComparison:
1903
2079
  Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1904
- Enabled: true
1905
2080
  StyleGuide: '#identity-comparison'
2081
+ Enabled: true
1906
2082
  VersionAdded: '0.91'
1907
2083
 
1908
2084
  Lint/ImplicitStringConcatenation:
@@ -1931,7 +2107,7 @@ Lint/InheritException:
1931
2107
  Enabled: true
1932
2108
  SafeAutoCorrect: false
1933
2109
  VersionAdded: '0.41'
1934
- VersionChanged: '1.26'
2110
+ VersionChanged: '1.89'
1935
2111
  # The default base class in favour of `Exception`.
1936
2112
  EnforcedStyle: standard_error
1937
2113
  SupportedStyles:
@@ -1945,6 +2121,13 @@ Lint/InterpolationCheck:
1945
2121
  VersionAdded: '0.50'
1946
2122
  VersionChanged: '1.40'
1947
2123
 
2124
+ Lint/ItWithoutArgumentsInBlock:
2125
+ Description: 'Checks uses of `it` calls without arguments in block.'
2126
+ References:
2127
+ - 'https://bugs.ruby-lang.org/issues/18980'
2128
+ Enabled: pending
2129
+ VersionAdded: '1.59'
2130
+
1948
2131
  Lint/LambdaWithoutLiteralBlock:
1949
2132
  Description: 'Checks uses of lambda without a literal block.'
1950
2133
  Enabled: pending
@@ -1953,8 +2136,14 @@ Lint/LambdaWithoutLiteralBlock:
1953
2136
  Lint/LiteralAsCondition:
1954
2137
  Description: 'Checks of literals used in conditions.'
1955
2138
  Enabled: true
2139
+ AutoCorrect: contextual
1956
2140
  VersionAdded: '0.51'
1957
2141
 
2142
+ Lint/LiteralAssignmentInCondition:
2143
+ Description: 'Checks for literal assignments in the conditions.'
2144
+ Enabled: pending
2145
+ VersionAdded: '1.58'
2146
+
1958
2147
  Lint/LiteralInInterpolation:
1959
2148
  Description: 'Checks for literals used in interpolation.'
1960
2149
  Enabled: true
@@ -1975,6 +2164,7 @@ Lint/MissingCopEnableDirective:
1975
2164
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
1976
2165
  Enabled: true
1977
2166
  VersionAdded: '0.52'
2167
+ VersionChanged: '1.90'
1978
2168
  # Maximum number of consecutive lines the cop can be disabled for.
1979
2169
  # 0 allows only single-line disables
1980
2170
  # 1 would mean the maximum allowed is the following:
@@ -1982,16 +2172,16 @@ Lint/MissingCopEnableDirective:
1982
2172
  # a = 1
1983
2173
  # # rubocop:enable SomeCop
1984
2174
  # .inf for any size
1985
- MaximumRangeSize: .inf
2175
+ MaxRangeSize: .inf
1986
2176
 
1987
2177
  Lint/MissingSuper:
1988
2178
  Description: >-
1989
2179
  Checks for the presence of constructors and lifecycle callbacks
1990
2180
  without calls to `super`.
1991
2181
  Enabled: true
1992
- AllowedParentClasses: []
1993
2182
  VersionAdded: '0.89'
1994
- VersionChanged: '1.4'
2183
+ VersionChanged: '1.89'
2184
+ AllowedParentClasses: []
1995
2185
 
1996
2186
  Lint/MixedCaseRange:
1997
2187
  Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
@@ -2001,6 +2191,7 @@ Lint/MixedCaseRange:
2001
2191
 
2002
2192
  Lint/MixedRegexpCaptureTypes:
2003
2193
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
2194
+ StyleGuide: '#do-not-mix-named-and-numbered-captures'
2004
2195
  Enabled: true
2005
2196
  VersionAdded: '0.85'
2006
2197
 
@@ -2010,6 +2201,16 @@ Lint/MultipleComparison:
2010
2201
  VersionAdded: '0.47'
2011
2202
  VersionChanged: '1.1'
2012
2203
 
2204
+ Lint/NameTypo:
2205
+ Description: >-
2206
+ Checks for probable typos in constant and method names,
2207
+ using the project index.
2208
+ Enabled: pending
2209
+ CheckConstants: true
2210
+ CheckMethods: true
2211
+ AllowedNames: []
2212
+ VersionAdded: '1.89'
2213
+
2013
2214
  Lint/NestedMethodDefinition:
2014
2215
  Description: 'Do not use nested method definitions.'
2015
2216
  StyleGuide: '#no-nested-methods'
@@ -2057,11 +2258,11 @@ Lint/NumberConversion:
2057
2258
  Description: 'Checks unsafe usage of number conversion methods.'
2058
2259
  Enabled: false
2059
2260
  VersionAdded: '0.53'
2060
- VersionChanged: '1.1'
2261
+ VersionChanged: '1.88'
2061
2262
  SafeAutoCorrect: false
2062
2263
  AllowedMethods: []
2063
2264
  AllowedPatterns: []
2064
- IgnoredClasses:
2265
+ AllowedClasses:
2065
2266
  - Time
2066
2267
  - DateTime
2067
2268
 
@@ -2070,6 +2271,13 @@ Lint/NumberedParameterAssignment:
2070
2271
  Enabled: pending
2071
2272
  VersionAdded: '1.9'
2072
2273
 
2274
+ Lint/NumericOperationWithConstantResult:
2275
+ Description: 'Checks for numeric operations with constant results.'
2276
+ Enabled: pending
2277
+ SafeAutoCorrect: false
2278
+ VersionAdded: '1.69'
2279
+ VersionChanged: '1.88'
2280
+
2073
2281
  Lint/OrAssignmentToConstant:
2074
2282
  Description: 'Checks unintended or-assignment to constant.'
2075
2283
  Enabled: pending
@@ -2140,6 +2348,7 @@ Lint/RedundantCopEnableDirective:
2140
2348
  Description: Checks for rubocop:enable comments that can be removed.
2141
2349
  Enabled: true
2142
2350
  VersionAdded: '0.76'
2351
+ VersionChanged: '1.90'
2143
2352
 
2144
2353
  Lint/RedundantDirGlobSort:
2145
2354
  Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
@@ -2157,11 +2366,13 @@ Lint/RedundantRequireStatement:
2157
2366
  Description: 'Checks for unnecessary `require` statement.'
2158
2367
  Enabled: true
2159
2368
  VersionAdded: '0.76'
2369
+ VersionChanged: '1.73'
2160
2370
 
2161
2371
  Lint/RedundantSafeNavigation:
2162
2372
  Description: 'Checks for redundant safe navigation calls.'
2163
2373
  Enabled: true
2164
2374
  VersionAdded: '0.93'
2375
+ VersionChanged: '1.79'
2165
2376
  AllowedMethods:
2166
2377
  - instance_of?
2167
2378
  - kind_of?
@@ -2169,6 +2380,12 @@ Lint/RedundantSafeNavigation:
2169
2380
  - eql?
2170
2381
  - respond_to?
2171
2382
  - equal?
2383
+ InferNonNilReceiver: false
2384
+ AdditionalNilMethods:
2385
+ - present?
2386
+ - blank?
2387
+ - try
2388
+ - try!
2172
2389
  Safe: false
2173
2390
 
2174
2391
  Lint/RedundantSplatExpansion:
@@ -2185,6 +2402,11 @@ Lint/RedundantStringCoercion:
2185
2402
  VersionAdded: '0.19'
2186
2403
  VersionChanged: '0.77'
2187
2404
 
2405
+ Lint/RedundantTypeConversion:
2406
+ Description: 'Checks for redundantly converting a literal to the same type.'
2407
+ Enabled: pending
2408
+ VersionAdded: '1.72'
2409
+
2188
2410
  Lint/RedundantWithIndex:
2189
2411
  Description: 'Checks for redundant `with_index`.'
2190
2412
  Enabled: true
@@ -2193,13 +2415,16 @@ Lint/RedundantWithIndex:
2193
2415
  Lint/RedundantWithObject:
2194
2416
  Description: 'Checks for redundant `with_object`.'
2195
2417
  Enabled: true
2418
+ SafeAutoCorrect: false
2196
2419
  VersionAdded: '0.51'
2420
+ VersionChanged: '1.88'
2197
2421
 
2198
2422
  Lint/RefinementImportMethods:
2199
2423
  Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
2200
2424
  Enabled: pending
2201
2425
  SafeAutoCorrect: false
2202
2426
  VersionAdded: '1.27'
2427
+ VersionChanged: '1.88'
2203
2428
 
2204
2429
  Lint/RegexpAsCondition:
2205
2430
  Description: >-
@@ -2246,8 +2471,9 @@ Lint/ReturnInVoidContext:
2246
2471
  Lint/SafeNavigationChain:
2247
2472
  Description: 'Do not chain ordinary method call after safe navigation operator.'
2248
2473
  Enabled: true
2474
+ SafeAutoCorrect: false
2249
2475
  VersionAdded: '0.47'
2250
- VersionChanged: '0.77'
2476
+ VersionChanged: '1.89'
2251
2477
  AllowedMethods:
2252
2478
  - present?
2253
2479
  - blank?
@@ -2258,12 +2484,13 @@ Lint/SafeNavigationChain:
2258
2484
 
2259
2485
  Lint/SafeNavigationConsistency:
2260
2486
  Description: >-
2261
- Check to make sure that if safe navigation is used for a method
2262
- call in an `&&` or `||` condition that safe navigation is used
2263
- for all method calls on that same object.
2487
+ Check to make sure that if safe navigation is used in an `&&` or `||` condition,
2488
+ consistent and appropriate safe navigation, without excess or deficiency,
2489
+ is used for all method calls on the same object.
2264
2490
  Enabled: true
2491
+ SafeAutoCorrect: false
2265
2492
  VersionAdded: '0.55'
2266
- VersionChanged: '0.77'
2493
+ VersionChanged: '1.85'
2267
2494
  AllowedMethods:
2268
2495
  - present?
2269
2496
  - blank?
@@ -2287,6 +2514,7 @@ Lint/SelfAssignment:
2287
2514
  Description: 'Checks for self-assignments.'
2288
2515
  Enabled: true
2289
2516
  VersionAdded: '0.89'
2517
+ AllowRBSInlineAnnotation: false
2290
2518
 
2291
2519
  Lint/SendWithMixinArgument:
2292
2520
  Description: 'Checks for `send` method when using mixin.'
@@ -2299,11 +2527,11 @@ Lint/ShadowedArgument:
2299
2527
  VersionAdded: '0.52'
2300
2528
  IgnoreImplicitReferences: false
2301
2529
 
2302
-
2303
2530
  Lint/ShadowedException:
2304
2531
  Description: >-
2305
2532
  Avoid rescuing a higher level exception
2306
2533
  before a lower level exception.
2534
+ StyleGuide: '#exception-ordering'
2307
2535
  Enabled: true
2308
2536
  VersionAdded: '0.41'
2309
2537
 
@@ -2311,22 +2539,42 @@ Lint/ShadowingOuterLocalVariable:
2311
2539
  Description: >-
2312
2540
  Do not use the same name as outer local variable
2313
2541
  for block arguments or block local variables.
2314
- Enabled: true
2542
+ Enabled: false
2315
2543
  VersionAdded: '0.9'
2544
+ VersionChanged: '1.76'
2545
+
2546
+ Lint/SharedMutableDefault:
2547
+ Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
2548
+ StyleGuide: '#no-mutable-defaults'
2549
+ Enabled: pending
2550
+ VersionAdded: '1.70'
2316
2551
 
2317
2552
  Lint/StructNewOverride:
2318
2553
  Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
2319
2554
  Enabled: true
2320
2555
  VersionAdded: '0.81'
2321
2556
 
2557
+ Lint/SuperArgumentMismatch:
2558
+ Description: >-
2559
+ Checks for `super` calls that pass the wrong number of positional
2560
+ arguments to the overridden implementation, using the project index.
2561
+ Enabled: pending
2562
+ VersionAdded: '1.90'
2563
+
2322
2564
  Lint/SuppressedException:
2323
2565
  Description: "Don't suppress exceptions."
2324
2566
  StyleGuide: '#dont-hide-exceptions'
2325
2567
  Enabled: true
2326
- AllowComments: true
2327
- AllowNil: true
2328
2568
  VersionAdded: '0.9'
2329
2569
  VersionChanged: '1.12'
2570
+ AllowComments: true
2571
+ AllowNil: true
2572
+
2573
+ Lint/SuppressedExceptionInNumberConversion:
2574
+ Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
2575
+ Enabled: pending
2576
+ SafeAutoCorrect: false
2577
+ VersionAdded: '1.72'
2330
2578
 
2331
2579
  Lint/SymbolConversion:
2332
2580
  Description: 'Checks for unnecessary symbol conversions.'
@@ -2364,7 +2612,9 @@ Lint/TopLevelReturnWithArgument:
2364
2612
  Lint/TrailingCommaInAttributeDeclaration:
2365
2613
  Description: 'Checks for trailing commas in attribute declarations.'
2366
2614
  Enabled: true
2615
+ AutoCorrect: contextual
2367
2616
  VersionAdded: '0.90'
2617
+ VersionChanged: '1.61'
2368
2618
 
2369
2619
  Lint/TripleQuotes:
2370
2620
  Description: 'Checks for useless triple quote constructs.'
@@ -2377,6 +2627,11 @@ Lint/UnderscorePrefixedVariableName:
2377
2627
  VersionAdded: '0.21'
2378
2628
  AllowKeywordBlockArguments: false
2379
2629
 
2630
+ Lint/UnescapedBracketInRegexp:
2631
+ Description: 'Checks for unescaped literal `]` in Regexp.'
2632
+ Enabled: pending
2633
+ VersionAdded: '1.68'
2634
+
2380
2635
  Lint/UnexpectedBlockArity:
2381
2636
  Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2382
2637
  Enabled: pending
@@ -2396,6 +2651,7 @@ Lint/UnexpectedBlockArity:
2396
2651
 
2397
2652
  Lint/UnifiedInteger:
2398
2653
  Description: 'Use Integer instead of Fixnum or Bignum.'
2654
+ StyleGuide: '#integer-type-checking'
2399
2655
  Enabled: true
2400
2656
  VersionAdded: '0.43'
2401
2657
 
@@ -2406,7 +2662,7 @@ Lint/UnmodifiedReduceAccumulator:
2406
2662
  VersionChanged: '1.5'
2407
2663
 
2408
2664
  Lint/UnreachableCode:
2409
- Description: 'Unreachable code.'
2665
+ Description: 'Checks for unreachable code.'
2410
2666
  Enabled: true
2411
2667
  VersionAdded: '0.9'
2412
2668
 
@@ -2420,12 +2676,18 @@ Lint/UnreachableLoop:
2420
2676
  # eg. `exactly(2).times`
2421
2677
  - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2422
2678
 
2679
+ Lint/UnreachablePatternBranch:
2680
+ Description: 'Checks for unreachable `in` pattern branches after an unconditional catch-all pattern.'
2681
+ Enabled: pending
2682
+ VersionAdded: '1.85'
2683
+
2423
2684
  Lint/UnusedBlockArgument:
2424
2685
  Description: 'Checks for unused block arguments.'
2425
2686
  StyleGuide: '#underscore-unused-vars'
2426
2687
  Enabled: true
2688
+ AutoCorrect: contextual
2427
2689
  VersionAdded: '0.21'
2428
- VersionChanged: '0.22'
2690
+ VersionChanged: '1.61'
2429
2691
  IgnoreEmptyBlocks: true
2430
2692
  AllowUnusedKeywordArguments: false
2431
2693
 
@@ -2433,11 +2695,29 @@ Lint/UnusedMethodArgument:
2433
2695
  Description: 'Checks for unused method arguments.'
2434
2696
  StyleGuide: '#underscore-unused-vars'
2435
2697
  Enabled: true
2698
+ AutoCorrect: contextual
2436
2699
  VersionAdded: '0.21'
2437
- VersionChanged: '0.81'
2700
+ VersionChanged: '1.69'
2438
2701
  AllowUnusedKeywordArguments: false
2439
2702
  IgnoreEmptyMethods: true
2440
2703
  IgnoreNotImplementedMethods: true
2704
+ NotImplementedExceptions:
2705
+ - NotImplementedError
2706
+
2707
+ Lint/UnusedPrivateMethod:
2708
+ Description: >-
2709
+ Checks for private instance methods that are not referenced
2710
+ anywhere in the project. Requires `AllCops/UseProjectIndex`
2711
+ to be enabled.
2712
+ # This cop is disabled by default because symbol-based references from other
2713
+ # files (e.g. Rails callbacks declared in a concern) cannot be detected and
2714
+ # would be reported as false positives. It is intended for occasional
2715
+ # dead-code sweeps rather than permanent enforcement.
2716
+ Enabled: false
2717
+ AllowedNames: []
2718
+ AllowedPatterns: []
2719
+ VersionAdded: '1.89'
2720
+ VersionChanged: '1.90'
2441
2721
 
2442
2722
  Lint/UriEscapeUnescape:
2443
2723
  Description: >-
@@ -2458,8 +2738,9 @@ Lint/UriRegexp:
2458
2738
  Lint/UselessAccessModifier:
2459
2739
  Description: 'Checks for useless access modifiers.'
2460
2740
  Enabled: true
2741
+ AutoCorrect: contextual
2461
2742
  VersionAdded: '0.20'
2462
- VersionChanged: '0.83'
2743
+ VersionChanged: '1.61'
2463
2744
  ContextCreatingMethods: []
2464
2745
  MethodCreatingMethods: []
2465
2746
 
@@ -2467,9 +2748,27 @@ Lint/UselessAssignment:
2467
2748
  Description: 'Checks for useless assignment to a local variable.'
2468
2749
  StyleGuide: '#underscore-unused-vars'
2469
2750
  Enabled: true
2751
+ AutoCorrect: contextual
2470
2752
  VersionAdded: '0.11'
2471
- VersionChanged: '1.51'
2472
- SafeAutoCorrect: false
2753
+ VersionChanged: '1.66'
2754
+
2755
+ Lint/UselessConstantScoping:
2756
+ Description: 'Checks for useless constant scoping.'
2757
+ Enabled: pending
2758
+ VersionAdded: '1.72'
2759
+ VersionChanged: '1.90'
2760
+
2761
+ Lint/UselessDefaultValueArgument:
2762
+ Description: 'Checks for usage of `fetch` or `Array.new` with default value argument and block.'
2763
+ Enabled: pending
2764
+ VersionAdded: '1.76'
2765
+ Safe: false
2766
+ AllowedReceivers: []
2767
+
2768
+ Lint/UselessDefined:
2769
+ Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
2770
+ Enabled: pending
2771
+ VersionAdded: '1.69'
2473
2772
 
2474
2773
  Lint/UselessElseWithoutRescue:
2475
2774
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
@@ -2480,10 +2779,24 @@ Lint/UselessElseWithoutRescue:
2480
2779
  Lint/UselessMethodDefinition:
2481
2780
  Description: 'Checks for useless method definitions.'
2482
2781
  Enabled: true
2782
+ AutoCorrect: contextual
2483
2783
  VersionAdded: '0.90'
2484
- VersionChanged: '0.91'
2784
+ VersionChanged: '1.61'
2485
2785
  Safe: false
2486
2786
 
2787
+ Lint/UselessNumericOperation:
2788
+ Description: 'Checks for useless numeric operations.'
2789
+ Enabled: pending
2790
+ VersionAdded: '1.66'
2791
+
2792
+ Lint/UselessOr:
2793
+ Description: 'Checks for useless OR expressions.'
2794
+ Enabled: pending
2795
+ SafeAutoCorrect: false
2796
+ AutoCorrect: contextual
2797
+ VersionAdded: '1.76'
2798
+ VersionChanged: '1.82'
2799
+
2487
2800
  Lint/UselessRescue:
2488
2801
  Description: 'Checks for useless `rescue`s.'
2489
2802
  Enabled: pending
@@ -2504,23 +2817,25 @@ Lint/UselessSetterCall:
2504
2817
  Lint/UselessTimes:
2505
2818
  Description: 'Checks for useless `Integer#times` calls.'
2506
2819
  Enabled: true
2507
- VersionAdded: '0.91'
2508
2820
  Safe: false
2821
+ AutoCorrect: contextual
2822
+ VersionAdded: '0.91'
2823
+ VersionChanged: '1.61'
2509
2824
 
2510
2825
  Lint/Void:
2511
- Description: 'Possible use of operator/literal/variable in void context.'
2826
+ Description: 'Checks for operators, literals, lambdas, and procs used in void context.'
2512
2827
  Enabled: true
2828
+ AutoCorrect: contextual
2513
2829
  VersionAdded: '0.9'
2830
+ VersionChanged: '1.61'
2514
2831
  CheckForMethodsWithNoSideEffects: false
2515
2832
 
2516
2833
  #################### Metrics ###############################
2517
2834
 
2518
2835
  Metrics/AbcSize:
2519
- Description: >-
2520
- A calculated magnitude based on number of assignments,
2521
- branches, and conditions.
2522
- Reference:
2523
- - http://c2.com/cgi/wiki?AbcMetric
2836
+ Description: 'Checks that the ABC size of methods is not higher than the configured maximum.'
2837
+ References:
2838
+ - https://wiki.c2.com/?AbcMetric
2524
2839
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
2525
2840
  Enabled: true
2526
2841
  VersionAdded: '0.27'
@@ -2553,8 +2868,9 @@ Metrics/BlockNesting:
2553
2868
  StyleGuide: '#three-is-the-number-thou-shalt-count'
2554
2869
  Enabled: true
2555
2870
  VersionAdded: '0.25'
2556
- VersionChanged: '0.47'
2871
+ VersionChanged: '1.65'
2557
2872
  CountBlocks: false
2873
+ CountModifierForms: false
2558
2874
  Max: 3
2559
2875
 
2560
2876
  Metrics/ClassLength:
@@ -2570,13 +2886,12 @@ Metrics/CollectionLiteralLength:
2570
2886
  Description: 'Checks for `Array` or `Hash` literals with many entries.'
2571
2887
  Enabled: pending
2572
2888
  VersionAdded: '1.47'
2573
- LengthThreshold: 250
2889
+ VersionChanged: '1.88'
2890
+ Max: 250
2574
2891
 
2575
2892
  # Avoid complex methods.
2576
2893
  Metrics/CyclomaticComplexity:
2577
- Description: >-
2578
- A complexity metric that is strongly correlated to the number
2579
- of test cases needed to validate a method.
2894
+ Description: 'Checks that the cyclomatic complexity of methods is not higher than the configured maximum.'
2580
2895
  Enabled: true
2581
2896
  VersionAdded: '0.25'
2582
2897
  VersionChanged: '0.81'
@@ -2616,30 +2931,27 @@ Metrics/ParameterLists:
2616
2931
  MaxOptionalParameters: 3
2617
2932
 
2618
2933
  Metrics/PerceivedComplexity:
2619
- Description: >-
2620
- A complexity metric geared towards measuring complexity for a
2621
- human reader.
2934
+ Description: 'Checks that the perceived complexity of methods is not higher than the configured maximum.'
2622
2935
  Enabled: true
2623
2936
  VersionAdded: '0.25'
2624
- VersionChanged: '0.81'
2937
+ VersionChanged: '1.88'
2625
2938
  AllowedMethods: []
2626
2939
  AllowedPatterns: []
2627
2940
  Max: 8
2628
2941
 
2629
- ################## Migration #############################
2942
+ #################### Migration #############################
2630
2943
 
2631
2944
  Migration/DepartmentName:
2632
- Description: >-
2633
- Check that cop names in rubocop:disable (etc) comments are
2634
- given with department name.
2945
+ Description: 'Checks that cop names in `rubocop:disable` (etc.) comments are given with a department name.'
2635
2946
  Enabled: true
2636
2947
  VersionAdded: '0.75'
2637
2948
 
2638
- #################### Naming ##############################
2949
+ #################### Naming ################################
2639
2950
 
2640
2951
  Naming/AccessorMethodName:
2641
- Description: Check the naming of accessor methods for get_/set_.
2952
+ Description: Checks the naming of accessor methods for get_/set_.
2642
2953
  StyleGuide: '#accessor_mutator_method_names'
2954
+ VersionChanged: '1.89'
2643
2955
  Enabled: true
2644
2956
  VersionAdded: '0.50'
2645
2957
 
@@ -2652,7 +2964,7 @@ Naming/AsciiIdentifiers:
2652
2964
  AsciiConstants: true
2653
2965
 
2654
2966
  Naming/BinaryOperatorParameterName:
2655
- Description: 'When defining binary operators, name the argument other.'
2967
+ Description: 'Checks that the sole parameter of binary operator methods is named `other`.'
2656
2968
  StyleGuide: '#other-arg'
2657
2969
  Enabled: true
2658
2970
  VersionAdded: '0.50'
@@ -2709,7 +3021,8 @@ Naming/FileName:
2709
3021
  VersionChanged: '1.23'
2710
3022
  # Camel case file names listed in `AllCops:Include` and all file names listed
2711
3023
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2712
- Exclude: []
3024
+ Exclude:
3025
+ - Rakefile.rb
2713
3026
  # When `true`, requires that each source file should define a class or module
2714
3027
  # with a name which matches the file name (converted to ... case).
2715
3028
  # It further expects it to be nested inside modules which match the names
@@ -2821,7 +3134,10 @@ Naming/InclusiveLanguage:
2821
3134
  - block
2822
3135
  slave:
2823
3136
  WholeWord: true
2824
- Suggestions: ['replica', 'secondary', 'follower']
3137
+ Suggestions:
3138
+ - replica
3139
+ - secondary
3140
+ - follower
2825
3141
 
2826
3142
  Naming/MemoizedInstanceVariableName:
2827
3143
  Description: >-
@@ -2841,6 +3157,7 @@ Naming/MethodName:
2841
3157
  StyleGuide: '#snake-case-symbols-methods-vars'
2842
3158
  Enabled: true
2843
3159
  VersionAdded: '0.50'
3160
+ VersionChanged: '1.75'
2844
3161
  EnforcedStyle: snake_case
2845
3162
  SupportedStyles:
2846
3163
  - snake_case
@@ -2852,6 +3169,10 @@ Naming/MethodName:
2852
3169
  # - '\A\s*onSelectionCleared\s*'
2853
3170
  #
2854
3171
  AllowedPatterns: []
3172
+ ForbiddenIdentifiers:
3173
+ - __id__
3174
+ - __send__
3175
+ ForbiddenPatterns: []
2855
3176
 
2856
3177
  Naming/MethodParameterName:
2857
3178
  Description: >-
@@ -2883,22 +3204,43 @@ Naming/MethodParameterName:
2883
3204
  # Forbidden names that will register an offense
2884
3205
  ForbiddenNames: []
2885
3206
 
2886
- Naming/PredicateName:
2887
- Description: 'Check the names of predicate methods.'
3207
+ Naming/PredicateMethod:
3208
+ Description: 'Checks that predicate methods end with `?` and non-predicate methods do not.'
3209
+ Enabled: pending
3210
+ VersionAdded: '1.76'
3211
+ VersionChanged: '1.78'
3212
+ # In `aggressive` mode, the cop will register an offense for predicate methods that
3213
+ # may return a non-boolean value.
3214
+ # In `conservative` mode, the cop will *not* register an offense for predicate methods
3215
+ # that may return a non-boolean value.
3216
+ Mode: conservative
3217
+ AllowedMethods:
3218
+ - call
3219
+ AllowedPatterns: []
3220
+ AllowBangMethods: false
3221
+ # Methods that are known to not return a boolean value, despite ending in `?`.
3222
+ WaywardPredicates:
3223
+ - infinite?
3224
+ - nonzero?
3225
+
3226
+ Naming/PredicatePrefix:
3227
+ Description: 'Checks that predicate method names end with a question mark and do not start with a forbidden prefix.'
2888
3228
  StyleGuide: '#bool-methods-qmark'
2889
3229
  Enabled: true
2890
3230
  VersionAdded: '0.50'
2891
- VersionChanged: '0.77'
3231
+ VersionChanged: '1.89'
2892
3232
  # Predicate name prefixes.
2893
3233
  NamePrefix:
2894
3234
  - is_
2895
3235
  - has_
2896
3236
  - have_
3237
+ - does_
2897
3238
  # Predicate name prefixes that should be removed.
2898
3239
  ForbiddenPrefixes:
2899
3240
  - is_
2900
3241
  - has_
2901
3242
  - have_
3243
+ - does_
2902
3244
  # Predicate names which, despite having a forbidden prefix, or no `?`,
2903
3245
  # should still be accepted
2904
3246
  AllowedMethods:
@@ -2907,6 +3249,8 @@ Naming/PredicateName:
2907
3249
  MethodDefinitionMacros:
2908
3250
  - define_method
2909
3251
  - define_singleton_method
3252
+ # Use Sorbet's T::Boolean return type to detect predicate methods.
3253
+ UseSorbetSigs: false
2910
3254
  # Exclude Rspec specs because there is a strong convention to write spec
2911
3255
  # helpers in the form of `have_something` or `be_something`.
2912
3256
  Exclude:
@@ -2924,13 +3268,15 @@ Naming/VariableName:
2924
3268
  StyleGuide: '#snake-case-symbols-methods-vars'
2925
3269
  Enabled: true
2926
3270
  VersionAdded: '0.50'
2927
- VersionChanged: '1.8'
3271
+ VersionChanged: '1.73'
2928
3272
  EnforcedStyle: snake_case
2929
3273
  SupportedStyles:
2930
3274
  - snake_case
2931
3275
  - camelCase
2932
3276
  AllowedIdentifiers: []
2933
3277
  AllowedPatterns: []
3278
+ ForbiddenIdentifiers: []
3279
+ ForbiddenPatterns: []
2934
3280
 
2935
3281
  Naming/VariableNumber:
2936
3282
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2946,6 +3292,8 @@ Naming/VariableNumber:
2946
3292
  CheckMethodNames: true
2947
3293
  CheckSymbols: true
2948
3294
  AllowedIdentifiers:
3295
+ - TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
3296
+ - TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
2949
3297
  - capture3 # Open3.capture3
2950
3298
  - iso8601 # Time#iso8601
2951
3299
  - rfc1123_date # CGI.rfc1123_date
@@ -2958,14 +3306,14 @@ Naming/VariableNumber:
2958
3306
  #################### Security ##############################
2959
3307
 
2960
3308
  Security/CompoundHash:
2961
- Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
3309
+ Description: 'Checks for `hash` implementations that combine values manually instead of delegating to `Array#hash`.'
2962
3310
  Enabled: pending
2963
3311
  Safe: false
2964
3312
  VersionAdded: '1.28'
2965
3313
  VersionChanged: '1.51'
2966
3314
 
2967
3315
  Security/Eval:
2968
- Description: 'The use of eval represents a serious security risk.'
3316
+ Description: 'Checks for the use of `Kernel#eval` and `Binding#eval` with dynamic arguments.'
2969
3317
  Enabled: true
2970
3318
  VersionAdded: '0.47'
2971
3319
 
@@ -2981,7 +3329,9 @@ Security/JSONLoad:
2981
3329
  Description: >-
2982
3330
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
2983
3331
  security issues. See reference for more information.
2984
- Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3332
+ References:
3333
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3334
+ - 'https://bugs.ruby-lang.org/issues/19528'
2985
3335
  Enabled: true
2986
3336
  VersionAdded: '0.43'
2987
3337
  VersionChanged: '1.22'
@@ -2993,12 +3343,13 @@ Security/MarshalLoad:
2993
3343
  Description: >-
2994
3344
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2995
3345
  security issues. See reference for more information.
2996
- Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3346
+ References:
3347
+ - 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
2997
3348
  Enabled: true
2998
3349
  VersionAdded: '0.47'
2999
3350
 
3000
3351
  Security/Open:
3001
- Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
3352
+ Description: 'Checks for the use of `Kernel#open` and `URI.open` with dynamic data.'
3002
3353
  Enabled: true
3003
3354
  VersionAdded: '0.53'
3004
3355
  VersionChanged: '1.0'
@@ -3008,23 +3359,26 @@ Security/YAMLLoad:
3008
3359
  Description: >-
3009
3360
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
3010
3361
  security issues. See reference for more information.
3011
- Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3362
+ References:
3363
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3012
3364
  Enabled: true
3013
3365
  VersionAdded: '0.47'
3014
3366
  SafeAutoCorrect: false
3015
3367
 
3016
- #################### Style ###############################
3368
+ #################### Style #################################
3017
3369
 
3018
3370
  Style/AccessModifierDeclarations:
3019
3371
  Description: 'Checks style of how access modifiers are used.'
3020
3372
  Enabled: true
3021
3373
  VersionAdded: '0.57'
3022
- VersionChanged: '0.81'
3374
+ VersionChanged: '1.70'
3023
3375
  EnforcedStyle: group
3024
3376
  SupportedStyles:
3025
3377
  - inline
3026
3378
  - group
3027
3379
  AllowModifiersOnSymbols: true
3380
+ AllowModifiersOnAttrs: true
3381
+ AllowModifiersOnAliasMethod: true
3028
3382
  SafeAutoCorrect: false
3029
3383
 
3030
3384
  Style/AccessorGrouping:
@@ -3049,6 +3403,12 @@ Style/Alias:
3049
3403
  - prefer_alias
3050
3404
  - prefer_alias_method
3051
3405
 
3406
+ Style/AmbiguousEndlessMethodDefinition:
3407
+ Description: 'Checks for endless methods inside operators of lower precedence.'
3408
+ StyleGuide: '#ambiguous-endless-method-definitions'
3409
+ Enabled: pending
3410
+ VersionAdded: '1.68'
3411
+
3052
3412
  Style/AndOr:
3053
3413
  Description: 'Use &&/|| instead of and/or.'
3054
3414
  StyleGuide: '#no-and-or-or'
@@ -3067,8 +3427,21 @@ Style/ArgumentsForwarding:
3067
3427
  Description: 'Use arguments forwarding.'
3068
3428
  StyleGuide: '#arguments-forwarding'
3069
3429
  Enabled: pending
3070
- AllowOnlyRestArgument: true
3071
3430
  VersionAdded: '1.1'
3431
+ VersionChanged: '1.58'
3432
+ AllowOnlyRestArgument: true
3433
+ UseAnonymousForwarding: true
3434
+ RedundantRestArgumentNames:
3435
+ - args
3436
+ - arguments
3437
+ RedundantKeywordRestArgumentNames:
3438
+ - kwargs
3439
+ - options
3440
+ - opts
3441
+ RedundantBlockArgumentNames:
3442
+ - blk
3443
+ - block
3444
+ - proc
3072
3445
 
3073
3446
  Style/ArrayCoercion:
3074
3447
  Description: >-
@@ -3079,12 +3452,27 @@ Style/ArrayCoercion:
3079
3452
  Enabled: false
3080
3453
  VersionAdded: '0.88'
3081
3454
 
3455
+ Style/ArrayFirstLast:
3456
+ Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3457
+ StyleGuide: '#first-and-last'
3458
+ References:
3459
+ - '#first-and-last'
3460
+ Enabled: false
3461
+ VersionAdded: '1.58'
3462
+ Safe: false
3463
+
3082
3464
  Style/ArrayIntersect:
3083
3465
  Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
3084
3466
  Enabled: 'pending'
3085
3467
  Safe: false
3086
3468
  VersionAdded: '1.40'
3087
3469
 
3470
+ Style/ArrayIntersectWithSingleElement:
3471
+ Description: 'Use `include?(element)` instead of `intersect?([element])`.'
3472
+ Enabled: 'pending'
3473
+ Safe: false
3474
+ VersionAdded: '1.81'
3475
+
3088
3476
  Style/ArrayJoin:
3089
3477
  Description: 'Use Array#join instead of Array#*.'
3090
3478
  StyleGuide: '#array-join'
@@ -3136,6 +3524,13 @@ Style/BisectedAttrAccessor:
3136
3524
  Enabled: true
3137
3525
  VersionAdded: '0.87'
3138
3526
 
3527
+ Style/BitwisePredicate:
3528
+ Description: 'Prefer bitwise predicate methods over direct comparison operations.'
3529
+ StyleGuide: '#bitwise-predicate-methods'
3530
+ Enabled: pending
3531
+ Safe: false
3532
+ VersionAdded: '1.68'
3533
+
3139
3534
  Style/BlockComments:
3140
3535
  Description: 'Do not use block comments.'
3141
3536
  StyleGuide: '#no-block-comments'
@@ -3255,9 +3650,11 @@ Style/BlockDelimiters:
3255
3650
  BracesRequiredMethods: []
3256
3651
 
3257
3652
  Style/CaseEquality:
3258
- Description: 'Avoid explicit use of the case equality operator(===).'
3653
+ Description: 'Avoid explicit use of the case equality operator (`===`).'
3259
3654
  StyleGuide: '#no-case-equality'
3260
3655
  Enabled: true
3656
+ References:
3657
+ - 'https://docs.rubocop.org/rubocop-performance/cops_performance.html#performanceregexpmatch'
3261
3658
  VersionAdded: '0.9'
3262
3659
  VersionChanged: '0.89'
3263
3660
  # If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
@@ -3300,12 +3697,14 @@ Style/ClassAndModuleChildren:
3300
3697
  StyleGuide: '#namespace-definition'
3301
3698
  # Moving from compact to nested children requires knowledge of whether the
3302
3699
  # outer parent is a module or a class. Moving from nested to compact requires
3303
- # verification that the outer parent is defined elsewhere. RuboCop does not
3304
- # have the knowledge to perform either operation safely and thus requires
3305
- # manual oversight.
3700
+ # verification that the outer parent is defined elsewhere. By default RuboCop
3701
+ # does not have the knowledge to perform either operation safely and thus
3702
+ # requires manual oversight. When `AllCops/UseProjectIndex` is enabled, the
3703
+ # project-wide index is consulted for both operations.
3306
3704
  SafeAutoCorrect: false
3307
3705
  Enabled: true
3308
3706
  VersionAdded: '0.19'
3707
+ VersionChanged: '1.89'
3309
3708
  #
3310
3709
  # Basically there are two different styles:
3311
3710
  #
@@ -3321,7 +3720,21 @@ Style/ClassAndModuleChildren:
3321
3720
  #
3322
3721
  # The compact style is only forced, for classes or modules with one child.
3323
3722
  EnforcedStyle: nested
3324
- SupportedStyles:
3723
+ SupportedStyles: &supported_styles
3724
+ - nested
3725
+ - compact
3726
+ # Configure classes separately, if desired. If not set, or set to `nil`,
3727
+ # the `EnforcedStyle` value will be used.
3728
+ EnforcedStyleForClasses: ~
3729
+ SupportedStylesForClasses:
3730
+ - ~
3731
+ - nested
3732
+ - compact
3733
+ # Configure modules separately, if desired. If not set, or set to `nil`,
3734
+ # the `EnforcedStyle` value will be used.
3735
+ EnforcedStyleForModules: ~
3736
+ SupportedStylesForModules:
3737
+ - ~
3325
3738
  - nested
3326
3739
  - compact
3327
3740
 
@@ -3339,7 +3752,9 @@ Style/ClassEqualityComparison:
3339
3752
  Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3340
3753
  StyleGuide: '#instance-of-vs-class-comparison'
3341
3754
  Enabled: true
3755
+ SafeAutoCorrect: false
3342
3756
  VersionAdded: '0.93'
3757
+ VersionChanged: '1.57'
3343
3758
  AllowedMethods:
3344
3759
  - ==
3345
3760
  - equal?
@@ -3379,7 +3794,7 @@ Style/CollectionCompact:
3379
3794
 
3380
3795
  # Align with the style guide.
3381
3796
  Style/CollectionMethods:
3382
- Description: 'Preferred collection methods.'
3797
+ Description: 'Enforces the use of consistent method names from the `Enumerable` module.'
3383
3798
  StyleGuide: '#map-find-select-reduce-include-size'
3384
3799
  Enabled: false
3385
3800
  VersionAdded: '0.9'
@@ -3394,6 +3809,7 @@ Style/CollectionMethods:
3394
3809
  PreferredMethods:
3395
3810
  collect: 'map'
3396
3811
  collect!: 'map!'
3812
+ collect_concat: 'flat_map'
3397
3813
  inject: 'reduce'
3398
3814
  detect: 'find'
3399
3815
  find_all: 'select'
@@ -3404,6 +3820,13 @@ Style/CollectionMethods:
3404
3820
  - inject
3405
3821
  - reduce
3406
3822
 
3823
+ Style/CollectionQuerying:
3824
+ Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
3825
+ StyleGuide: '#collection-querying'
3826
+ Enabled: pending
3827
+ VersionAdded: '1.77'
3828
+ Safe: false
3829
+
3407
3830
  Style/ColonMethodCall:
3408
3831
  Description: 'Do not use :: for method call.'
3409
3832
  StyleGuide: '#double-colons'
@@ -3416,6 +3839,11 @@ Style/ColonMethodDefinition:
3416
3839
  Enabled: true
3417
3840
  VersionAdded: '0.52'
3418
3841
 
3842
+ Style/CombinableDefined:
3843
+ Description: 'Checks successive `defined?` calls that can be combined into a single call.'
3844
+ Enabled: pending
3845
+ VersionAdded: '1.68'
3846
+
3419
3847
  Style/CombinableLoops:
3420
3848
  Description: >-
3421
3849
  Checks for places where multiple consecutive loops over the same data
@@ -3466,6 +3894,14 @@ Style/CommentedKeyword:
3466
3894
  VersionAdded: '0.51'
3467
3895
  VersionChanged: '1.19'
3468
3896
 
3897
+ Style/ComparableBetween:
3898
+ Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
3899
+ StyleGuide: '#ranges-or-between'
3900
+ Enabled: pending
3901
+ Safe: false
3902
+ VersionAdded: '1.74'
3903
+ VersionChanged: '1.75'
3904
+
3469
3905
  Style/ComparableClamp:
3470
3906
  Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3471
3907
  Enabled: pending
@@ -3482,6 +3918,7 @@ Style/ConditionalAssignment:
3482
3918
  Use the return value of `if` and `case` statements for
3483
3919
  assignment to a variable and variable comparison instead
3484
3920
  of assigning that variable inside of each branch.
3921
+ StyleGuide: '#use-if-case-returns'
3485
3922
  Enabled: true
3486
3923
  VersionAdded: '0.36'
3487
3924
  VersionChanged: '0.47'
@@ -3542,7 +3979,7 @@ Style/DataInheritance:
3542
3979
 
3543
3980
  Style/DateTime:
3544
3981
  Description: 'Use Time over DateTime.'
3545
- StyleGuide: '#date-time'
3982
+ StyleGuide: '#no-datetime'
3546
3983
  Enabled: false
3547
3984
  VersionAdded: '0.51'
3548
3985
  VersionChanged: '0.92'
@@ -3556,6 +3993,12 @@ Style/DefWithParentheses:
3556
3993
  VersionAdded: '0.9'
3557
3994
  VersionChanged: '0.12'
3558
3995
 
3996
+ Style/DigChain:
3997
+ Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
3998
+ Enabled: pending
3999
+ Safe: false
4000
+ VersionAdded: '1.69'
4001
+
3559
4002
  Style/Dir:
3560
4003
  Description: >-
3561
4004
  Use the `__dir__` method to retrieve the canonicalized
@@ -3569,13 +4012,23 @@ Style/DirEmpty:
3569
4012
  Enabled: pending
3570
4013
  VersionAdded: '1.48'
3571
4014
 
4015
+ Style/DirectiveScope:
4016
+ Description: >-
4017
+ Checks for directive scopes that can be expressed with the
4018
+ tighter `disable-next` form.
4019
+ Enabled: pending
4020
+ SafeAutoCorrect: false
4021
+ VersionAdded: '1.90'
4022
+
3572
4023
  Style/DisableCopsWithinSourceCodeDirective:
3573
4024
  Description: >-
3574
4025
  Forbids disabling/enabling cops within source code.
3575
4026
  Enabled: false
3576
4027
  VersionAdded: '0.82'
3577
- VersionChanged: '1.9'
4028
+ VersionChanged: '1.90'
3578
4029
  AllowedCops: []
4030
+ DisallowedCops: []
4031
+ AllowTrailingComment: false
3579
4032
 
3580
4033
  Style/DocumentDynamicEvalDefinition:
3581
4034
  Description: >-
@@ -3590,6 +4043,7 @@ Style/Documentation:
3590
4043
  Description: 'Document classes and non-namespace modules.'
3591
4044
  Enabled: true
3592
4045
  VersionAdded: '0.9'
4046
+ VersionChanged: '1.89'
3593
4047
  AllowedConstants: []
3594
4048
  Exclude:
3595
4049
  - 'spec/**/*'
@@ -3599,6 +4053,7 @@ Style/DocumentationMethod:
3599
4053
  Description: 'Checks for missing documentation comment for public methods.'
3600
4054
  Enabled: false
3601
4055
  VersionAdded: '0.43'
4056
+ AllowedMethods: []
3602
4057
  Exclude:
3603
4058
  - 'spec/**/*'
3604
4059
  - 'test/**/*'
@@ -3644,11 +4099,25 @@ Style/EmptyCaseCondition:
3644
4099
  Enabled: true
3645
4100
  VersionAdded: '0.40'
3646
4101
 
4102
+ Style/EmptyClassDefinition:
4103
+ Description: 'Enforces consistent style for empty class definitions.'
4104
+ StyleGuide: '#single-line-classes'
4105
+ Enabled: pending
4106
+ VersionAdded: '1.84'
4107
+ VersionChanged: '1.86'
4108
+ EnforcedStyle: class_keyword
4109
+ SupportedStyles:
4110
+ - class_keyword
4111
+ - class_new
4112
+ - class_definition # Deprecated.
4113
+ AllowedParentClasses: []
4114
+
3647
4115
  Style/EmptyElse:
3648
4116
  Description: 'Avoid empty else-clauses.'
3649
4117
  Enabled: true
4118
+ AutoCorrect: contextual
3650
4119
  VersionAdded: '0.28'
3651
- VersionChanged: '0.32'
4120
+ VersionChanged: '1.61'
3652
4121
  EnforcedStyle: both
3653
4122
  # empty - warn only on empty `else`
3654
4123
  # nil - warn on `else` with nil in it
@@ -3662,7 +4131,9 @@ Style/EmptyElse:
3662
4131
  Style/EmptyHeredoc:
3663
4132
  Description: 'Checks for using empty heredoc to reduce redundancy.'
3664
4133
  Enabled: pending
4134
+ AutoCorrect: contextual
3665
4135
  VersionAdded: '1.32'
4136
+ VersionChanged: '1.61'
3666
4137
 
3667
4138
  Style/EmptyLambdaParameter:
3668
4139
  Description: 'Omit parens for empty lambda parameters.'
@@ -3680,12 +4151,24 @@ Style/EmptyMethod:
3680
4151
  Description: 'Checks the formatting of empty method definitions.'
3681
4152
  StyleGuide: '#no-single-line-methods'
3682
4153
  Enabled: true
4154
+ AutoCorrect: contextual
3683
4155
  VersionAdded: '0.46'
4156
+ VersionChanged: '1.61'
3684
4157
  EnforcedStyle: compact
3685
4158
  SupportedStyles:
3686
4159
  - compact
3687
4160
  - expanded
3688
4161
 
4162
+ Style/EmptyStringInsideInterpolation:
4163
+ Description: 'Checks for empty strings being assigned inside string interpolation.'
4164
+ StyleGuide: '#empty-strings-in-interpolation'
4165
+ Enabled: pending
4166
+ EnforcedStyle: trailing_conditional
4167
+ SupportedStyles:
4168
+ - trailing_conditional
4169
+ - ternary
4170
+ VersionAdded: '1.76'
4171
+
3689
4172
  Style/Encoding:
3690
4173
  Description: 'Use UTF-8 as the source file encoding.'
3691
4174
  StyleGuide: '#utf-8'
@@ -3710,6 +4193,8 @@ Style/EndlessMethod:
3710
4193
  - allow_single_line
3711
4194
  - allow_always
3712
4195
  - disallow
4196
+ - require_single_line
4197
+ - require_always
3713
4198
 
3714
4199
  Style/EnvHome:
3715
4200
  Description: "Checks for consistent usage of `ENV['HOME']`."
@@ -3749,7 +4234,7 @@ Style/ExplicitBlockArgument:
3749
4234
  VersionChanged: '1.8'
3750
4235
 
3751
4236
  Style/ExponentialNotation:
3752
- Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
4237
+ Description: 'Enforces consistency in the use of exponential (scientific) notation.'
3753
4238
  StyleGuide: '#exponential-notation'
3754
4239
  Enabled: true
3755
4240
  VersionAdded: '0.82'
@@ -3762,12 +4247,16 @@ Style/ExponentialNotation:
3762
4247
  Style/FetchEnvVar:
3763
4248
  Description: >-
3764
4249
  Suggests `ENV.fetch` for the replacement of `ENV[]`.
3765
- Reference:
4250
+ References:
3766
4251
  - https://rubystyle.guide/#hash-fetch-defaults
3767
4252
  Enabled: pending
3768
4253
  VersionAdded: '1.28'
4254
+ VersionChanged: '1.88'
3769
4255
  # Environment variables to be excluded from the inspection.
3770
- AllowedVars: []
4256
+ AllowedVariables: []
4257
+ # When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
4258
+ # When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
4259
+ DefaultToNil: true
3771
4260
 
3772
4261
  Style/FileEmpty:
3773
4262
  Description: >-
@@ -3776,12 +4265,32 @@ Style/FileEmpty:
3776
4265
  Safe: false
3777
4266
  VersionAdded: '1.48'
3778
4267
 
4268
+ Style/FileNull:
4269
+ Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
4270
+ StyleGuide: '#null-devices'
4271
+ Enabled: pending
4272
+ SafeAutoCorrect: false
4273
+ VersionAdded: '1.69'
4274
+
4275
+ Style/FileOpen:
4276
+ Description: 'Checks for `File.open` without a block, which can leak file descriptors.'
4277
+ StyleGuide: '#auto-release-resources'
4278
+ Enabled: pending
4279
+ Safe: false
4280
+ VersionAdded: '1.85'
4281
+
3779
4282
  Style/FileRead:
3780
4283
  Description: 'Favor `File.(bin)read` convenience methods.'
3781
4284
  StyleGuide: '#file-read'
3782
4285
  Enabled: pending
3783
4286
  VersionAdded: '1.24'
3784
4287
 
4288
+ Style/FileTouch:
4289
+ Description: 'Favor `FileUtils.touch` for touching files.'
4290
+ Enabled: pending
4291
+ VersionAdded: '1.69'
4292
+ SafeAutoCorrect: false
4293
+
3785
4294
  Style/FileWrite:
3786
4295
  Description: 'Favor `File.(bin)write` convenience methods.'
3787
4296
  StyleGuide: '#file-write'
@@ -3791,7 +4300,8 @@ Style/FileWrite:
3791
4300
  Style/FloatDivision:
3792
4301
  Description: 'For performing float division, coerce one side only.'
3793
4302
  StyleGuide: '#float-division'
3794
- Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
4303
+ References:
4304
+ - 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3795
4305
  Enabled: true
3796
4306
  VersionAdded: '0.72'
3797
4307
  VersionChanged: '1.9'
@@ -3829,7 +4339,10 @@ Style/FormatString:
3829
4339
 
3830
4340
  Style/FormatStringToken:
3831
4341
  Description: 'Use a consistent style for format string tokens.'
4342
+ StyleGuide: '#named-format-tokens'
3832
4343
  Enabled: true
4344
+ VersionAdded: '0.49'
4345
+ VersionChanged: '1.74'
3833
4346
  EnforcedStyle: annotated
3834
4347
  SupportedStyles:
3835
4348
  # Prefer tokens which contain a sprintf like type annotation like
@@ -3842,8 +4355,12 @@ Style/FormatStringToken:
3842
4355
  # style token in a format string to be allowed when enforced style is not
3843
4356
  # `unannotated`.
3844
4357
  MaxUnannotatedPlaceholdersAllowed: 1
3845
- VersionAdded: '0.49'
3846
- VersionChanged: '1.0'
4358
+ # The mode the cop operates in. Two values are allowed:
4359
+ # * aggressive (default): all strings are considered
4360
+ # * conservative:
4361
+ # only register offenses for strings given to `printf`, `sprintf`,
4362
+ # format` and `%` methods. Other strings are not considered.
4363
+ Mode: aggressive
3847
4364
  AllowedMethods: []
3848
4365
  AllowedPatterns: []
3849
4366
 
@@ -3868,6 +4385,9 @@ Style/FrozenStringLiteralComment:
3868
4385
  # exist in a file.
3869
4386
  - never
3870
4387
  SafeAutoCorrect: false
4388
+ Exclude:
4389
+ # Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
4390
+ - '**/*.arb'
3871
4391
 
3872
4392
  Style/GlobalStdStream:
3873
4393
  Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
@@ -3879,14 +4399,15 @@ Style/GlobalStdStream:
3879
4399
  Style/GlobalVars:
3880
4400
  Description: 'Do not introduce global variables.'
3881
4401
  StyleGuide: '#instance-vars'
3882
- Reference: 'https://www.zenspider.com/ruby/quickref.html'
4402
+ References:
4403
+ - 'https://www.zenspider.com/ruby/quickref.html'
3883
4404
  Enabled: true
3884
4405
  VersionAdded: '0.13'
3885
4406
  # Built-in global variables are allowed by default.
3886
4407
  AllowedVariables: []
3887
4408
 
3888
4409
  Style/GuardClause:
3889
- Description: 'Check for conditionals that can be replaced with guard clauses.'
4410
+ Description: 'Checks for conditionals that can be replaced with guard clauses.'
3890
4411
  StyleGuide: '#no-nested-conditionals'
3891
4412
  Enabled: true
3892
4413
  VersionAdded: '0.20'
@@ -3912,8 +4433,9 @@ Style/HashConversion:
3912
4433
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3913
4434
  StyleGuide: '#avoid-hash-constructor'
3914
4435
  Enabled: pending
4436
+ SafeAutoCorrect: false
3915
4437
  VersionAdded: '1.10'
3916
- VersionChanged: '1.11'
4438
+ VersionChanged: '1.55'
3917
4439
  AllowSplatArgument: true
3918
4440
 
3919
4441
  Style/HashEachMethods:
@@ -3935,6 +4457,12 @@ Style/HashExcept:
3935
4457
  VersionAdded: '1.7'
3936
4458
  VersionChanged: '1.39'
3937
4459
 
4460
+ Style/HashFetchChain:
4461
+ Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
4462
+ Enabled: pending
4463
+ Safe: false
4464
+ VersionAdded: '1.75'
4465
+
3938
4466
  Style/HashLikeCase:
3939
4467
  Description: >-
3940
4468
  Checks for places where `case-when` represents a simple 1:1
@@ -3945,6 +4473,24 @@ Style/HashLikeCase:
3945
4473
  # to trigger this cop
3946
4474
  MinBranchesCount: 3
3947
4475
 
4476
+ Style/HashLookupMethod:
4477
+ Description: 'Enforces the use of either `Hash#[]` or `Hash#fetch` for hash lookup.'
4478
+ Enabled: false
4479
+ Safe: false
4480
+ VersionAdded: '1.84'
4481
+ EnforcedStyle: brackets
4482
+ SupportedStyles:
4483
+ - brackets
4484
+ - fetch
4485
+
4486
+ Style/HashSlice:
4487
+ Description: >-
4488
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
4489
+ that can be replaced with `Hash#slice` method.
4490
+ Enabled: pending
4491
+ Safe: false
4492
+ VersionAdded: '1.71'
4493
+
3948
4494
  Style/HashSyntax:
3949
4495
  Description: >-
3950
4496
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -3952,7 +4498,7 @@ Style/HashSyntax:
3952
4498
  StyleGuide: '#hash-literals'
3953
4499
  Enabled: true
3954
4500
  VersionAdded: '0.9'
3955
- VersionChanged: '1.24'
4501
+ VersionChanged: '1.67'
3956
4502
  EnforcedStyle: ruby19
3957
4503
  SupportedStyles:
3958
4504
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -3964,7 +4510,7 @@ Style/HashSyntax:
3964
4510
  # enforces both ruby19 and no_mixed_keys styles
3965
4511
  - ruby19_no_mixed_keys
3966
4512
  # Force hashes that have a hash value omission
3967
- EnforcedShorthandSyntax: always
4513
+ EnforcedShorthandSyntax: either
3968
4514
  SupportedShorthandSyntax:
3969
4515
  # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3970
4516
  - always
@@ -3974,6 +4520,8 @@ Style/HashSyntax:
3974
4520
  - either
3975
4521
  # forces use of the 3.1 syntax only if all values can be omitted in the hash.
3976
4522
  - consistent
4523
+ # allow either (implicit or explicit) syntax but enforce consistency within a single hash
4524
+ - either_consistent
3977
4525
  # Force hashes that have a symbol value to use hash rockets
3978
4526
  UseHashRocketsWithSymbolValues: false
3979
4527
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3981,6 +4529,7 @@ Style/HashSyntax:
3981
4529
 
3982
4530
  Style/HashTransformKeys:
3983
4531
  Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
4532
+ StyleGuide: '#hash-transform-methods'
3984
4533
  Enabled: true
3985
4534
  VersionAdded: '0.80'
3986
4535
  VersionChanged: '0.90'
@@ -3988,6 +4537,7 @@ Style/HashTransformKeys:
3988
4537
 
3989
4538
  Style/HashTransformValues:
3990
4539
  Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
4540
+ StyleGuide: '#hash-transform-methods'
3991
4541
  Enabled: true
3992
4542
  VersionAdded: '0.80'
3993
4543
  VersionChanged: '0.90'
@@ -4006,9 +4556,9 @@ Style/IdenticalConditionalBranches:
4006
4556
  Style/IfInsideElse:
4007
4557
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
4008
4558
  Enabled: true
4009
- AllowIfModifier: false
4010
4559
  VersionAdded: '0.36'
4011
4560
  VersionChanged: '1.3'
4561
+ AllowIfModifier: false
4012
4562
 
4013
4563
  Style/IfUnlessModifier:
4014
4564
  Description: >-
@@ -4032,6 +4582,7 @@ Style/IfWithBooleanLiteralBranches:
4032
4582
  VersionAdded: '1.9'
4033
4583
  SafeAutoCorrect: false
4034
4584
  AllowedMethods:
4585
+ - infinite?
4035
4586
  - nonzero?
4036
4587
 
4037
4588
  Style/IfWithSemicolon:
@@ -4114,12 +4665,6 @@ Style/InvertibleUnlessCondition:
4114
4665
  :none?: :any?
4115
4666
  :even?: :odd?
4116
4667
  :odd?: :even?
4117
- # `ActiveSupport` defines some common inverse methods. They are listed below,
4118
- # and not enabled by default.
4119
- # :present?: :blank?
4120
- # :blank?: :present?
4121
- # :include?: :exclude?
4122
- # :exclude?: :include?
4123
4668
 
4124
4669
  Style/IpAddresses:
4125
4670
  Description: "Don't include literal IP addresses in code."
@@ -4136,9 +4681,34 @@ Style/IpAddresses:
4136
4681
  - '**/gems.rb'
4137
4682
  - '**/*.gemspec'
4138
4683
 
4684
+ Style/ItAssignment:
4685
+ Description: 'Checks for local variables and method parameters named `it`.'
4686
+ Enabled: pending
4687
+ VersionAdded: '1.70'
4688
+
4689
+ Style/ItBlockParameter:
4690
+ Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
4691
+ Enabled: pending
4692
+ VersionAdded: '1.75'
4693
+ VersionChanged: '1.76'
4694
+ EnforcedStyle: allow_single_line
4695
+ SupportedStyles:
4696
+ - allow_single_line
4697
+ - only_numbered_parameters
4698
+ - always
4699
+ - disallow
4700
+
4701
+ Style/KeywordArgumentsMerging:
4702
+ Description: >-
4703
+ When passing an existing hash as keyword arguments, provide additional arguments
4704
+ directly rather than using `merge`.
4705
+ StyleGuide: '#merging-keyword-arguments'
4706
+ Enabled: pending
4707
+ VersionAdded: '1.68'
4708
+
4139
4709
  Style/KeywordParametersOrder:
4140
4710
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
4141
- StyleGuide: '#keyword-parameters-order'
4711
+ StyleGuide: '#keyword-arguments-order'
4142
4712
  Enabled: true
4143
4713
  VersionAdded: '0.90'
4144
4714
  VersionChanged: '1.7'
@@ -4159,8 +4729,9 @@ Style/LambdaCall:
4159
4729
  Description: 'Use lambda.call(...) instead of lambda.(...).'
4160
4730
  StyleGuide: '#proc-call'
4161
4731
  Enabled: true
4732
+ AutoCorrect: contextual
4162
4733
  VersionAdded: '0.13'
4163
- VersionChanged: '0.14'
4734
+ VersionChanged: '1.81'
4164
4735
  EnforcedStyle: call
4165
4736
  SupportedStyles:
4166
4737
  - call
@@ -4170,6 +4741,7 @@ Style/LineEndConcatenation:
4170
4741
  Description: >-
4171
4742
  Use \ instead of + or << to concatenate two string literals at
4172
4743
  line end.
4744
+ StyleGuide: '#heredoc-long-strings'
4173
4745
  Enabled: true
4174
4746
  SafeAutoCorrect: false
4175
4747
  VersionAdded: '0.18'
@@ -4198,7 +4770,23 @@ Style/MagicCommentFormat:
4198
4770
  Style/MapCompactWithConditionalBlock:
4199
4771
  Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
4200
4772
  Enabled: pending
4773
+ SafeAutoCorrect: false
4201
4774
  VersionAdded: '1.30'
4775
+ VersionChanged: '1.88'
4776
+
4777
+ Style/MapIntoArray:
4778
+ Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
4779
+ StyleGuide: '#functional-code'
4780
+ Enabled: pending
4781
+ VersionAdded: '1.63'
4782
+ VersionChanged: '1.67'
4783
+ Safe: false
4784
+
4785
+ Style/MapJoin:
4786
+ Description: 'Checks for redundant `map(&:to_s)` before `join`.'
4787
+ Enabled: pending
4788
+ Safe: false
4789
+ VersionAdded: '1.85'
4202
4790
 
4203
4791
  Style/MapToHash:
4204
4792
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
@@ -4222,6 +4810,7 @@ Style/MethodCallWithArgsParentheses:
4222
4810
  AllowedMethods: []
4223
4811
  AllowedPatterns: []
4224
4812
  IncludedMacros: []
4813
+ IncludedMacroPatterns: []
4225
4814
  AllowParenthesesInMultilineCall: false
4226
4815
  AllowParenthesesInChaining: false
4227
4816
  AllowParenthesesInCamelCaseMethod: false
@@ -4235,10 +4824,10 @@ Style/MethodCallWithoutArgsParentheses:
4235
4824
  Description: 'Do not use parentheses for method calls with no arguments.'
4236
4825
  StyleGuide: '#method-invocation-parens'
4237
4826
  Enabled: true
4238
- AllowedMethods: []
4239
- AllowedPatterns: []
4240
4827
  VersionAdded: '0.47'
4241
4828
  VersionChanged: '0.55'
4829
+ AllowedMethods: []
4830
+ AllowedPatterns: []
4242
4831
 
4243
4832
  Style/MethodCalledOnDoEndBlock:
4244
4833
  Description: 'Avoid chaining a method call on a do...end block.'
@@ -4299,6 +4888,7 @@ Style/MissingRespondToMissing:
4299
4888
  StyleGuide: '#no-method-missing'
4300
4889
  Enabled: true
4301
4890
  VersionAdded: '0.56'
4891
+ VersionChanged: '1.89'
4302
4892
 
4303
4893
  Style/MixinGrouping:
4304
4894
  Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
@@ -4332,6 +4922,11 @@ Style/ModuleFunction:
4332
4922
  Autocorrect: false
4333
4923
  SafeAutoCorrect: false
4334
4924
 
4925
+ Style/ModuleMemberExistenceCheck:
4926
+ Description: 'Checks for usage of `Module` methods returning arrays that can be replaced with equivalent predicates.'
4927
+ Enabled: pending
4928
+ VersionAdded: '1.82'
4929
+
4335
4930
  Style/MultilineBlockChain:
4336
4931
  Description: 'Avoid multi-line chains of blocks.'
4337
4932
  StyleGuide: '#single-line-blocks'
@@ -4339,7 +4934,7 @@ Style/MultilineBlockChain:
4339
4934
  VersionAdded: '0.13'
4340
4935
 
4341
4936
  Style/MultilineIfModifier:
4342
- Description: 'Only use if/unless modifiers on single line statements.'
4937
+ Description: 'Checks for uses of `if`/`unless` modifiers with multiline bodies.'
4343
4938
  StyleGuide: '#no-multiline-if-modifiers'
4344
4939
  Enabled: true
4345
4940
  VersionAdded: '0.45'
@@ -4402,7 +4997,7 @@ Style/MutableConstant:
4402
4997
  Description: 'Do not assign mutable objects to constants.'
4403
4998
  Enabled: true
4404
4999
  VersionAdded: '0.34'
4405
- VersionChanged: '1.8'
5000
+ VersionChanged: '1.88'
4406
5001
  SafeAutoCorrect: false
4407
5002
  EnforcedStyle: literals
4408
5003
  SupportedStyles:
@@ -4414,6 +5009,9 @@ Style/MutableConstant:
4414
5009
  # no harm in freezing an already frozen object.
4415
5010
  - literals
4416
5011
  - strict
5012
+ # When `true`, recursively check and freeze mutable literals nested inside
5013
+ # arrays and hashes (e.g. `[{a: []}]` becomes `[{a: [].freeze}.freeze].freeze`).
5014
+ Recursive: false
4417
5015
 
4418
5016
  Style/NegatedIf:
4419
5017
  Description: >-
@@ -4441,7 +5039,7 @@ Style/NegatedIfElseCondition:
4441
5039
 
4442
5040
  Style/NegatedUnless:
4443
5041
  Description: 'Favor if over unless for negative conditions.'
4444
- StyleGuide: '#if-for-negatives'
5042
+ StyleGuide: '#unless-for-negatives'
4445
5043
  Enabled: true
4446
5044
  VersionAdded: '0.69'
4447
5045
  EnforcedStyle: both
@@ -4459,6 +5057,14 @@ Style/NegatedWhile:
4459
5057
  Enabled: true
4460
5058
  VersionAdded: '0.20'
4461
5059
 
5060
+ Style/NegativeArrayIndex:
5061
+ Description: >-
5062
+ Use negative array indices instead of calculating array length minus a value.
5063
+ Also handles range patterns with length calculations. Recognizes preserving methods
5064
+ and their combinations, allowing safe replacement when the receiver matches.
5065
+ Enabled: pending
5066
+ VersionAdded: '1.84'
5067
+
4462
5068
  Style/NestedFileDirname:
4463
5069
  Description: 'Checks for nested `File.dirname`.'
4464
5070
  Enabled: pending
@@ -4508,7 +5114,7 @@ Style/Next:
4508
5114
  StyleGuide: '#no-nested-conditionals'
4509
5115
  Enabled: true
4510
5116
  VersionAdded: '0.22'
4511
- VersionChanged: '0.35'
5117
+ VersionChanged: '1.75'
4512
5118
  # With `always` all conditions at the end of an iteration needs to be
4513
5119
  # replaced by next - with `skip_modifier_ifs` the modifier if like this one
4514
5120
  # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
@@ -4516,6 +5122,7 @@ Style/Next:
4516
5122
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
4517
5123
  # needs to have to trigger this cop
4518
5124
  MinBodyLength: 3
5125
+ AllowConsecutiveConditionals: false
4519
5126
  SupportedStyles:
4520
5127
  - skip_modifier_ifs
4521
5128
  - always
@@ -4633,22 +5240,33 @@ Style/ObjectThen:
4633
5240
  - then
4634
5241
  - yield_self
4635
5242
 
5243
+ Style/OneClassPerFile:
5244
+ Description: 'Checks that each source file defines at most one top-level class or module.'
5245
+ StyleGuide: '#one-class-per-file'
5246
+ Enabled: pending
5247
+ VersionAdded: '1.85'
5248
+ VersionChanged: '1.86'
5249
+ AllowedClasses: []
5250
+ Exclude:
5251
+ - 'spec/**/*'
5252
+ - 'test/**/*'
5253
+
4636
5254
  Style/OneLineConditional:
4637
5255
  Description: >-
4638
5256
  Favor the ternary operator (?:) or multi-line constructs over
4639
5257
  single-line if/then/else/end constructs.
4640
5258
  StyleGuide: '#ternary-operator'
4641
5259
  Enabled: true
4642
- AlwaysCorrectToMultiline: false
4643
5260
  VersionAdded: '0.9'
4644
5261
  VersionChanged: '0.90'
5262
+ AlwaysCorrectToMultiline: false
4645
5263
 
4646
5264
  Style/OpenStructUse:
4647
5265
  Description: >-
4648
5266
  Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4649
5267
  version compatibility, and potential security issues.
4650
- Reference:
4651
- - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
5268
+ References:
5269
+ - https://docs.ruby-lang.org/en/3.0/OpenStruct.html#class-OpenStruct-label-Caveats
4652
5270
 
4653
5271
  Enabled: pending
4654
5272
  Safe: false
@@ -4663,6 +5281,7 @@ Style/OperatorMethodCall:
4663
5281
 
4664
5282
  Style/OptionHash:
4665
5283
  Description: "Don't use option hashes when you can use keyword arguments."
5284
+ StyleGuide: '#keyword-arguments-vs-option-hashes'
4666
5285
  Enabled: false
4667
5286
  VersionAdded: '0.33'
4668
5287
  VersionChanged: '0.34'
@@ -4720,11 +5339,20 @@ Style/ParenthesesAroundCondition:
4720
5339
  AllowSafeAssignment: true
4721
5340
  AllowInMultilineConditions: false
4722
5341
 
5342
+ Style/PartitionInsteadOfDoubleSelect:
5343
+ Description: >-
5344
+ Checks for consecutive `select`/`filter`/`find_all` and `reject` calls
5345
+ on the same receiver with the same block body.
5346
+ Enabled: pending
5347
+ Safe: false
5348
+ VersionAdded: '1.85'
5349
+
4723
5350
  Style/PercentLiteralDelimiters:
4724
5351
  Description: 'Use `%`-literal delimiters consistently.'
4725
5352
  StyleGuide: '#percent-literal-braces'
4726
5353
  Enabled: true
4727
5354
  VersionAdded: '0.19'
5355
+ VersionChanged: '0.48'
4728
5356
  # Specify the default preferred delimiter for all types with the 'default' key
4729
5357
  # Override individual delimiters (even with default specified) by specifying
4730
5358
  # an individual key
@@ -4735,7 +5363,6 @@ Style/PercentLiteralDelimiters:
4735
5363
  '%r': '{}'
4736
5364
  '%w': '[]'
4737
5365
  '%W': '[]'
4738
- VersionChanged: '0.48'
4739
5366
 
4740
5367
  Style/PercentQLiterals:
4741
5368
  Description: 'Checks if uses of %Q/%q match the configured preference.'
@@ -4752,6 +5379,12 @@ Style/PerlBackrefs:
4752
5379
  Enabled: true
4753
5380
  VersionAdded: '0.13'
4754
5381
 
5382
+ Style/PredicateWithKind:
5383
+ Description: 'Prefer `any?(Klass)` to `any? { |x| x.is_a?(Klass) }`.'
5384
+ Enabled: pending
5385
+ SafeAutoCorrect: false
5386
+ VersionAdded: '1.85'
5387
+
4755
5388
  Style/PreferredHashMethods:
4756
5389
  Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
4757
5390
  StyleGuide: '#hash-key'
@@ -4785,8 +5418,9 @@ Style/RaiseArgs:
4785
5418
  Description: 'Checks the arguments passed to raise/fail.'
4786
5419
  StyleGuide: '#exception-class-messages'
4787
5420
  Enabled: true
5421
+ Safe: false
4788
5422
  VersionAdded: '0.14'
4789
- VersionChanged: '1.2'
5423
+ VersionChanged: '1.61'
4790
5424
  EnforcedStyle: exploded
4791
5425
  SupportedStyles:
4792
5426
  - compact # raise Exception.new(msg)
@@ -4801,17 +5435,29 @@ Style/RandomWithOffset:
4801
5435
  Enabled: true
4802
5436
  VersionAdded: '0.52'
4803
5437
 
5438
+ Style/ReduceToHash:
5439
+ Description: 'Use `to_h { ... }` instead of `each_with_object`, `inject`, or `reduce` to build a hash.'
5440
+ Enabled: pending
5441
+ Safe: false
5442
+ VersionAdded: '1.85'
5443
+
4804
5444
  Style/RedundantArgument:
4805
- Description: 'Check for a redundant argument passed to certain methods.'
5445
+ Description: 'Checks for a redundant argument passed to certain methods.'
4806
5446
  Enabled: pending
4807
5447
  Safe: false
4808
5448
  VersionAdded: '1.4'
4809
- VersionChanged: '1.40'
5449
+ VersionChanged: '1.55'
4810
5450
  Methods:
4811
5451
  # Array#join
4812
5452
  join: ''
4813
5453
  # Array#sum
4814
5454
  sum: 0
5455
+ # Kernel.#exit
5456
+ exit: true
5457
+ # Kernel.#exit!
5458
+ exit!: false
5459
+ # String#to_i
5460
+ to_i: 10
4815
5461
  # String#split
4816
5462
  split: ' '
4817
5463
  # String#chomp
@@ -4824,6 +5470,12 @@ Style/RedundantArrayConstructor:
4824
5470
  Enabled: pending
4825
5471
  VersionAdded: '1.52'
4826
5472
 
5473
+ Style/RedundantArrayFlatten:
5474
+ Description: 'Checks for redundant calls of `Array#flatten`.'
5475
+ Enabled: pending
5476
+ Safe: false
5477
+ VersionAdded: '1.76'
5478
+
4827
5479
  Style/RedundantAssignment:
4828
5480
  Description: 'Checks for redundant assignment before returning.'
4829
5481
  Enabled: true
@@ -4845,6 +5497,10 @@ Style/RedundantCondition:
4845
5497
  Description: 'Checks for unnecessary conditional expressions.'
4846
5498
  Enabled: true
4847
5499
  VersionAdded: '0.76'
5500
+ VersionChanged: '1.73'
5501
+ AllowedMethods:
5502
+ - infinite?
5503
+ - nonzero?
4848
5504
 
4849
5505
  Style/RedundantConditional:
4850
5506
  Description: "Don't return true/false from a conditional."
@@ -4853,11 +5509,12 @@ Style/RedundantConditional:
4853
5509
 
4854
5510
  Style/RedundantConstantBase:
4855
5511
  Description: Avoid redundant `::` prefix on constant.
5512
+ VersionChanged: '1.89'
4856
5513
  Enabled: pending
4857
5514
  VersionAdded: '1.40'
4858
5515
 
4859
5516
  Style/RedundantCurrentDirectoryInPath:
4860
- Description: 'Checks for uses a redundant current directory in path.'
5517
+ Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
4861
5518
  Enabled: pending
4862
5519
  VersionAdded: '1.53'
4863
5520
 
@@ -4883,7 +5540,8 @@ Style/RedundantFetchBlock:
4883
5540
  Description: >-
4884
5541
  Use `fetch(key, value)` instead of `fetch(key) { value }`
4885
5542
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4886
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
5543
+ References:
5544
+ - 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4887
5545
  Enabled: true
4888
5546
  Safe: false
4889
5547
  # If enabled, this cop will autocorrect usages of
@@ -4905,7 +5563,16 @@ Style/RedundantFilterChain:
4905
5563
  Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
4906
5564
  `select`/`filter`/`find_all` and change them to use predicate method instead.
4907
5565
  Enabled: pending
5566
+ SafeAutoCorrect: false
4908
5567
  VersionAdded: '1.52'
5568
+ VersionChanged: '1.57'
5569
+
5570
+ Style/RedundantFormat:
5571
+ Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
5572
+ Enabled: pending
5573
+ SafeAutoCorrect: false
5574
+ VersionAdded: '1.72'
5575
+ VersionChanged: '1.72'
4909
5576
 
4910
5577
  Style/RedundantFreeze:
4911
5578
  Description: "Checks usages of Object#freeze on immutable objects."
@@ -4921,10 +5588,11 @@ Style/RedundantHeredocDelimiterQuotes:
4921
5588
  Style/RedundantInitialize:
4922
5589
  Description: 'Checks for redundant `initialize` methods.'
4923
5590
  Enabled: pending
5591
+ AutoCorrect: contextual
4924
5592
  Safe: false
4925
- AllowComments: true
4926
5593
  VersionAdded: '1.27'
4927
- VersionChanged: '1.28'
5594
+ VersionChanged: '1.61'
5595
+ AllowComments: true
4928
5596
 
4929
5597
  Style/RedundantInterpolation:
4930
5598
  Description: 'Checks for strings that are just an interpolated expression.'
@@ -4933,11 +5601,22 @@ Style/RedundantInterpolation:
4933
5601
  VersionAdded: '0.76'
4934
5602
  VersionChanged: '1.30'
4935
5603
 
5604
+ Style/RedundantInterpolationUnfreeze:
5605
+ Description: 'Checks for redundant unfreezing of interpolated strings.'
5606
+ Enabled: pending
5607
+ VersionAdded: '1.66'
5608
+
4936
5609
  Style/RedundantLineContinuation:
4937
- Description: 'Check for redundant line continuation.'
5610
+ Description: 'Checks for redundant line continuation.'
5611
+ StyleGuide: '#no-trailing-backslash'
4938
5612
  Enabled: pending
4939
5613
  VersionAdded: '1.49'
4940
5614
 
5615
+ Style/RedundantMinMaxBy:
5616
+ Description: 'Identifies places where `max_by`/`min_by` can be replaced by `max`/`min`.'
5617
+ Enabled: pending
5618
+ VersionAdded: '1.85'
5619
+
4941
5620
  Style/RedundantParentheses:
4942
5621
  Description: "Checks for parentheses that seem not to serve any purpose."
4943
5622
  Enabled: true
@@ -4966,6 +5645,7 @@ Style/RedundantRegexpConstructor:
4966
5645
 
4967
5646
  Style/RedundantRegexpEscape:
4968
5647
  Description: 'Checks for redundant escapes in Regexps.'
5648
+ StyleGuide: '#limit-escapes'
4969
5649
  Enabled: true
4970
5650
  VersionAdded: '0.85'
4971
5651
 
@@ -5015,6 +5695,13 @@ Style/RedundantStringEscape:
5015
5695
  Enabled: pending
5016
5696
  VersionAdded: '1.37'
5017
5697
 
5698
+ Style/RedundantStructKeywordInit:
5699
+ Description: 'Checks for redundant `keyword_init` option for `Struct.new`.'
5700
+ Enabled: false
5701
+ SafeAutoCorrect: false
5702
+ VersionAdded: '1.85'
5703
+ VersionChanged: '1.86'
5704
+
5018
5705
  Style/RegexpLiteral:
5019
5706
  Description: 'Use / or %r around regular expressions.'
5020
5707
  StyleGuide: '#percent-r'
@@ -5071,9 +5758,16 @@ Style/ReturnNilInPredicateMethodDefinition:
5071
5758
  StyleGuide: '#bool-methods-qmark'
5072
5759
  Enabled: pending
5073
5760
  SafeAutoCorrect: false
5761
+ VersionAdded: '1.53'
5762
+ VersionChanged: '1.67'
5074
5763
  AllowedMethods: []
5075
5764
  AllowedPatterns: []
5076
- VersionAdded: '1.53'
5765
+
5766
+ Style/ReverseFind:
5767
+ Description: 'Use `array.rfind` instead of `array.reverse.find`.'
5768
+ Enabled: pending
5769
+ Safe: false
5770
+ VersionAdded: '1.84'
5077
5771
 
5078
5772
  Style/SafeNavigation:
5079
5773
  Description: >-
@@ -5084,7 +5778,7 @@ Style/SafeNavigation:
5084
5778
  be `nil` or truthy, but never `false`.
5085
5779
  Enabled: true
5086
5780
  VersionAdded: '0.43'
5087
- VersionChanged: '1.27'
5781
+ VersionChanged: '1.67'
5088
5782
  # Safe navigation may cause a statement to start returning `nil` in addition
5089
5783
  # to whatever it used to return.
5090
5784
  ConvertCodeThatCanStartToReturnNil: false
@@ -5098,16 +5792,36 @@ Style/SafeNavigation:
5098
5792
  # Maximum length of method chains for register an offense.
5099
5793
  MaxChainLength: 2
5100
5794
 
5795
+ Style/SafeNavigationChainLength:
5796
+ Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
5797
+ StyleGuide: '#safe-navigation'
5798
+ Enabled: pending
5799
+ VersionAdded: '1.68'
5800
+ Max: 2
5801
+
5101
5802
  Style/Sample:
5102
5803
  Description: >-
5103
5804
  Use `sample` instead of `shuffle.first`,
5104
5805
  `shuffle.last`, and `shuffle[Integer]`.
5105
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5806
+ References:
5807
+ - 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5106
5808
  Enabled: true
5107
5809
  VersionAdded: '0.30'
5108
5810
 
5811
+ Style/SelectByKind:
5812
+ Description: 'Prefer grep/grep_v to select/reject/find/detect with a kind check.'
5813
+ Enabled: pending
5814
+ SafeAutoCorrect: false
5815
+ VersionAdded: '1.85'
5816
+
5817
+ Style/SelectByRange:
5818
+ Description: 'Prefer grep/grep_v to select/reject/find/detect with a range check.'
5819
+ Enabled: pending
5820
+ SafeAutoCorrect: false
5821
+ VersionAdded: '1.85'
5822
+
5109
5823
  Style/SelectByRegexp:
5110
- Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
5824
+ Description: 'Prefer grep/grep_v to select/reject/find/detect with a regexp match.'
5111
5825
  Enabled: pending
5112
5826
  SafeAutoCorrect: false
5113
5827
  VersionAdded: '1.22'
@@ -5136,6 +5850,13 @@ Style/Send:
5136
5850
  Enabled: false
5137
5851
  VersionAdded: '0.33'
5138
5852
 
5853
+ Style/SendWithLiteralMethodName:
5854
+ Description: 'Detects the use of the `public_send` method with a static method name argument.'
5855
+ Enabled: pending
5856
+ Safe: false
5857
+ AllowSend: true
5858
+ VersionAdded: '1.64'
5859
+
5139
5860
  Style/SignalException:
5140
5861
  Description: 'Checks for proper usage of fail and raise.'
5141
5862
  StyleGuide: '#prefer-raise-over-fail'
@@ -5167,6 +5888,12 @@ Style/SingleLineBlockParams:
5167
5888
  - acc
5168
5889
  - elem
5169
5890
 
5891
+ Style/SingleLineDoEndBlock:
5892
+ Description: 'Checks for single-line `do`...`end` blocks.'
5893
+ StyleGuide: '#single-line-do-end-block'
5894
+ Enabled: pending
5895
+ VersionAdded: '1.57'
5896
+
5170
5897
  Style/SingleLineMethods:
5171
5898
  Description: 'Avoid single-line methods.'
5172
5899
  StyleGuide: '#no-single-line-methods'
@@ -5176,7 +5903,8 @@ Style/SingleLineMethods:
5176
5903
  AllowIfMethodIsEmpty: true
5177
5904
 
5178
5905
  Style/SlicingWithRange:
5179
- Description: 'Checks array slicing is done with endless ranges when suitable.'
5906
+ Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
5907
+ StyleGuide: '#slicing-with-ranges'
5180
5908
  Enabled: true
5181
5909
  VersionAdded: '0.83'
5182
5910
  Safe: false
@@ -5205,7 +5933,7 @@ Style/SpecialGlobalVars:
5205
5933
  - use_builtin_english_names
5206
5934
 
5207
5935
  Style/StabbyLambdaParentheses:
5208
- Description: 'Check for the usage of parentheses around stabby lambda arguments.'
5936
+ Description: 'Checks for the usage of parentheses around stabby lambda arguments.'
5209
5937
  StyleGuide: '#stabby-lambda-with-args'
5210
5938
  Enabled: true
5211
5939
  VersionAdded: '0.35'
@@ -5217,6 +5945,7 @@ Style/StabbyLambdaParentheses:
5217
5945
  Style/StaticClass:
5218
5946
  Description: 'Prefer modules to classes with only class methods.'
5219
5947
  StyleGuide: '#modules-vs-classes'
5948
+ VersionChanged: '1.89'
5220
5949
  Enabled: false
5221
5950
  Safe: false
5222
5951
  VersionAdded: '1.3'
@@ -5303,6 +6032,17 @@ Style/StructInheritance:
5303
6032
  VersionAdded: '0.29'
5304
6033
  VersionChanged: '1.20'
5305
6034
 
6035
+ Style/SuperArguments:
6036
+ Description: 'Call `super` without arguments and parentheses when the signature is identical.'
6037
+ Enabled: pending
6038
+ VersionAdded: '1.64'
6039
+
6040
+ Style/SuperWithArgsParentheses:
6041
+ Description: 'Use parentheses for `super` with arguments.'
6042
+ StyleGuide: '#super-with-args'
6043
+ Enabled: pending
6044
+ VersionAdded: '1.58'
6045
+
5306
6046
  Style/SwapValues:
5307
6047
  Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
5308
6048
  StyleGuide: '#values-swapping'
@@ -5332,7 +6072,7 @@ Style/SymbolProc:
5332
6072
  Enabled: true
5333
6073
  Safe: false
5334
6074
  VersionAdded: '0.26'
5335
- VersionChanged: '1.40'
6075
+ VersionChanged: '1.64'
5336
6076
  AllowMethodsWithArguments: false
5337
6077
  # A list of method names to be always allowed by the check.
5338
6078
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
@@ -5341,6 +6081,12 @@ Style/SymbolProc:
5341
6081
  AllowedPatterns: []
5342
6082
  AllowComments: false
5343
6083
 
6084
+ Style/TallyMethod:
6085
+ Description: 'Prefer `Enumerable#tally` over manual counting patterns.'
6086
+ Enabled: pending
6087
+ Safe: false
6088
+ VersionAdded: '1.85'
6089
+
5344
6090
  Style/TernaryParentheses:
5345
6091
  Description: 'Checks for use of parentheses around ternary conditions.'
5346
6092
  Enabled: true
@@ -5353,6 +6099,12 @@ Style/TernaryParentheses:
5353
6099
  - require_parentheses_when_complex
5354
6100
  AllowSafeAssignment: true
5355
6101
 
6102
+ Style/TimeNow:
6103
+ Description: 'Prefer `Time.now` over `Time.new` when retrieving the current system time.'
6104
+ StyleGuide: '#time-now'
6105
+ Enabled: pending
6106
+ VersionAdded: '1.90'
6107
+
5356
6108
  Style/TopLevelMethodDefinition:
5357
6109
  Description: 'Looks for top-level method definitions.'
5358
6110
  StyleGuide: '#top-level-methods'
@@ -5365,12 +6117,12 @@ Style/TrailingBodyOnClass:
5365
6117
  VersionAdded: '0.53'
5366
6118
 
5367
6119
  Style/TrailingBodyOnMethodDefinition:
5368
- Description: 'Method body goes below definition.'
6120
+ Description: 'Checks for trailing code after the method definition.'
5369
6121
  Enabled: true
5370
6122
  VersionAdded: '0.52'
5371
6123
 
5372
6124
  Style/TrailingBodyOnModule:
5373
- Description: 'Module body goes below module statement.'
6125
+ Description: 'Checks for trailing code after the module definition.'
5374
6126
  Enabled: true
5375
6127
  VersionAdded: '0.53'
5376
6128
 
@@ -5383,10 +6135,14 @@ Style/TrailingCommaInArguments:
5383
6135
  # parenthesized method calls where each argument is on its own line.
5384
6136
  # If `consistent_comma`, the cop requires a comma after the last argument,
5385
6137
  # for all parenthesized method calls with arguments.
6138
+ # If `diff_comma`, the cop requires a comma after the last argument, but only
6139
+ # when that argument is followed by an immediate newline, even if
6140
+ # there is an inline comment.
5386
6141
  EnforcedStyleForMultiline: no_comma
5387
6142
  SupportedStylesForMultiline:
5388
6143
  - comma
5389
6144
  - consistent_comma
6145
+ - diff_comma
5390
6146
  - no_comma
5391
6147
 
5392
6148
  Style/TrailingCommaInArrayLiteral:
@@ -5394,14 +6150,17 @@ Style/TrailingCommaInArrayLiteral:
5394
6150
  StyleGuide: '#no-trailing-array-commas'
5395
6151
  Enabled: true
5396
6152
  VersionAdded: '0.53'
5397
- # If `comma`, the cop requires a comma after the last item in an array,
5398
- # but only when each item is on its own line.
5399
- # If `consistent_comma`, the cop requires a comma after the last item of all
5400
- # non-empty, multiline array literals.
6153
+ # If `comma`, the cop requires a comma after the last item in an array, but only when each item is
6154
+ # on its own line.
6155
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
6156
+ # array literals.
6157
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
6158
+ # literals, but only when that last item immediately precedes a newline.
5401
6159
  EnforcedStyleForMultiline: no_comma
5402
6160
  SupportedStylesForMultiline:
5403
6161
  - comma
5404
6162
  - consistent_comma
6163
+ - diff_comma
5405
6164
  - no_comma
5406
6165
 
5407
6166
  Style/TrailingCommaInBlockArgs:
@@ -5413,14 +6172,17 @@ Style/TrailingCommaInBlockArgs:
5413
6172
  Style/TrailingCommaInHashLiteral:
5414
6173
  Description: 'Checks for trailing comma in hash literals.'
5415
6174
  Enabled: true
5416
- # If `comma`, the cop requires a comma after the last item in a hash,
5417
- # but only when each item is on its own line.
5418
- # If `consistent_comma`, the cop requires a comma after the last item of all
5419
- # non-empty, multiline hash literals.
6175
+ # If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
6176
+ # on its own line.
6177
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
6178
+ # hash literals.
6179
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
6180
+ # literals, but only when that last item immediately precedes a newline.
5420
6181
  EnforcedStyleForMultiline: no_comma
5421
6182
  SupportedStylesForMultiline:
5422
6183
  - comma
5423
6184
  - consistent_comma
6185
+ - diff_comma
5424
6186
  - no_comma
5425
6187
  VersionAdded: '0.53'
5426
6188
 
@@ -5433,10 +6195,11 @@ Style/TrailingUnderscoreVariable:
5433
6195
  Description: >-
5434
6196
  Checks for the usage of unneeded trailing underscores at the
5435
6197
  end of parallel variable assignment.
5436
- AllowNamedUnderscoreVariables: true
6198
+ StyleGuide: '#trailing-underscore-variables'
5437
6199
  Enabled: true
5438
6200
  VersionAdded: '0.31'
5439
6201
  VersionChanged: '0.35'
6202
+ AllowNamedUnderscoreVariables: true
5440
6203
 
5441
6204
  # `TrivialAccessors` requires exact name matches and doesn't allow
5442
6205
  # predicated methods by default.
@@ -5566,8 +6329,12 @@ Style/YAMLFileRead:
5566
6329
 
5567
6330
  Style/YodaCondition:
5568
6331
  Description: 'Forbid or enforce yoda conditions.'
5569
- Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
6332
+ References:
6333
+ - 'https://en.wikipedia.org/wiki/Yoda_conditions'
5570
6334
  Enabled: true
6335
+ Safe: false
6336
+ VersionAdded: '0.49'
6337
+ VersionChanged: '0.75'
5571
6338
  EnforcedStyle: forbid_for_all_comparison_operators
5572
6339
  SupportedStyles:
5573
6340
  # check all comparison operators
@@ -5578,9 +6345,6 @@ Style/YodaCondition:
5578
6345
  - require_for_all_comparison_operators
5579
6346
  # enforce yoda only for equality operators: `!=` and `==`
5580
6347
  - require_for_equality_operators_only
5581
- Safe: false
5582
- VersionAdded: '0.49'
5583
- VersionChanged: '0.75'
5584
6348
 
5585
6349
  Style/YodaExpression:
5586
6350
  Description: 'Forbid the use of yoda expressions.'