rubocop 1.67.0 → 1.82.1

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 (540) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +23 -19
  4. data/config/default.yml +403 -75
  5. data/config/internal_affairs.yml +20 -0
  6. data/config/obsoletion.yml +12 -3
  7. data/exe/rubocop +1 -8
  8. data/lib/rubocop/cached_data.rb +12 -4
  9. data/lib/rubocop/cli/command/auto_generate_config.rb +2 -2
  10. data/lib/rubocop/cli/command/execute_runner.rb +4 -4
  11. data/lib/rubocop/cli/command/show_cops.rb +24 -2
  12. data/lib/rubocop/cli/command/suggest_extensions.rb +7 -1
  13. data/lib/rubocop/cli/command/version.rb +2 -2
  14. data/lib/rubocop/cli.rb +21 -5
  15. data/lib/rubocop/comment_config.rb +64 -19
  16. data/lib/rubocop/config.rb +52 -10
  17. data/lib/rubocop/config_loader.rb +58 -49
  18. data/lib/rubocop/config_loader_resolver.rb +43 -16
  19. data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -3
  20. data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
  21. data/lib/rubocop/config_obsoletion.rb +46 -2
  22. data/lib/rubocop/config_store.rb +5 -0
  23. data/lib/rubocop/config_validator.rb +25 -14
  24. data/lib/rubocop/cop/autocorrect_logic.rb +57 -28
  25. data/lib/rubocop/cop/base.rb +7 -1
  26. data/lib/rubocop/cop/bundler/duplicated_gem.rb +2 -2
  27. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  28. data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
  29. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
  30. data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -3
  31. data/lib/rubocop/cop/correctors/alignment_corrector.rb +9 -19
  32. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +8 -3
  33. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -2
  34. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
  35. data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
  36. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +1 -2
  37. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +37 -15
  38. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +2 -3
  39. data/lib/rubocop/cop/gemspec/require_mfa.rb +15 -1
  40. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +0 -2
  41. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +10 -5
  42. data/lib/rubocop/cop/generator.rb +6 -0
  43. data/lib/rubocop/cop/internal_affairs/cop_enabled.rb +85 -0
  44. data/lib/rubocop/cop/internal_affairs/example_description.rb +9 -5
  45. data/lib/rubocop/cop/internal_affairs/location_exists.rb +142 -0
  46. data/lib/rubocop/cop/internal_affairs/location_expression.rb +2 -1
  47. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -4
  48. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +3 -2
  49. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +5 -5
  50. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +63 -0
  51. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +131 -0
  52. data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +233 -0
  53. data/lib/rubocop/cop/internal_affairs/node_type_group.rb +92 -0
  54. data/lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb +126 -0
  55. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +4 -3
  56. data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +1 -1
  57. data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +90 -0
  58. data/lib/rubocop/cop/internal_affairs/operator_keyword.rb +48 -0
  59. data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
  60. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +6 -5
  61. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +3 -1
  62. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +5 -4
  63. data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +0 -2
  64. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +13 -2
  65. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
  66. data/lib/rubocop/cop/internal_affairs.rb +7 -16
  67. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +1 -1
  68. data/lib/rubocop/cop/layout/argument_alignment.rb +2 -9
  69. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  70. data/lib/rubocop/cop/layout/begin_end_alignment.rb +0 -1
  71. data/lib/rubocop/cop/layout/block_alignment.rb +3 -2
  72. data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
  73. data/lib/rubocop/cop/layout/class_structure.rb +45 -10
  74. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +5 -5
  75. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  76. data/lib/rubocop/cop/layout/dot_position.rb +1 -1
  77. data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
  78. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +6 -3
  79. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +34 -20
  80. data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +101 -0
  81. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +37 -7
  82. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +8 -29
  83. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +5 -6
  84. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -0
  85. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
  86. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +4 -5
  87. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +23 -1
  88. data/lib/rubocop/cop/layout/end_alignment.rb +5 -1
  89. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
  90. data/lib/rubocop/cop/layout/first_argument_indentation.rb +4 -9
  91. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -7
  92. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -7
  93. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
  94. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
  95. data/lib/rubocop/cop/layout/hash_alignment.rb +10 -11
  96. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +4 -3
  97. data/lib/rubocop/cop/layout/heredoc_indentation.rb +1 -4
  98. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  99. data/lib/rubocop/cop/layout/indentation_width.rb +20 -8
  100. data/lib/rubocop/cop/layout/leading_comment_space.rb +57 -2
  101. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +11 -2
  102. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +7 -1
  103. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -2
  104. data/lib/rubocop/cop/layout/line_length.rb +163 -11
  105. data/lib/rubocop/cop/layout/multiline_block_layout.rb +3 -0
  106. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
  107. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +25 -0
  108. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -1
  109. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +9 -5
  110. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
  111. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +1 -0
  112. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +11 -8
  113. data/lib/rubocop/cop/layout/parameter_alignment.rb +3 -4
  114. data/lib/rubocop/cop/layout/redundant_line_break.rb +19 -46
  115. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +16 -7
  116. data/lib/rubocop/cop/layout/single_line_block_chain.rb +1 -1
  117. data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
  118. data/lib/rubocop/cop/layout/space_after_comma.rb +3 -11
  119. data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
  120. data/lib/rubocop/cop/layout/space_after_semicolon.rb +12 -2
  121. data/lib/rubocop/cop/layout/space_around_keyword.rb +9 -3
  122. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
  123. data/lib/rubocop/cop/layout/space_around_operators.rb +31 -21
  124. data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -0
  125. data/lib/rubocop/cop/layout/space_before_brackets.rb +7 -40
  126. data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
  127. data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
  128. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +18 -3
  129. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -0
  130. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +7 -0
  131. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +0 -1
  132. data/lib/rubocop/cop/layout/trailing_whitespace.rb +6 -4
  133. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
  134. data/lib/rubocop/cop/lint/ambiguous_range.rb +5 -0
  135. data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +118 -0
  136. data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -3
  137. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +10 -12
  138. data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
  139. data/lib/rubocop/cop/lint/circular_argument_reference.rb +51 -4
  140. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
  141. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +3 -2
  142. data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
  143. data/lib/rubocop/cop/lint/cop_directive_syntax.rb +90 -0
  144. data/lib/rubocop/cop/lint/debugger.rb +3 -5
  145. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
  146. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +7 -3
  147. data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
  148. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +5 -5
  149. data/lib/rubocop/cop/lint/duplicate_methods.rb +111 -23
  150. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +6 -43
  151. data/lib/rubocop/cop/lint/duplicate_set_element.rb +20 -7
  152. data/lib/rubocop/cop/lint/else_layout.rb +19 -0
  153. data/lib/rubocop/cop/lint/empty_conditional_body.rb +14 -64
  154. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  155. data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
  156. data/lib/rubocop/cop/lint/empty_file.rb +0 -2
  157. data/lib/rubocop/cop/lint/empty_interpolation.rb +14 -1
  158. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  159. data/lib/rubocop/cop/lint/erb_new_arguments.rb +0 -6
  160. data/lib/rubocop/cop/lint/float_comparison.rb +51 -18
  161. data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -4
  162. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +2 -2
  163. data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
  164. data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
  165. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
  166. data/lib/rubocop/cop/lint/interpolation_check.rb +9 -0
  167. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +3 -0
  168. data/lib/rubocop/cop/lint/literal_as_condition.rb +129 -10
  169. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +1 -1
  170. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +25 -7
  171. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +17 -8
  172. data/lib/rubocop/cop/lint/missing_super.rb +2 -2
  173. data/lib/rubocop/cop/lint/mixed_case_range.rb +5 -8
  174. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
  175. data/lib/rubocop/cop/lint/nested_method_definition.rb +10 -6
  176. data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
  177. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +6 -2
  178. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +12 -3
  179. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -3
  180. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -3
  181. data/lib/rubocop/cop/lint/number_conversion.rb +0 -1
  182. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -2
  183. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +94 -0
  184. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -3
  185. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +3 -2
  186. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -5
  187. data/lib/rubocop/cop/lint/raise_exception.rb +29 -10
  188. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +23 -9
  189. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +1 -1
  190. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +2 -2
  191. data/lib/rubocop/cop/lint/redundant_require_statement.rb +4 -23
  192. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +113 -9
  193. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +15 -8
  194. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -2
  195. data/lib/rubocop/cop/lint/redundant_type_conversion.rb +261 -0
  196. data/lib/rubocop/cop/lint/redundant_with_index.rb +3 -0
  197. data/lib/rubocop/cop/lint/redundant_with_object.rb +3 -0
  198. data/lib/rubocop/cop/lint/refinement_import_methods.rb +1 -1
  199. data/lib/rubocop/cop/lint/regexp_as_condition.rb +0 -1
  200. data/lib/rubocop/cop/lint/require_range_parentheses.rb +1 -1
  201. data/lib/rubocop/cop/lint/rescue_exception.rb +2 -5
  202. data/lib/rubocop/cop/lint/rescue_type.rb +4 -8
  203. data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -11
  204. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +17 -1
  205. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +5 -1
  206. data/lib/rubocop/cop/lint/self_assignment.rb +47 -15
  207. data/lib/rubocop/cop/lint/shadowed_argument.rb +7 -7
  208. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
  209. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +13 -1
  210. data/lib/rubocop/cop/lint/shared_mutable_default.rb +76 -0
  211. data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
  212. data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
  213. data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
  214. data/lib/rubocop/cop/lint/syntax.rb +4 -1
  215. data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
  216. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
  217. data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +88 -0
  218. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +3 -1
  219. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +1 -1
  220. data/lib/rubocop/cop/lint/unreachable_code.rb +54 -2
  221. data/lib/rubocop/cop/lint/unreachable_loop.rb +6 -6
  222. data/lib/rubocop/cop/lint/unused_method_argument.rb +18 -2
  223. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +2 -0
  224. data/lib/rubocop/cop/lint/useless_access_modifier.rb +34 -8
  225. data/lib/rubocop/cop/lint/useless_assignment.rb +47 -17
  226. data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
  227. data/lib/rubocop/cop/lint/useless_default_value_argument.rb +90 -0
  228. data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
  229. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -0
  230. data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
  231. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +3 -1
  232. data/lib/rubocop/cop/lint/useless_or.rb +111 -0
  233. data/lib/rubocop/cop/lint/useless_rescue.rb +2 -2
  234. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +5 -5
  235. data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -25
  236. data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +121 -0
  237. data/lib/rubocop/cop/lint/void.rb +23 -12
  238. data/lib/rubocop/cop/message_annotator.rb +7 -3
  239. data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
  240. data/lib/rubocop/cop/metrics/block_length.rb +1 -0
  241. data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
  242. data/lib/rubocop/cop/metrics/class_length.rb +9 -9
  243. data/lib/rubocop/cop/metrics/collection_literal_length.rb +7 -0
  244. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +5 -2
  245. data/lib/rubocop/cop/metrics/method_length.rb +9 -1
  246. data/lib/rubocop/cop/metrics/module_length.rb +1 -1
  247. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  248. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +5 -4
  249. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +3 -4
  250. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
  251. data/lib/rubocop/cop/mixin/alignment.rb +3 -3
  252. data/lib/rubocop/cop/mixin/allowed_pattern.rb +4 -4
  253. data/lib/rubocop/cop/mixin/check_assignment.rb +4 -12
  254. data/lib/rubocop/cop/mixin/check_line_breakable.rb +22 -12
  255. data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +47 -0
  256. data/lib/rubocop/cop/mixin/code_length.rb +1 -1
  257. data/lib/rubocop/cop/mixin/comments_help.rb +8 -3
  258. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  259. data/lib/rubocop/cop/mixin/dig_help.rb +27 -0
  260. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
  261. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -7
  262. data/lib/rubocop/cop/mixin/endless_method_rewriter.rb +24 -0
  263. data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
  264. data/lib/rubocop/cop/mixin/forbidden_pattern.rb +16 -0
  265. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -3
  266. data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
  267. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +15 -14
  268. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +22 -22
  269. data/lib/rubocop/cop/mixin/hash_subset.rb +203 -0
  270. data/lib/rubocop/cop/mixin/hash_transform_method.rb +74 -74
  271. data/lib/rubocop/cop/mixin/line_length_help.rb +48 -12
  272. data/lib/rubocop/cop/mixin/method_complexity.rb +3 -2
  273. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +8 -10
  274. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -1
  275. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  276. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  277. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +68 -30
  278. data/lib/rubocop/cop/mixin/range_help.rb +15 -4
  279. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +5 -4
  280. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
  281. data/lib/rubocop/cop/mixin/statement_modifier.rb +7 -8
  282. data/lib/rubocop/cop/mixin/string_help.rb +2 -2
  283. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
  284. data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
  285. data/lib/rubocop/cop/mixin/trailing_comma.rb +28 -9
  286. data/lib/rubocop/cop/naming/accessor_method_name.rb +6 -6
  287. data/lib/rubocop/cop/naming/block_forwarding.rb +20 -16
  288. data/lib/rubocop/cop/naming/constant_name.rb +6 -7
  289. data/lib/rubocop/cop/naming/file_name.rb +2 -4
  290. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +12 -13
  291. data/lib/rubocop/cop/naming/method_name.rb +187 -15
  292. data/lib/rubocop/cop/naming/predicate_method.rb +319 -0
  293. data/lib/rubocop/cop/naming/{predicate_name.rb → predicate_prefix.rb} +48 -4
  294. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +6 -14
  295. data/lib/rubocop/cop/naming/variable_name.rb +50 -6
  296. data/lib/rubocop/cop/naming/variable_number.rb +2 -3
  297. data/lib/rubocop/cop/offense.rb +2 -3
  298. data/lib/rubocop/cop/registry.rb +9 -6
  299. data/lib/rubocop/cop/security/compound_hash.rb +2 -0
  300. data/lib/rubocop/cop/security/eval.rb +2 -1
  301. data/lib/rubocop/cop/security/json_load.rb +33 -11
  302. data/lib/rubocop/cop/security/open.rb +1 -0
  303. data/lib/rubocop/cop/security/yaml_load.rb +3 -2
  304. data/lib/rubocop/cop/style/access_modifier_declarations.rb +114 -34
  305. data/lib/rubocop/cop/style/accessor_grouping.rb +32 -6
  306. data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +79 -0
  307. data/lib/rubocop/cop/style/and_or.rb +1 -1
  308. data/lib/rubocop/cop/style/arguments_forwarding.rb +57 -44
  309. data/lib/rubocop/cop/style/array_first_last.rb +18 -2
  310. data/lib/rubocop/cop/style/array_intersect.rb +115 -39
  311. data/lib/rubocop/cop/style/array_intersect_with_single_element.rb +47 -0
  312. data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -2
  313. data/lib/rubocop/cop/style/bitwise_predicate.rb +107 -0
  314. data/lib/rubocop/cop/style/block_delimiters.rb +44 -26
  315. data/lib/rubocop/cop/style/case_equality.rb +11 -13
  316. data/lib/rubocop/cop/style/case_like_if.rb +9 -12
  317. data/lib/rubocop/cop/style/class_and_module_children.rb +53 -11
  318. data/lib/rubocop/cop/style/class_equality_comparison.rb +1 -1
  319. data/lib/rubocop/cop/style/collection_methods.rb +2 -1
  320. data/lib/rubocop/cop/style/collection_querying.rb +167 -0
  321. data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
  322. data/lib/rubocop/cop/style/combinable_loops.rb +3 -2
  323. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  324. data/lib/rubocop/cop/style/commented_keyword.rb +20 -3
  325. data/lib/rubocop/cop/style/comparable_between.rb +78 -0
  326. data/lib/rubocop/cop/style/concat_array_literals.rb +1 -1
  327. data/lib/rubocop/cop/style/conditional_assignment.rb +50 -42
  328. data/lib/rubocop/cop/style/constant_visibility.rb +19 -23
  329. data/lib/rubocop/cop/style/data_inheritance.rb +7 -0
  330. data/lib/rubocop/cop/style/def_with_parentheses.rb +18 -5
  331. data/lib/rubocop/cop/style/dig_chain.rb +89 -0
  332. data/lib/rubocop/cop/style/documentation.rb +1 -1
  333. data/lib/rubocop/cop/style/double_negation.rb +5 -5
  334. data/lib/rubocop/cop/style/each_for_simple_loop.rb +4 -7
  335. data/lib/rubocop/cop/style/each_with_object.rb +2 -3
  336. data/lib/rubocop/cop/style/empty_else.rb +4 -2
  337. data/lib/rubocop/cop/style/empty_literal.rb +5 -1
  338. data/lib/rubocop/cop/style/empty_method.rb +0 -6
  339. data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
  340. data/lib/rubocop/cop/style/endless_method.rb +163 -18
  341. data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
  342. data/lib/rubocop/cop/style/exact_regexp_match.rb +2 -3
  343. data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
  344. data/lib/rubocop/cop/style/explicit_block_argument.rb +17 -4
  345. data/lib/rubocop/cop/style/exponential_notation.rb +6 -5
  346. data/lib/rubocop/cop/style/fetch_env_var.rb +34 -7
  347. data/lib/rubocop/cop/style/file_null.rb +89 -0
  348. data/lib/rubocop/cop/style/file_touch.rb +75 -0
  349. data/lib/rubocop/cop/style/float_division.rb +23 -5
  350. data/lib/rubocop/cop/style/for.rb +1 -1
  351. data/lib/rubocop/cop/style/format_string_token.rb +38 -11
  352. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -2
  353. data/lib/rubocop/cop/style/global_std_stream.rb +3 -0
  354. data/lib/rubocop/cop/style/global_vars.rb +1 -3
  355. data/lib/rubocop/cop/style/guard_clause.rb +17 -14
  356. data/lib/rubocop/cop/style/hash_conversion.rb +16 -9
  357. data/lib/rubocop/cop/style/hash_each_methods.rb +6 -8
  358. data/lib/rubocop/cop/style/hash_except.rb +35 -147
  359. data/lib/rubocop/cop/style/hash_fetch_chain.rb +104 -0
  360. data/lib/rubocop/cop/style/hash_slice.rb +80 -0
  361. data/lib/rubocop/cop/style/hash_syntax.rb +9 -3
  362. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  363. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  364. data/lib/rubocop/cop/style/identical_conditional_branches.rb +25 -6
  365. data/lib/rubocop/cop/style/if_inside_else.rb +10 -14
  366. data/lib/rubocop/cop/style/if_unless_modifier.rb +39 -12
  367. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +4 -7
  368. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +3 -4
  369. data/lib/rubocop/cop/style/if_with_semicolon.rb +20 -9
  370. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  371. data/lib/rubocop/cop/style/inverse_methods.rb +16 -13
  372. data/lib/rubocop/cop/style/invertible_unless_condition.rb +2 -2
  373. data/lib/rubocop/cop/style/ip_addresses.rb +2 -2
  374. data/lib/rubocop/cop/style/it_assignment.rb +93 -0
  375. data/lib/rubocop/cop/style/it_block_parameter.rb +121 -0
  376. data/lib/rubocop/cop/style/keyword_arguments_merging.rb +67 -0
  377. data/lib/rubocop/cop/style/keyword_parameters_order.rb +14 -8
  378. data/lib/rubocop/cop/style/lambda.rb +1 -0
  379. data/lib/rubocop/cop/style/lambda_call.rb +10 -4
  380. data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
  381. data/lib/rubocop/cop/style/map_into_array.rb +11 -3
  382. data/lib/rubocop/cop/style/map_to_hash.rb +13 -4
  383. data/lib/rubocop/cop/style/map_to_set.rb +4 -5
  384. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +28 -20
  385. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +12 -1
  386. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +35 -4
  387. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +8 -11
  388. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -4
  389. data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
  390. data/lib/rubocop/cop/style/min_max_comparison.rb +13 -5
  391. data/lib/rubocop/cop/style/missing_else.rb +2 -0
  392. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +33 -3
  393. data/lib/rubocop/cop/style/module_member_existence_check.rb +74 -0
  394. data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -2
  395. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -0
  396. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  397. data/lib/rubocop/cop/style/multiline_method_signature.rb +3 -13
  398. data/lib/rubocop/cop/style/multiple_comparison.rb +52 -51
  399. data/lib/rubocop/cop/style/mutable_constant.rb +7 -8
  400. data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -5
  401. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
  402. data/lib/rubocop/cop/style/nested_ternary_operator.rb +5 -4
  403. data/lib/rubocop/cop/style/next.rb +44 -0
  404. data/lib/rubocop/cop/style/nil_comparison.rb +9 -7
  405. data/lib/rubocop/cop/style/not.rb +1 -1
  406. data/lib/rubocop/cop/style/object_then.rb +15 -15
  407. data/lib/rubocop/cop/style/one_line_conditional.rb +42 -13
  408. data/lib/rubocop/cop/style/open_struct_use.rb +5 -5
  409. data/lib/rubocop/cop/style/operator_method_call.rb +16 -8
  410. data/lib/rubocop/cop/style/or_assignment.rb +3 -6
  411. data/lib/rubocop/cop/style/parallel_assignment.rb +43 -40
  412. data/lib/rubocop/cop/style/parentheses_around_condition.rb +2 -2
  413. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  414. data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
  415. data/lib/rubocop/cop/style/proc.rb +2 -2
  416. data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
  417. data/lib/rubocop/cop/style/raise_args.rb +15 -13
  418. data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
  419. data/lib/rubocop/cop/style/redundant_argument.rb +5 -1
  420. data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
  421. data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
  422. data/lib/rubocop/cop/style/redundant_begin.rb +36 -1
  423. data/lib/rubocop/cop/style/redundant_condition.rb +95 -23
  424. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +16 -5
  425. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +6 -10
  426. data/lib/rubocop/cop/style/redundant_each.rb +1 -1
  427. data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
  428. data/lib/rubocop/cop/style/redundant_fetch_block.rb +1 -9
  429. data/lib/rubocop/cop/style/redundant_format.rb +283 -0
  430. data/lib/rubocop/cop/style/redundant_freeze.rb +4 -4
  431. data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
  432. data/lib/rubocop/cop/style/redundant_interpolation.rb +12 -3
  433. data/lib/rubocop/cop/style/redundant_line_continuation.rb +55 -19
  434. data/lib/rubocop/cop/style/redundant_parentheses.rb +105 -36
  435. data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -2
  436. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +13 -0
  437. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
  438. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +9 -1
  439. data/lib/rubocop/cop/style/redundant_return.rb +2 -2
  440. data/lib/rubocop/cop/style/redundant_self.rb +15 -18
  441. data/lib/rubocop/cop/style/redundant_self_assignment.rb +20 -32
  442. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +4 -4
  443. data/lib/rubocop/cop/style/redundant_sort.rb +10 -10
  444. data/lib/rubocop/cop/style/redundant_sort_by.rb +17 -1
  445. data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -2
  446. data/lib/rubocop/cop/style/regexp_literal.rb +1 -1
  447. data/lib/rubocop/cop/style/rescue_modifier.rb +5 -3
  448. data/lib/rubocop/cop/style/return_nil.rb +2 -2
  449. data/lib/rubocop/cop/style/safe_navigation.rb +75 -16
  450. data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
  451. data/lib/rubocop/cop/style/select_by_regexp.rb +5 -2
  452. data/lib/rubocop/cop/style/self_assignment.rb +11 -17
  453. data/lib/rubocop/cop/style/semicolon.rb +24 -8
  454. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +2 -1
  455. data/lib/rubocop/cop/style/signal_exception.rb +2 -3
  456. data/lib/rubocop/cop/style/single_argument_dig.rb +9 -5
  457. data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
  458. data/lib/rubocop/cop/style/single_line_do_end_block.rb +15 -4
  459. data/lib/rubocop/cop/style/single_line_methods.rb +13 -11
  460. data/lib/rubocop/cop/style/slicing_with_range.rb +40 -11
  461. data/lib/rubocop/cop/style/sole_nested_conditional.rb +75 -102
  462. data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
  463. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
  464. data/lib/rubocop/cop/style/string_concatenation.rb +21 -17
  465. data/lib/rubocop/cop/style/string_literals.rb +1 -1
  466. data/lib/rubocop/cop/style/string_methods.rb +1 -1
  467. data/lib/rubocop/cop/style/struct_inheritance.rb +8 -1
  468. data/lib/rubocop/cop/style/super_arguments.rb +68 -21
  469. data/lib/rubocop/cop/style/swap_values.rb +4 -15
  470. data/lib/rubocop/cop/style/symbol_array.rb +1 -1
  471. data/lib/rubocop/cop/style/symbol_proc.rb +3 -1
  472. data/lib/rubocop/cop/style/ternary_parentheses.rb +25 -4
  473. data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -1
  474. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +56 -2
  475. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
  476. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
  477. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
  478. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +15 -15
  479. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  480. data/lib/rubocop/cop/style/unless_else.rb +10 -9
  481. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
  482. data/lib/rubocop/cop/style/while_until_modifier.rb +0 -1
  483. data/lib/rubocop/cop/style/yoda_condition.rb +8 -4
  484. data/lib/rubocop/cop/style/yoda_expression.rb +2 -1
  485. data/lib/rubocop/cop/team.rb +1 -1
  486. data/lib/rubocop/cop/util.rb +14 -8
  487. data/lib/rubocop/cop/utils/format_string.rb +20 -5
  488. data/lib/rubocop/cop/variable_force/assignment.rb +24 -5
  489. data/lib/rubocop/cop/variable_force/branch.rb +1 -1
  490. data/lib/rubocop/cop/variable_force/scope.rb +1 -1
  491. data/lib/rubocop/cop/variable_force/variable.rb +14 -3
  492. data/lib/rubocop/cop/variable_force/variable_table.rb +5 -5
  493. data/lib/rubocop/cop/variable_force.rb +30 -19
  494. data/lib/rubocop/cops_documentation_generator.rb +54 -28
  495. data/lib/rubocop/directive_comment.rb +88 -11
  496. data/lib/rubocop/ext/regexp_node.rb +0 -1
  497. data/lib/rubocop/formatter/disabled_config_formatter.rb +21 -6
  498. data/lib/rubocop/formatter/formatter_set.rb +1 -1
  499. data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
  500. data/lib/rubocop/formatter/html_formatter.rb +1 -1
  501. data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
  502. data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
  503. data/lib/rubocop/formatter/pacman_formatter.rb +2 -1
  504. data/lib/rubocop/lsp/diagnostic.rb +185 -0
  505. data/lib/rubocop/lsp/logger.rb +2 -2
  506. data/lib/rubocop/lsp/routes.rb +37 -24
  507. data/lib/rubocop/lsp/runtime.rb +18 -50
  508. data/lib/rubocop/lsp/server.rb +0 -2
  509. data/lib/rubocop/lsp/stdin_runner.rb +69 -0
  510. data/lib/rubocop/magic_comment.rb +31 -3
  511. data/lib/rubocop/options.rb +28 -12
  512. data/lib/rubocop/path_util.rb +15 -8
  513. data/lib/rubocop/pending_cops_reporter.rb +56 -0
  514. data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
  515. data/lib/rubocop/plugin/load_error.rb +26 -0
  516. data/lib/rubocop/plugin/loader.rb +100 -0
  517. data/lib/rubocop/plugin/not_supported_error.rb +29 -0
  518. data/lib/rubocop/plugin.rb +46 -0
  519. data/lib/rubocop/rake_task.rb +5 -2
  520. data/lib/rubocop/remote_config.rb +7 -8
  521. data/lib/rubocop/result_cache.rb +61 -48
  522. data/lib/rubocop/rspec/cop_helper.rb +13 -1
  523. data/lib/rubocop/rspec/expect_offense.rb +15 -5
  524. data/lib/rubocop/rspec/shared_contexts.rb +38 -1
  525. data/lib/rubocop/rspec/support.rb +4 -2
  526. data/lib/rubocop/runner.rb +35 -18
  527. data/lib/rubocop/server/cache.rb +51 -13
  528. data/lib/rubocop/server/cli.rb +2 -2
  529. data/lib/rubocop/server/client_command/base.rb +10 -0
  530. data/lib/rubocop/server/client_command/exec.rb +2 -1
  531. data/lib/rubocop/server/client_command/start.rb +11 -1
  532. data/lib/rubocop/target_finder.rb +14 -9
  533. data/lib/rubocop/target_ruby.rb +27 -3
  534. data/lib/rubocop/version.rb +53 -12
  535. data/lib/rubocop.rb +45 -2
  536. data/lib/ruby_lsp/rubocop/addon.rb +90 -0
  537. data/lib/ruby_lsp/rubocop/runtime_adapter.rb +99 -0
  538. metadata +92 -21
  539. data/lib/rubocop/cop/utils/regexp_ranges.rb +0 -113
  540. data/lib/rubocop/rspec/host_environment_simulation_helper.rb +0 -28
data/config/default.yml CHANGED
@@ -146,12 +146,14 @@ AllCops:
146
146
  # Ruby version is still unresolved, RuboCop will use the oldest officially
147
147
  # supported Ruby version (currently Ruby 2.7).
148
148
  TargetRubyVersion: ~
149
- # You can specify the parser engine. There are two options available:
149
+ # RuboCop choses the parser engine automatically but you can also specify it yourself.
150
+ # These options are available:
151
+ # - `default`
150
152
  # - `parser_whitequark` ... https://github.com/whitequark/parser
151
153
  # - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
152
- # By default, `parser` is used. For the `TargetRubyVersion` value, `parser` can be specified for versions `2.0` and above.
153
- # `parser_prism` can be specified for versions `3.3` and above. `parser_prism` is faster but still considered experimental.
154
- ParserEngine: parser_whitequark
154
+ # Not every parser engine can handle every `TargetRubyVersion`. `parser_whitequark`
155
+ # only works with versions 3.4 and below, `parser_prism` with versions 3.3 and above.
156
+ ParserEngine: default
155
157
  # Determines if a notification for extension libraries should be shown when
156
158
  # rubocop is run. Keys are the name of the extension, and values are an array
157
159
  # of gems in the Gemfile that the extension is suggested for, if not already
@@ -272,12 +274,20 @@ Bundler/OrderedGems:
272
274
  Gemspec/AddRuntimeDependency:
273
275
  Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
274
276
  StyleGuide: '#add_dependency_vs_add_runtime_dependency'
275
- Reference: https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
277
+ References:
278
+ - https://github.com/ruby/rubygems/issues/7799#issuecomment-2192720316
276
279
  Enabled: pending
277
280
  VersionAdded: '1.65'
278
281
  Include:
279
282
  - '**/*.gemspec'
280
283
 
284
+ Gemspec/AttributeAssignment:
285
+ Description: 'Use consistent style for Gemspec attributes assignment.'
286
+ Enabled: pending
287
+ VersionAdded: '1.77'
288
+ Include:
289
+ - '**/*.gemspec'
290
+
281
291
  Gemspec/DependencyVersion:
282
292
  Description: 'Requires or forbids specifying gem dependency versions.'
283
293
  Enabled: false
@@ -341,7 +351,7 @@ Gemspec/RequireMFA:
341
351
  Severity: warning
342
352
  VersionAdded: '1.23'
343
353
  VersionChanged: '1.40'
344
- Reference:
354
+ References:
345
355
  - https://guides.rubygems.org/mfa-requirement-opt-in/
346
356
  Include:
347
357
  - '**/*.gemspec'
@@ -368,7 +378,7 @@ Gemspec/RubyVersionGlobalsUsage:
368
378
  #################### Layout ###########################
369
379
 
370
380
  Layout/AccessModifierIndentation:
371
- Description: Check indentation of private/protected visibility modifiers.
381
+ Description: Checks indentation of private/protected visibility modifiers.
372
382
  StyleGuide: '#indent-public-private-protected'
373
383
  Enabled: true
374
384
  VersionAdded: '0.49'
@@ -602,7 +612,7 @@ Layout/EmptyLineAfterMultilineCondition:
602
612
  # This is disabled, because this style is not very common in practice.
603
613
  Enabled: false
604
614
  VersionAdded: '0.90'
605
- Reference:
615
+ References:
606
616
  - https://github.com/airbnb/ruby#multiline-if-newline
607
617
 
608
618
  Layout/EmptyLineBetweenDefs:
@@ -628,6 +638,12 @@ Layout/EmptyLines:
628
638
  Enabled: true
629
639
  VersionAdded: '0.49'
630
640
 
641
+ Layout/EmptyLinesAfterModuleInclusion:
642
+ Description: 'Keeps track of empty lines after module inclusion methods.'
643
+ StyleGuide: '#empty-lines-after-module-inclusion'
644
+ Enabled: pending
645
+ VersionAdded: '1.79'
646
+
631
647
  Layout/EmptyLinesAroundAccessModifier:
632
648
  Description: "Keep blank lines around access modifiers."
633
649
  StyleGuide: '#empty-lines-around-access-modifier'
@@ -637,7 +653,7 @@ Layout/EmptyLinesAroundAccessModifier:
637
653
  SupportedStyles:
638
654
  - around
639
655
  - only_before
640
- Reference:
656
+ References:
641
657
  # A reference to `EnforcedStyle: only_before`.
642
658
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
643
659
 
@@ -994,7 +1010,7 @@ Layout/IndentationConsistency:
994
1010
  SupportedStyles:
995
1011
  - normal
996
1012
  - indented_internal_methods
997
- Reference:
1013
+ References:
998
1014
  # A reference to `EnforcedStyle: indented_internal_methods`.
999
1015
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
1000
1016
 
@@ -1038,9 +1054,10 @@ Layout/LeadingCommentSpace:
1038
1054
  AllowDoxygenCommentStyle: false
1039
1055
  AllowGemfileRubyComment: false
1040
1056
  AllowRBSInlineAnnotation: false
1057
+ AllowSteepAnnotation: false
1041
1058
 
1042
1059
  Layout/LeadingEmptyLines:
1043
- Description: Check for unnecessary blank lines at the beginning of a file.
1060
+ Description: Checks for unnecessary blank lines at the beginning of a file.
1044
1061
  Enabled: true
1045
1062
  VersionAdded: '0.57'
1046
1063
  VersionChanged: '0.77'
@@ -1085,22 +1102,28 @@ Layout/LineLength:
1085
1102
  StyleGuide: '#max-line-length'
1086
1103
  Enabled: true
1087
1104
  VersionAdded: '0.25'
1088
- VersionChanged: '1.4'
1105
+ VersionChanged: '1.82'
1089
1106
  Max: 120
1107
+ AllowHeredoc: true
1090
1108
  # To make it possible to copy or click on URIs in the code, we allow lines
1091
1109
  # containing a URI to be longer than Max.
1092
- AllowHeredoc: true
1093
1110
  AllowURI: true
1111
+ AllowQualifiedName: true
1094
1112
  URISchemes:
1095
1113
  - http
1096
1114
  - https
1097
- # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1115
+ # The AllowRBSInlineAnnotation option makes LineLength allow RBS::Inline annotations
1116
+ # such as `#: (?date: Date) -> Foo` when calculating line length.
1117
+ AllowRBSInlineAnnotation: false
1118
+ # The AllowCopDirectives option causes the LineLength rule to ignore cop
1098
1119
  # directives like '# rubocop: enable ...' when calculating a line's length.
1099
- IgnoreCopDirectives: true
1120
+ AllowCopDirectives: true
1100
1121
  # The AllowedPatterns option is a list of !ruby/regexp and/or string
1101
1122
  # elements. Strings will be converted to Regexp objects. A line that matches
1102
1123
  # any regular expression listed in this option will be ignored by LineLength.
1103
1124
  AllowedPatterns: []
1125
+ # If SplitStrings is true, long strings will be split using continuations
1126
+ SplitStrings: false
1104
1127
 
1105
1128
  Layout/MultilineArrayBraceLayout:
1106
1129
  Description: >-
@@ -1127,7 +1150,7 @@ Layout/MultilineArrayLineBreaks:
1127
1150
  AllowMultilineFinalElement: false
1128
1151
 
1129
1152
  Layout/MultilineAssignmentLayout:
1130
- Description: 'Check for a newline after the assignment operator in multi-line assignments.'
1153
+ Description: 'Checks for a newline after the assignment operator in multi-line assignments.'
1131
1154
  StyleGuide: '#indent-conditional-assignment'
1132
1155
  Enabled: false
1133
1156
  VersionAdded: '0.49'
@@ -1498,7 +1521,6 @@ Layout/SpaceInsideHashLiteralBraces:
1498
1521
  - space
1499
1522
  - no_space
1500
1523
 
1501
-
1502
1524
  Layout/SpaceInsideParens:
1503
1525
  Description: 'No spaces after ( or before ).'
1504
1526
  StyleGuide: '#spaces-braces'
@@ -1614,6 +1636,12 @@ Lint/AmbiguousRegexpLiteral:
1614
1636
  VersionAdded: '0.17'
1615
1637
  VersionChanged: '0.83'
1616
1638
 
1639
+ Lint/ArrayLiteralInRegexp:
1640
+ Description: 'Checks for an array literal interpolated inside a regexp.'
1641
+ Enabled: pending
1642
+ VersionAdded: '1.71'
1643
+ SafeAutoCorrect: false
1644
+
1617
1645
  Lint/AssignmentInCondition:
1618
1646
  Description: "Don't use assignment in conditions."
1619
1647
  StyleGuide: '#safe-assignment-in-condition'
@@ -1633,10 +1661,10 @@ Lint/BinaryOperatorWithIdenticalOperands:
1633
1661
  Enabled: true
1634
1662
  Safe: false
1635
1663
  VersionAdded: '0.89'
1636
- VersionChanged: '1.7'
1664
+ VersionChanged: '1.69'
1637
1665
 
1638
1666
  Lint/BooleanSymbol:
1639
- Description: 'Check for `:true` and `:false` symbols.'
1667
+ Description: 'Checks for `:true` and `:false` symbols.'
1640
1668
  Enabled: true
1641
1669
  SafeAutoCorrect: false
1642
1670
  VersionAdded: '0.50'
@@ -1663,8 +1691,13 @@ Lint/ConstantOverwrittenInRescue:
1663
1691
  Enabled: pending
1664
1692
  VersionAdded: '1.31'
1665
1693
 
1694
+ Lint/ConstantReassignment:
1695
+ Description: 'Checks for constant reassignments.'
1696
+ Enabled: pending
1697
+ VersionAdded: '1.70'
1698
+
1666
1699
  Lint/ConstantResolution:
1667
- Description: 'Check that constants are fully qualified with `::`.'
1700
+ Description: 'Checks that constants are fully qualified with `::`.'
1668
1701
  Enabled: false
1669
1702
  VersionAdded: '0.86'
1670
1703
  # Restrict this cop to only looking at certain names
@@ -1672,8 +1705,13 @@ Lint/ConstantResolution:
1672
1705
  # Restrict this cop from only looking at certain names
1673
1706
  Ignore: []
1674
1707
 
1708
+ Lint/CopDirectiveSyntax:
1709
+ Description: 'Checks that `# rubocop:` directives are strictly formatted.'
1710
+ Enabled: pending
1711
+ VersionAdded: '1.72'
1712
+
1675
1713
  Lint/Debugger:
1676
- Description: 'Check for debugger calls.'
1714
+ Description: 'Checks for debugger calls.'
1677
1715
  Enabled: true
1678
1716
  VersionAdded: '0.14'
1679
1717
  VersionChanged: '1.63'
@@ -1724,7 +1762,7 @@ Lint/Debugger:
1724
1762
  - debug/start
1725
1763
 
1726
1764
  Lint/DeprecatedClassMethods:
1727
- Description: 'Check for deprecated class method calls.'
1765
+ Description: 'Checks for deprecated class method calls.'
1728
1766
  Enabled: true
1729
1767
  VersionAdded: '0.19'
1730
1768
 
@@ -1785,6 +1823,7 @@ Lint/DuplicateBranch:
1785
1823
  VersionChanged: '1.7'
1786
1824
  IgnoreLiteralBranches: false
1787
1825
  IgnoreConstantBranches: false
1826
+ IgnoreDuplicateElseBranch: false
1788
1827
 
1789
1828
  Lint/DuplicateCaseCondition:
1790
1829
  Description: 'Do not repeat values in case conditionals.'
@@ -1797,13 +1836,13 @@ Lint/DuplicateElsifCondition:
1797
1836
  VersionAdded: '0.88'
1798
1837
 
1799
1838
  Lint/DuplicateHashKey:
1800
- Description: 'Check for duplicate keys in hash literals.'
1839
+ Description: 'Checks for duplicate keys in hash literals.'
1801
1840
  Enabled: true
1802
1841
  VersionAdded: '0.34'
1803
1842
  VersionChanged: '0.77'
1804
1843
 
1805
1844
  Lint/DuplicateMagicComment:
1806
- Description: 'Check for duplicated magic comments.'
1845
+ Description: 'Checks for duplicated magic comments.'
1807
1846
  Enabled: pending
1808
1847
  VersionAdded: '1.37'
1809
1848
 
@@ -1813,7 +1852,7 @@ Lint/DuplicateMatchPattern:
1813
1852
  VersionAdded: '1.50'
1814
1853
 
1815
1854
  Lint/DuplicateMethods:
1816
- Description: 'Check for duplicate method definitions.'
1855
+ Description: 'Checks for duplicate method definitions.'
1817
1856
  Enabled: true
1818
1857
  VersionAdded: '0.29'
1819
1858
 
@@ -1823,7 +1862,7 @@ Lint/DuplicateRegexpCharacterClassElement:
1823
1862
  VersionAdded: '1.1'
1824
1863
 
1825
1864
  Lint/DuplicateRequire:
1826
- Description: 'Check for duplicate `require`s and `require_relative`s.'
1865
+ Description: 'Checks for duplicate `require`s and `require_relative`s.'
1827
1866
  Enabled: true
1828
1867
  SafeAutoCorrect: false
1829
1868
  VersionAdded: '0.90'
@@ -1840,12 +1879,12 @@ Lint/DuplicateSetElement:
1840
1879
  VersionAdded: '1.67'
1841
1880
 
1842
1881
  Lint/EachWithObjectArgument:
1843
- Description: 'Check for immutable argument given to each_with_object.'
1882
+ Description: 'Checks for immutable argument given to each_with_object.'
1844
1883
  Enabled: true
1845
1884
  VersionAdded: '0.31'
1846
1885
 
1847
1886
  Lint/ElseLayout:
1848
- Description: 'Check for odd code arrangement in an else block.'
1887
+ Description: 'Checks for odd code arrangement in an else block.'
1849
1888
  Enabled: true
1850
1889
  VersionAdded: '0.17'
1851
1890
  VersionChanged: '1.2'
@@ -1868,10 +1907,9 @@ Lint/EmptyConditionalBody:
1868
1907
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1869
1908
  Enabled: true
1870
1909
  AutoCorrect: contextual
1871
- SafeAutoCorrect: false
1872
1910
  AllowComments: true
1873
1911
  VersionAdded: '0.89'
1874
- VersionChanged: '1.61'
1912
+ VersionChanged: '1.73'
1875
1913
 
1876
1914
  Lint/EmptyEnsure:
1877
1915
  Description: 'Checks for empty ensure block.'
@@ -1902,7 +1940,7 @@ Lint/EmptyInterpolation:
1902
1940
  Enabled: true
1903
1941
  AutoCorrect: contextual
1904
1942
  VersionAdded: '0.20'
1905
- VersionChanged: '1.61'
1943
+ VersionChanged: '1.76'
1906
1944
 
1907
1945
  Lint/EmptyWhen:
1908
1946
  Description: 'Checks for `when` branches with empty bodies.'
@@ -1954,6 +1992,11 @@ Lint/HashCompareByIdentity:
1954
1992
  Safe: false
1955
1993
  VersionAdded: '0.93'
1956
1994
 
1995
+ Lint/HashNewWithKeywordArgumentsAsDefault:
1996
+ Description: 'Checks for the deprecated use of keyword arguments for hash default in `Hash.new`.'
1997
+ Enabled: pending
1998
+ VersionAdded: '1.69'
1999
+
1957
2000
  Lint/HeredocMethodCallPosition:
1958
2001
  Description: >-
1959
2002
  Checks for the ordering of a method call where
@@ -2010,7 +2053,8 @@ Lint/InterpolationCheck:
2010
2053
 
2011
2054
  Lint/ItWithoutArgumentsInBlock:
2012
2055
  Description: 'Checks uses of `it` calls without arguments in block.'
2013
- Reference: 'https://bugs.ruby-lang.org/issues/18980'
2056
+ References:
2057
+ - 'https://bugs.ruby-lang.org/issues/18980'
2014
2058
  Enabled: pending
2015
2059
  VersionAdded: '1.59'
2016
2060
 
@@ -2022,6 +2066,7 @@ Lint/LambdaWithoutLiteralBlock:
2022
2066
  Lint/LiteralAsCondition:
2023
2067
  Description: 'Checks of literals used in conditions.'
2024
2068
  Enabled: true
2069
+ AutoCorrect: contextual
2025
2070
  VersionAdded: '0.51'
2026
2071
 
2027
2072
  Lint/LiteralAssignmentInCondition:
@@ -2144,6 +2189,11 @@ Lint/NumberedParameterAssignment:
2144
2189
  Enabled: pending
2145
2190
  VersionAdded: '1.9'
2146
2191
 
2192
+ Lint/NumericOperationWithConstantResult:
2193
+ Description: 'Checks for numeric operations with constant results.'
2194
+ Enabled: pending
2195
+ VersionAdded: '1.69'
2196
+
2147
2197
  Lint/OrAssignmentToConstant:
2148
2198
  Description: 'Checks unintended or-assignment to constant.'
2149
2199
  Enabled: pending
@@ -2230,14 +2280,14 @@ Lint/RedundantRegexpQuantifiers:
2230
2280
  Lint/RedundantRequireStatement:
2231
2281
  Description: 'Checks for unnecessary `require` statement.'
2232
2282
  Enabled: true
2233
- SafeAutoCorrect: false
2234
2283
  VersionAdded: '0.76'
2235
- VersionChanged: '1.57'
2284
+ VersionChanged: '1.73'
2236
2285
 
2237
2286
  Lint/RedundantSafeNavigation:
2238
2287
  Description: 'Checks for redundant safe navigation calls.'
2239
2288
  Enabled: true
2240
2289
  VersionAdded: '0.93'
2290
+ VersionChanged: '1.79'
2241
2291
  AllowedMethods:
2242
2292
  - instance_of?
2243
2293
  - kind_of?
@@ -2245,6 +2295,12 @@ Lint/RedundantSafeNavigation:
2245
2295
  - eql?
2246
2296
  - respond_to?
2247
2297
  - equal?
2298
+ InferNonNilReceiver: false
2299
+ AdditionalNilMethods:
2300
+ - present?
2301
+ - blank?
2302
+ - try
2303
+ - try!
2248
2304
  Safe: false
2249
2305
 
2250
2306
  Lint/RedundantSplatExpansion:
@@ -2261,6 +2317,11 @@ Lint/RedundantStringCoercion:
2261
2317
  VersionAdded: '0.19'
2262
2318
  VersionChanged: '0.77'
2263
2319
 
2320
+ Lint/RedundantTypeConversion:
2321
+ Description: 'Checks for redundantly converting a literal to the same type.'
2322
+ Enabled: pending
2323
+ VersionAdded: '1.72'
2324
+
2264
2325
  Lint/RedundantWithIndex:
2265
2326
  Description: 'Checks for redundant `with_index`.'
2266
2327
  Enabled: true
@@ -2363,6 +2424,7 @@ Lint/SelfAssignment:
2363
2424
  Description: 'Checks for self-assignments.'
2364
2425
  Enabled: true
2365
2426
  VersionAdded: '0.89'
2427
+ AllowRBSInlineAnnotation: false
2366
2428
 
2367
2429
  Lint/SendWithMixinArgument:
2368
2430
  Description: 'Checks for `send` method when using mixin.'
@@ -2375,7 +2437,6 @@ Lint/ShadowedArgument:
2375
2437
  VersionAdded: '0.52'
2376
2438
  IgnoreImplicitReferences: false
2377
2439
 
2378
-
2379
2440
  Lint/ShadowedException:
2380
2441
  Description: >-
2381
2442
  Avoid rescuing a higher level exception
@@ -2387,8 +2448,15 @@ Lint/ShadowingOuterLocalVariable:
2387
2448
  Description: >-
2388
2449
  Do not use the same name as outer local variable
2389
2450
  for block arguments or block local variables.
2390
- Enabled: true
2451
+ Enabled: false
2391
2452
  VersionAdded: '0.9'
2453
+ VersionChanged: '1.76'
2454
+
2455
+ Lint/SharedMutableDefault:
2456
+ Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
2457
+ StyleGuide: '#no-mutable-defaults'
2458
+ Enabled: pending
2459
+ VersionAdded: '1.70'
2392
2460
 
2393
2461
  Lint/StructNewOverride:
2394
2462
  Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
@@ -2404,6 +2472,12 @@ Lint/SuppressedException:
2404
2472
  VersionAdded: '0.9'
2405
2473
  VersionChanged: '1.12'
2406
2474
 
2475
+ Lint/SuppressedExceptionInNumberConversion:
2476
+ Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
2477
+ Enabled: pending
2478
+ SafeAutoCorrect: false
2479
+ VersionAdded: '1.72'
2480
+
2407
2481
  Lint/SymbolConversion:
2408
2482
  Description: 'Checks for unnecessary symbol conversions.'
2409
2483
  Enabled: pending
@@ -2455,6 +2529,11 @@ Lint/UnderscorePrefixedVariableName:
2455
2529
  VersionAdded: '0.21'
2456
2530
  AllowKeywordBlockArguments: false
2457
2531
 
2532
+ Lint/UnescapedBracketInRegexp:
2533
+ Description: 'Checks for unescaped literal `]` in Regexp.'
2534
+ Enabled: pending
2535
+ VersionAdded: '1.68'
2536
+
2458
2537
  Lint/UnexpectedBlockArity:
2459
2538
  Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2460
2539
  Enabled: pending
@@ -2514,10 +2593,12 @@ Lint/UnusedMethodArgument:
2514
2593
  Enabled: true
2515
2594
  AutoCorrect: contextual
2516
2595
  VersionAdded: '0.21'
2517
- VersionChanged: '1.61'
2596
+ VersionChanged: '1.69'
2518
2597
  AllowUnusedKeywordArguments: false
2519
2598
  IgnoreEmptyMethods: true
2520
2599
  IgnoreNotImplementedMethods: true
2600
+ NotImplementedExceptions:
2601
+ - NotImplementedError
2521
2602
 
2522
2603
  Lint/UriEscapeUnescape:
2523
2604
  Description: >-
@@ -2552,6 +2633,23 @@ Lint/UselessAssignment:
2552
2633
  VersionAdded: '0.11'
2553
2634
  VersionChanged: '1.66'
2554
2635
 
2636
+ Lint/UselessConstantScoping:
2637
+ Description: 'Checks for useless constant scoping.'
2638
+ Enabled: pending
2639
+ VersionAdded: '1.72'
2640
+
2641
+ Lint/UselessDefaultValueArgument:
2642
+ Description: 'Checks for usage of `fetch` or `Array.new` with default value argument and block.'
2643
+ Enabled: pending
2644
+ VersionAdded: '1.76'
2645
+ Safe: false
2646
+ AllowedReceivers: []
2647
+
2648
+ Lint/UselessDefined:
2649
+ Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
2650
+ Enabled: pending
2651
+ VersionAdded: '1.69'
2652
+
2555
2653
  Lint/UselessElseWithoutRescue:
2556
2654
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2557
2655
  Enabled: true
@@ -2571,6 +2669,14 @@ Lint/UselessNumericOperation:
2571
2669
  Enabled: pending
2572
2670
  VersionAdded: '1.66'
2573
2671
 
2672
+ Lint/UselessOr:
2673
+ Description: 'Checks for useless OR expressions.'
2674
+ Enabled: pending
2675
+ SafeAutoCorrect: false
2676
+ AutoCorrect: contextual
2677
+ VersionAdded: '1.76'
2678
+ VersionChanged: '1.82'
2679
+
2574
2680
  Lint/UselessRescue:
2575
2681
  Description: 'Checks for useless `rescue`s.'
2576
2682
  Enabled: pending
@@ -2610,8 +2716,8 @@ Metrics/AbcSize:
2610
2716
  Description: >-
2611
2717
  A calculated magnitude based on number of assignments,
2612
2718
  branches, and conditions.
2613
- Reference:
2614
- - http://c2.com/cgi/wiki?AbcMetric
2719
+ References:
2720
+ - https://wiki.c2.com/?AbcMetric
2615
2721
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
2616
2722
  Enabled: true
2617
2723
  VersionAdded: '0.27'
@@ -2730,7 +2836,7 @@ Migration/DepartmentName:
2730
2836
  #################### Naming ##############################
2731
2837
 
2732
2838
  Naming/AccessorMethodName:
2733
- Description: Check the naming of accessor methods for get_/set_.
2839
+ Description: Checks the naming of accessor methods for get_/set_.
2734
2840
  StyleGuide: '#accessor_mutator_method_names'
2735
2841
  Enabled: true
2736
2842
  VersionAdded: '0.50'
@@ -2934,6 +3040,7 @@ Naming/MethodName:
2934
3040
  StyleGuide: '#snake-case-symbols-methods-vars'
2935
3041
  Enabled: true
2936
3042
  VersionAdded: '0.50'
3043
+ VersionChanged: '1.75'
2937
3044
  EnforcedStyle: snake_case
2938
3045
  SupportedStyles:
2939
3046
  - snake_case
@@ -2945,6 +3052,10 @@ Naming/MethodName:
2945
3052
  # - '\A\s*onSelectionCleared\s*'
2946
3053
  #
2947
3054
  AllowedPatterns: []
3055
+ ForbiddenIdentifiers:
3056
+ - __id__
3057
+ - __send__
3058
+ ForbiddenPatterns: []
2948
3059
 
2949
3060
  Naming/MethodParameterName:
2950
3061
  Description: >-
@@ -2976,22 +3087,42 @@ Naming/MethodParameterName:
2976
3087
  # Forbidden names that will register an offense
2977
3088
  ForbiddenNames: []
2978
3089
 
2979
- Naming/PredicateName:
2980
- Description: 'Check the names of predicate methods.'
3090
+ Naming/PredicateMethod:
3091
+ Description: 'Checks that predicate methods end with `?` and non-predicate methods do not.'
3092
+ Enabled: pending
3093
+ VersionAdded: '1.76'
3094
+ VersionChanged: '1.78'
3095
+ # In `aggressive` mode, the cop will register an offense for predicate methods that
3096
+ # may return a non-boolean value.
3097
+ # In `conservative` mode, the cop will *not* register an offense for predicate methods
3098
+ # that may return a non-boolean value.
3099
+ Mode: conservative
3100
+ AllowedMethods:
3101
+ - call
3102
+ AllowedPatterns: []
3103
+ AllowBangMethods: false
3104
+ # Methods that are known to not return a boolean value, despite ending in `?`.
3105
+ WaywardPredicates:
3106
+ - nonzero?
3107
+
3108
+ Naming/PredicatePrefix:
3109
+ Description: 'Predicate method names should not be prefixed and end with a `?`.'
2981
3110
  StyleGuide: '#bool-methods-qmark'
2982
3111
  Enabled: true
2983
3112
  VersionAdded: '0.50'
2984
- VersionChanged: '0.77'
3113
+ VersionChanged: '1.75'
2985
3114
  # Predicate name prefixes.
2986
3115
  NamePrefix:
2987
3116
  - is_
2988
3117
  - has_
2989
3118
  - have_
3119
+ - does_
2990
3120
  # Predicate name prefixes that should be removed.
2991
3121
  ForbiddenPrefixes:
2992
3122
  - is_
2993
3123
  - has_
2994
3124
  - have_
3125
+ - does_
2995
3126
  # Predicate names which, despite having a forbidden prefix, or no `?`,
2996
3127
  # should still be accepted
2997
3128
  AllowedMethods:
@@ -3000,6 +3131,8 @@ Naming/PredicateName:
3000
3131
  MethodDefinitionMacros:
3001
3132
  - define_method
3002
3133
  - define_singleton_method
3134
+ # Use Sorbet's T::Boolean return type to detect predicate methods.
3135
+ UseSorbetSigs: false
3003
3136
  # Exclude Rspec specs because there is a strong convention to write spec
3004
3137
  # helpers in the form of `have_something` or `be_something`.
3005
3138
  Exclude:
@@ -3017,13 +3150,15 @@ Naming/VariableName:
3017
3150
  StyleGuide: '#snake-case-symbols-methods-vars'
3018
3151
  Enabled: true
3019
3152
  VersionAdded: '0.50'
3020
- VersionChanged: '1.8'
3153
+ VersionChanged: '1.73'
3021
3154
  EnforcedStyle: snake_case
3022
3155
  SupportedStyles:
3023
3156
  - snake_case
3024
3157
  - camelCase
3025
3158
  AllowedIdentifiers: []
3026
3159
  AllowedPatterns: []
3160
+ ForbiddenIdentifiers: []
3161
+ ForbiddenPatterns: []
3027
3162
 
3028
3163
  Naming/VariableNumber:
3029
3164
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -3039,6 +3174,8 @@ Naming/VariableNumber:
3039
3174
  CheckMethodNames: true
3040
3175
  CheckSymbols: true
3041
3176
  AllowedIdentifiers:
3177
+ - TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
3178
+ - TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
3042
3179
  - capture3 # Open3.capture3
3043
3180
  - iso8601 # Time#iso8601
3044
3181
  - rfc1123_date # CGI.rfc1123_date
@@ -3074,7 +3211,9 @@ Security/JSONLoad:
3074
3211
  Description: >-
3075
3212
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
3076
3213
  security issues. See reference for more information.
3077
- Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3214
+ References:
3215
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3216
+ - 'https://bugs.ruby-lang.org/issues/19528'
3078
3217
  Enabled: true
3079
3218
  VersionAdded: '0.43'
3080
3219
  VersionChanged: '1.22'
@@ -3086,7 +3225,8 @@ Security/MarshalLoad:
3086
3225
  Description: >-
3087
3226
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
3088
3227
  security issues. See reference for more information.
3089
- Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3228
+ References:
3229
+ - 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3090
3230
  Enabled: true
3091
3231
  VersionAdded: '0.47'
3092
3232
 
@@ -3101,7 +3241,8 @@ Security/YAMLLoad:
3101
3241
  Description: >-
3102
3242
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
3103
3243
  security issues. See reference for more information.
3104
- Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3244
+ References:
3245
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3105
3246
  Enabled: true
3106
3247
  VersionAdded: '0.47'
3107
3248
  SafeAutoCorrect: false
@@ -3112,13 +3253,14 @@ Style/AccessModifierDeclarations:
3112
3253
  Description: 'Checks style of how access modifiers are used.'
3113
3254
  Enabled: true
3114
3255
  VersionAdded: '0.57'
3115
- VersionChanged: '0.81'
3256
+ VersionChanged: '1.70'
3116
3257
  EnforcedStyle: group
3117
3258
  SupportedStyles:
3118
3259
  - inline
3119
3260
  - group
3120
3261
  AllowModifiersOnSymbols: true
3121
3262
  AllowModifiersOnAttrs: true
3263
+ AllowModifiersOnAliasMethod: true
3122
3264
  SafeAutoCorrect: false
3123
3265
 
3124
3266
  Style/AccessorGrouping:
@@ -3143,6 +3285,12 @@ Style/Alias:
3143
3285
  - prefer_alias
3144
3286
  - prefer_alias_method
3145
3287
 
3288
+ Style/AmbiguousEndlessMethodDefinition:
3289
+ Description: 'Checks for endless methods inside operators of lower precedence.'
3290
+ StyleGuide: '#ambiguous-endless-method-definitions'
3291
+ Enabled: pending
3292
+ VersionAdded: '1.68'
3293
+
3146
3294
  Style/AndOr:
3147
3295
  Description: 'Use &&/|| instead of and/or.'
3148
3296
  StyleGuide: '#no-and-or-or'
@@ -3188,7 +3336,8 @@ Style/ArrayCoercion:
3188
3336
 
3189
3337
  Style/ArrayFirstLast:
3190
3338
  Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3191
- Reference: '#first-and-last'
3339
+ References:
3340
+ - '#first-and-last'
3192
3341
  Enabled: false
3193
3342
  VersionAdded: '1.58'
3194
3343
  Safe: false
@@ -3199,6 +3348,12 @@ Style/ArrayIntersect:
3199
3348
  Safe: false
3200
3349
  VersionAdded: '1.40'
3201
3350
 
3351
+ Style/ArrayIntersectWithSingleElement:
3352
+ Description: 'Use `include?(element)` instead of `intersect?([element])`.'
3353
+ Enabled: 'pending'
3354
+ Safe: false
3355
+ VersionAdded: '1.81'
3356
+
3202
3357
  Style/ArrayJoin:
3203
3358
  Description: 'Use Array#join instead of Array#*.'
3204
3359
  StyleGuide: '#array-join'
@@ -3250,6 +3405,13 @@ Style/BisectedAttrAccessor:
3250
3405
  Enabled: true
3251
3406
  VersionAdded: '0.87'
3252
3407
 
3408
+ Style/BitwisePredicate:
3409
+ Description: 'Prefer bitwise predicate methods over direct comparison operations.'
3410
+ StyleGuide: '#bitwise-predicate-methods'
3411
+ Enabled: pending
3412
+ Safe: false
3413
+ VersionAdded: '1.68'
3414
+
3253
3415
  Style/BlockComments:
3254
3416
  Description: 'Do not use block comments.'
3255
3417
  StyleGuide: '#no-block-comments'
@@ -3369,9 +3531,11 @@ Style/BlockDelimiters:
3369
3531
  BracesRequiredMethods: []
3370
3532
 
3371
3533
  Style/CaseEquality:
3372
- Description: 'Avoid explicit use of the case equality operator(===).'
3534
+ Description: 'Avoid explicit use of the case equality operator (`===`).'
3373
3535
  StyleGuide: '#no-case-equality'
3374
3536
  Enabled: true
3537
+ References:
3538
+ - 'https://docs.rubocop.org/rubocop-performance/cops_performance.html#performanceregexpmatch'
3375
3539
  VersionAdded: '0.9'
3376
3540
  VersionChanged: '0.89'
3377
3541
  # If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
@@ -3420,6 +3584,7 @@ Style/ClassAndModuleChildren:
3420
3584
  SafeAutoCorrect: false
3421
3585
  Enabled: true
3422
3586
  VersionAdded: '0.19'
3587
+ VersionChanged: '1.74'
3423
3588
  #
3424
3589
  # Basically there are two different styles:
3425
3590
  #
@@ -3435,7 +3600,21 @@ Style/ClassAndModuleChildren:
3435
3600
  #
3436
3601
  # The compact style is only forced, for classes or modules with one child.
3437
3602
  EnforcedStyle: nested
3438
- SupportedStyles:
3603
+ SupportedStyles: &supported_styles
3604
+ - nested
3605
+ - compact
3606
+ # Configure classes separately, if desired. If not set, or set to `nil`,
3607
+ # the `EnforcedStyle` value will be used.
3608
+ EnforcedStyleForClasses: ~
3609
+ SupportedStylesForClasses:
3610
+ - ~
3611
+ - nested
3612
+ - compact
3613
+ # Configure modules separately, if desired. If not set, or set to `nil`,
3614
+ # the `EnforcedStyle` value will be used.
3615
+ EnforcedStyleForModules: ~
3616
+ SupportedStylesForModules:
3617
+ - ~
3439
3618
  - nested
3440
3619
  - compact
3441
3620
 
@@ -3521,6 +3700,13 @@ Style/CollectionMethods:
3521
3700
  - inject
3522
3701
  - reduce
3523
3702
 
3703
+ Style/CollectionQuerying:
3704
+ Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
3705
+ StyleGuide: '#collection-querying'
3706
+ Enabled: pending
3707
+ VersionAdded: '1.77'
3708
+ Safe: false
3709
+
3524
3710
  Style/ColonMethodCall:
3525
3711
  Description: 'Do not use :: for method call.'
3526
3712
  StyleGuide: '#double-colons'
@@ -3533,6 +3719,11 @@ Style/ColonMethodDefinition:
3533
3719
  Enabled: true
3534
3720
  VersionAdded: '0.52'
3535
3721
 
3722
+ Style/CombinableDefined:
3723
+ Description: 'Checks successive `defined?` calls that can be combined into a single call.'
3724
+ Enabled: pending
3725
+ VersionAdded: '1.68'
3726
+
3536
3727
  Style/CombinableLoops:
3537
3728
  Description: >-
3538
3729
  Checks for places where multiple consecutive loops over the same data
@@ -3583,6 +3774,14 @@ Style/CommentedKeyword:
3583
3774
  VersionAdded: '0.51'
3584
3775
  VersionChanged: '1.19'
3585
3776
 
3777
+ Style/ComparableBetween:
3778
+ Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
3779
+ Enabled: pending
3780
+ Safe: false
3781
+ VersionAdded: '1.74'
3782
+ VersionChanged: '1.75'
3783
+ StyleGuide: '#ranges-or-between'
3784
+
3586
3785
  Style/ComparableClamp:
3587
3786
  Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3588
3787
  Enabled: pending
@@ -3673,6 +3872,12 @@ Style/DefWithParentheses:
3673
3872
  VersionAdded: '0.9'
3674
3873
  VersionChanged: '0.12'
3675
3874
 
3875
+ Style/DigChain:
3876
+ Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
3877
+ Enabled: pending
3878
+ Safe: false
3879
+ VersionAdded: '1.69'
3880
+
3676
3881
  Style/Dir:
3677
3882
  Description: >-
3678
3883
  Use the `__dir__` method to retrieve the canonicalized
@@ -3809,6 +4014,16 @@ Style/EmptyMethod:
3809
4014
  - compact
3810
4015
  - expanded
3811
4016
 
4017
+ Style/EmptyStringInsideInterpolation:
4018
+ Description: 'Checks for empty strings being assigned inside string interpolation.'
4019
+ StyleGuide: '#empty-strings-in-interpolation'
4020
+ Enabled: pending
4021
+ EnforcedStyle: trailing_conditional
4022
+ SupportedStyles:
4023
+ - trailing_conditional
4024
+ - ternary
4025
+ VersionAdded: '1.76'
4026
+
3812
4027
  Style/Encoding:
3813
4028
  Description: 'Use UTF-8 as the source file encoding.'
3814
4029
  StyleGuide: '#utf-8'
@@ -3833,6 +4048,8 @@ Style/EndlessMethod:
3833
4048
  - allow_single_line
3834
4049
  - allow_always
3835
4050
  - disallow
4051
+ - require_single_line
4052
+ - require_always
3836
4053
 
3837
4054
  Style/EnvHome:
3838
4055
  Description: "Checks for consistent usage of `ENV['HOME']`."
@@ -3885,12 +4102,15 @@ Style/ExponentialNotation:
3885
4102
  Style/FetchEnvVar:
3886
4103
  Description: >-
3887
4104
  Suggests `ENV.fetch` for the replacement of `ENV[]`.
3888
- Reference:
4105
+ References:
3889
4106
  - https://rubystyle.guide/#hash-fetch-defaults
3890
4107
  Enabled: pending
3891
4108
  VersionAdded: '1.28'
3892
4109
  # Environment variables to be excluded from the inspection.
3893
4110
  AllowedVars: []
4111
+ # When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
4112
+ # When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
4113
+ DefaultToNil: true
3894
4114
 
3895
4115
  Style/FileEmpty:
3896
4116
  Description: >-
@@ -3899,12 +4119,24 @@ Style/FileEmpty:
3899
4119
  Safe: false
3900
4120
  VersionAdded: '1.48'
3901
4121
 
4122
+ Style/FileNull:
4123
+ Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
4124
+ Enabled: pending
4125
+ SafeAutoCorrect: false
4126
+ VersionAdded: '1.69'
4127
+
3902
4128
  Style/FileRead:
3903
4129
  Description: 'Favor `File.(bin)read` convenience methods.'
3904
4130
  StyleGuide: '#file-read'
3905
4131
  Enabled: pending
3906
4132
  VersionAdded: '1.24'
3907
4133
 
4134
+ Style/FileTouch:
4135
+ Description: 'Favor `FileUtils.touch` for touching files.'
4136
+ Enabled: pending
4137
+ VersionAdded: '1.69'
4138
+ SafeAutoCorrect: false
4139
+
3908
4140
  Style/FileWrite:
3909
4141
  Description: 'Favor `File.(bin)write` convenience methods.'
3910
4142
  StyleGuide: '#file-write'
@@ -3914,7 +4146,8 @@ Style/FileWrite:
3914
4146
  Style/FloatDivision:
3915
4147
  Description: 'For performing float division, coerce one side only.'
3916
4148
  StyleGuide: '#float-division'
3917
- Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
4149
+ References:
4150
+ - 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3918
4151
  Enabled: true
3919
4152
  VersionAdded: '0.72'
3920
4153
  VersionChanged: '1.9'
@@ -3965,8 +4198,14 @@ Style/FormatStringToken:
3965
4198
  # style token in a format string to be allowed when enforced style is not
3966
4199
  # `unannotated`.
3967
4200
  MaxUnannotatedPlaceholdersAllowed: 1
4201
+ # The mode the cop operates in. Two values are allowed:
4202
+ # * aggressive (default): all strings are considered
4203
+ # * conservative:
4204
+ # only register offenses for strings given to `printf`, `sprintf`,
4205
+ # format` and `%` methods. Other strings are not considered.
4206
+ Mode: aggressive
3968
4207
  VersionAdded: '0.49'
3969
- VersionChanged: '1.0'
4208
+ VersionChanged: '1.74'
3970
4209
  AllowedMethods: []
3971
4210
  AllowedPatterns: []
3972
4211
 
@@ -3991,6 +4230,9 @@ Style/FrozenStringLiteralComment:
3991
4230
  # exist in a file.
3992
4231
  - never
3993
4232
  SafeAutoCorrect: false
4233
+ Exclude:
4234
+ # Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
4235
+ - '**/*.arb'
3994
4236
 
3995
4237
  Style/GlobalStdStream:
3996
4238
  Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
@@ -4002,14 +4244,15 @@ Style/GlobalStdStream:
4002
4244
  Style/GlobalVars:
4003
4245
  Description: 'Do not introduce global variables.'
4004
4246
  StyleGuide: '#instance-vars'
4005
- Reference: 'https://www.zenspider.com/ruby/quickref.html'
4247
+ References:
4248
+ - 'https://www.zenspider.com/ruby/quickref.html'
4006
4249
  Enabled: true
4007
4250
  VersionAdded: '0.13'
4008
4251
  # Built-in global variables are allowed by default.
4009
4252
  AllowedVariables: []
4010
4253
 
4011
4254
  Style/GuardClause:
4012
- Description: 'Check for conditionals that can be replaced with guard clauses.'
4255
+ Description: 'Checks for conditionals that can be replaced with guard clauses.'
4013
4256
  StyleGuide: '#no-nested-conditionals'
4014
4257
  Enabled: true
4015
4258
  VersionAdded: '0.20'
@@ -4059,6 +4302,12 @@ Style/HashExcept:
4059
4302
  VersionAdded: '1.7'
4060
4303
  VersionChanged: '1.39'
4061
4304
 
4305
+ Style/HashFetchChain:
4306
+ Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
4307
+ Enabled: pending
4308
+ Safe: false
4309
+ VersionAdded: '1.75'
4310
+
4062
4311
  Style/HashLikeCase:
4063
4312
  Description: >-
4064
4313
  Checks for places where `case-when` represents a simple 1:1
@@ -4069,6 +4318,14 @@ Style/HashLikeCase:
4069
4318
  # to trigger this cop
4070
4319
  MinBranchesCount: 3
4071
4320
 
4321
+ Style/HashSlice:
4322
+ Description: >-
4323
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
4324
+ that can be replaced with `Hash#slice` method.
4325
+ Enabled: pending
4326
+ Safe: false
4327
+ VersionAdded: '1.71'
4328
+
4072
4329
  Style/HashSyntax:
4073
4330
  Description: >-
4074
4331
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -4256,6 +4513,31 @@ Style/IpAddresses:
4256
4513
  - '**/gems.rb'
4257
4514
  - '**/*.gemspec'
4258
4515
 
4516
+ Style/ItAssignment:
4517
+ Description: 'Checks for local variables and method parameters named `it`.'
4518
+ Enabled: pending
4519
+ VersionAdded: '1.70'
4520
+
4521
+ Style/ItBlockParameter:
4522
+ Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
4523
+ Enabled: pending
4524
+ EnforcedStyle: allow_single_line
4525
+ SupportedStyles:
4526
+ - allow_single_line
4527
+ - only_numbered_parameters
4528
+ - always
4529
+ - disallow
4530
+ VersionAdded: '1.75'
4531
+ VersionChanged: '1.76'
4532
+
4533
+ Style/KeywordArgumentsMerging:
4534
+ Description: >-
4535
+ When passing an existing hash as keyword arguments, provide additional arguments
4536
+ directly rather than using `merge`.
4537
+ StyleGuide: '#merging-keyword-arguments'
4538
+ Enabled: pending
4539
+ VersionAdded: '1.68'
4540
+
4259
4541
  Style/KeywordParametersOrder:
4260
4542
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
4261
4543
  StyleGuide: '#keyword-parameters-order'
@@ -4279,8 +4561,9 @@ Style/LambdaCall:
4279
4561
  Description: 'Use lambda.call(...) instead of lambda.(...).'
4280
4562
  StyleGuide: '#proc-call'
4281
4563
  Enabled: true
4564
+ AutoCorrect: contextual
4282
4565
  VersionAdded: '0.13'
4283
- VersionChanged: '0.14'
4566
+ VersionChanged: '1.81'
4284
4567
  EnforcedStyle: call
4285
4568
  SupportedStyles:
4286
4569
  - call
@@ -4350,6 +4633,7 @@ Style/MethodCallWithArgsParentheses:
4350
4633
  AllowedMethods: []
4351
4634
  AllowedPatterns: []
4352
4635
  IncludedMacros: []
4636
+ IncludedMacroPatterns: []
4353
4637
  AllowParenthesesInMultilineCall: false
4354
4638
  AllowParenthesesInChaining: false
4355
4639
  AllowParenthesesInCamelCaseMethod: false
@@ -4460,6 +4744,11 @@ Style/ModuleFunction:
4460
4744
  Autocorrect: false
4461
4745
  SafeAutoCorrect: false
4462
4746
 
4747
+ Style/ModuleMemberExistenceCheck:
4748
+ Description: 'Checks for usage of `Module` methods returning arrays that can be replaced with equivalent predicates.'
4749
+ Enabled: pending
4750
+ VersionAdded: '1.82'
4751
+
4463
4752
  Style/MultilineBlockChain:
4464
4753
  Description: 'Avoid multi-line chains of blocks.'
4465
4754
  StyleGuide: '#single-line-blocks'
@@ -4636,7 +4925,7 @@ Style/Next:
4636
4925
  StyleGuide: '#no-nested-conditionals'
4637
4926
  Enabled: true
4638
4927
  VersionAdded: '0.22'
4639
- VersionChanged: '0.35'
4928
+ VersionChanged: '1.75'
4640
4929
  # With `always` all conditions at the end of an iteration needs to be
4641
4930
  # replaced by next - with `skip_modifier_ifs` the modifier if like this one
4642
4931
  # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
@@ -4644,6 +4933,7 @@ Style/Next:
4644
4933
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
4645
4934
  # needs to have to trigger this cop
4646
4935
  MinBodyLength: 3
4936
+ AllowConsecutiveConditionals: false
4647
4937
  SupportedStyles:
4648
4938
  - skip_modifier_ifs
4649
4939
  - always
@@ -4775,8 +5065,8 @@ Style/OpenStructUse:
4775
5065
  Description: >-
4776
5066
  Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4777
5067
  version compatibility, and potential security issues.
4778
- Reference:
4779
- - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
5068
+ References:
5069
+ - https://docs.ruby-lang.org/en/3.0/OpenStruct.html#class-OpenStruct-label-Caveats
4780
5070
 
4781
5071
  Enabled: pending
4782
5072
  Safe: false
@@ -4932,7 +5222,7 @@ Style/RandomWithOffset:
4932
5222
  VersionAdded: '0.52'
4933
5223
 
4934
5224
  Style/RedundantArgument:
4935
- Description: 'Check for a redundant argument passed to certain methods.'
5225
+ Description: 'Checks for a redundant argument passed to certain methods.'
4936
5226
  Enabled: pending
4937
5227
  Safe: false
4938
5228
  VersionAdded: '1.4'
@@ -4946,6 +5236,8 @@ Style/RedundantArgument:
4946
5236
  exit: true
4947
5237
  # Kernel.#exit!
4948
5238
  exit!: false
5239
+ # String#to_i
5240
+ to_i: 10
4949
5241
  # String#split
4950
5242
  split: ' '
4951
5243
  # String#chomp
@@ -4958,6 +5250,12 @@ Style/RedundantArrayConstructor:
4958
5250
  Enabled: pending
4959
5251
  VersionAdded: '1.52'
4960
5252
 
5253
+ Style/RedundantArrayFlatten:
5254
+ Description: 'Checks for redundant calls of `Array#flatten`.'
5255
+ Enabled: pending
5256
+ Safe: false
5257
+ VersionAdded: '1.76'
5258
+
4961
5259
  Style/RedundantAssignment:
4962
5260
  Description: 'Checks for redundant assignment before returning.'
4963
5261
  Enabled: true
@@ -4979,6 +5277,9 @@ Style/RedundantCondition:
4979
5277
  Description: 'Checks for unnecessary conditional expressions.'
4980
5278
  Enabled: true
4981
5279
  VersionAdded: '0.76'
5280
+ VersionChanged: '1.73'
5281
+ AllowedMethods:
5282
+ - nonzero?
4982
5283
 
4983
5284
  Style/RedundantConditional:
4984
5285
  Description: "Don't return true/false from a conditional."
@@ -4991,7 +5292,7 @@ Style/RedundantConstantBase:
4991
5292
  VersionAdded: '1.40'
4992
5293
 
4993
5294
  Style/RedundantCurrentDirectoryInPath:
4994
- Description: 'Checks for uses a redundant current directory in path.'
5295
+ Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
4995
5296
  Enabled: pending
4996
5297
  VersionAdded: '1.53'
4997
5298
 
@@ -5017,7 +5318,8 @@ Style/RedundantFetchBlock:
5017
5318
  Description: >-
5018
5319
  Use `fetch(key, value)` instead of `fetch(key) { value }`
5019
5320
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
5020
- Reference: 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
5321
+ References:
5322
+ - 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
5021
5323
  Enabled: true
5022
5324
  Safe: false
5023
5325
  # If enabled, this cop will autocorrect usages of
@@ -5043,6 +5345,13 @@ Style/RedundantFilterChain:
5043
5345
  VersionAdded: '1.52'
5044
5346
  VersionChanged: '1.57'
5045
5347
 
5348
+ Style/RedundantFormat:
5349
+ Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
5350
+ Enabled: pending
5351
+ SafeAutoCorrect: false
5352
+ VersionAdded: '1.72'
5353
+ VersionChanged: '1.72'
5354
+
5046
5355
  Style/RedundantFreeze:
5047
5356
  Description: "Checks usages of Object#freeze on immutable objects."
5048
5357
  Enabled: true
@@ -5076,7 +5385,7 @@ Style/RedundantInterpolationUnfreeze:
5076
5385
  VersionAdded: '1.66'
5077
5386
 
5078
5387
  Style/RedundantLineContinuation:
5079
- Description: 'Check for redundant line continuation.'
5388
+ Description: 'Checks for redundant line continuation.'
5080
5389
  Enabled: pending
5081
5390
  VersionAdded: '1.49'
5082
5391
 
@@ -5241,11 +5550,19 @@ Style/SafeNavigation:
5241
5550
  # Maximum length of method chains for register an offense.
5242
5551
  MaxChainLength: 2
5243
5552
 
5553
+ Style/SafeNavigationChainLength:
5554
+ Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
5555
+ StyleGuide: '#safe-navigation'
5556
+ Enabled: pending
5557
+ VersionAdded: '1.68'
5558
+ Max: 2
5559
+
5244
5560
  Style/Sample:
5245
5561
  Description: >-
5246
5562
  Use `sample` instead of `shuffle.first`,
5247
5563
  `shuffle.last`, and `shuffle[Integer]`.
5248
- Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5564
+ References:
5565
+ - 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5249
5566
  Enabled: true
5250
5567
  VersionAdded: '0.30'
5251
5568
 
@@ -5362,7 +5679,7 @@ Style/SpecialGlobalVars:
5362
5679
  - use_builtin_english_names
5363
5680
 
5364
5681
  Style/StabbyLambdaParentheses:
5365
- Description: 'Check for the usage of parentheses around stabby lambda arguments.'
5682
+ Description: 'Checks for the usage of parentheses around stabby lambda arguments.'
5366
5683
  StyleGuide: '#stabby-lambda-with-args'
5367
5684
  Enabled: true
5368
5685
  VersionAdded: '0.35'
@@ -5551,10 +5868,14 @@ Style/TrailingCommaInArguments:
5551
5868
  # parenthesized method calls where each argument is on its own line.
5552
5869
  # If `consistent_comma`, the cop requires a comma after the last argument,
5553
5870
  # for all parenthesized method calls with arguments.
5871
+ # If `diff_comma`, the cop requires a comma after the last argument, but only
5872
+ # when that argument is followed by an immediate newline, even if
5873
+ # there is an inline comment.
5554
5874
  EnforcedStyleForMultiline: no_comma
5555
5875
  SupportedStylesForMultiline:
5556
5876
  - comma
5557
5877
  - consistent_comma
5878
+ - diff_comma
5558
5879
  - no_comma
5559
5880
 
5560
5881
  Style/TrailingCommaInArrayLiteral:
@@ -5562,14 +5883,17 @@ Style/TrailingCommaInArrayLiteral:
5562
5883
  StyleGuide: '#no-trailing-array-commas'
5563
5884
  Enabled: true
5564
5885
  VersionAdded: '0.53'
5565
- # If `comma`, the cop requires a comma after the last item in an array,
5566
- # but only when each item is on its own line.
5567
- # If `consistent_comma`, the cop requires a comma after the last item of all
5568
- # non-empty, multiline array literals.
5886
+ # If `comma`, the cop requires a comma after the last item in an array, but only when each item is
5887
+ # on its own line.
5888
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
5889
+ # array literals.
5890
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
5891
+ # literals, but only when that last item immediately precedes a newline.
5569
5892
  EnforcedStyleForMultiline: no_comma
5570
5893
  SupportedStylesForMultiline:
5571
5894
  - comma
5572
5895
  - consistent_comma
5896
+ - diff_comma
5573
5897
  - no_comma
5574
5898
 
5575
5899
  Style/TrailingCommaInBlockArgs:
@@ -5581,14 +5905,17 @@ Style/TrailingCommaInBlockArgs:
5581
5905
  Style/TrailingCommaInHashLiteral:
5582
5906
  Description: 'Checks for trailing comma in hash literals.'
5583
5907
  Enabled: true
5584
- # If `comma`, the cop requires a comma after the last item in a hash,
5585
- # but only when each item is on its own line.
5586
- # If `consistent_comma`, the cop requires a comma after the last item of all
5587
- # non-empty, multiline hash literals.
5908
+ # If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
5909
+ # on its own line.
5910
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
5911
+ # hash literals.
5912
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
5913
+ # literals, but only when that last item immediately precedes a newline.
5588
5914
  EnforcedStyleForMultiline: no_comma
5589
5915
  SupportedStylesForMultiline:
5590
5916
  - comma
5591
5917
  - consistent_comma
5918
+ - diff_comma
5592
5919
  - no_comma
5593
5920
  VersionAdded: '0.53'
5594
5921
 
@@ -5734,7 +6061,8 @@ Style/YAMLFileRead:
5734
6061
 
5735
6062
  Style/YodaCondition:
5736
6063
  Description: 'Forbid or enforce yoda conditions.'
5737
- Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
6064
+ References:
6065
+ - 'https://en.wikipedia.org/wiki/Yoda_conditions'
5738
6066
  Enabled: true
5739
6067
  EnforcedStyle: forbid_for_all_comparison_operators
5740
6068
  SupportedStyles: