rubocop 1.67.0 → 1.75.5

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 (465) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +4 -4
  4. data/config/default.yml +264 -47
  5. data/config/internal_affairs.yml +20 -0
  6. data/config/obsoletion.yml +3 -1
  7. data/lib/rubocop/cached_data.rb +12 -4
  8. data/lib/rubocop/cli/command/execute_runner.rb +4 -4
  9. data/lib/rubocop/cli/command/show_cops.rb +24 -2
  10. data/lib/rubocop/cli/command/suggest_extensions.rb +7 -1
  11. data/lib/rubocop/cli/command/version.rb +2 -2
  12. data/lib/rubocop/cli.rb +1 -1
  13. data/lib/rubocop/comment_config.rb +2 -2
  14. data/lib/rubocop/config.rb +52 -10
  15. data/lib/rubocop/config_loader.rb +52 -9
  16. data/lib/rubocop/config_loader_resolver.rb +36 -10
  17. data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -3
  18. data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
  19. data/lib/rubocop/config_obsoletion.rb +46 -2
  20. data/lib/rubocop/config_validator.rb +25 -14
  21. data/lib/rubocop/cop/autocorrect_logic.rb +36 -19
  22. data/lib/rubocop/cop/base.rb +7 -1
  23. data/lib/rubocop/cop/bundler/duplicated_gem.rb +2 -2
  24. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  25. data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
  26. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
  27. data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -12
  28. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +1 -1
  29. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
  30. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +1 -2
  31. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +0 -2
  32. data/lib/rubocop/cop/generator.rb +6 -0
  33. data/lib/rubocop/cop/internal_affairs/cop_enabled.rb +85 -0
  34. data/lib/rubocop/cop/internal_affairs/example_description.rb +8 -4
  35. data/lib/rubocop/cop/internal_affairs/location_exists.rb +116 -0
  36. data/lib/rubocop/cop/internal_affairs/location_expression.rb +2 -1
  37. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -4
  38. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +3 -2
  39. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -1
  40. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +63 -0
  41. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +131 -0
  42. data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +230 -0
  43. data/lib/rubocop/cop/internal_affairs/node_type_group.rb +91 -0
  44. data/lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb +126 -0
  45. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +4 -3
  46. data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +1 -1
  47. data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +90 -0
  48. data/lib/rubocop/cop/internal_affairs/operator_keyword.rb +48 -0
  49. data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
  50. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +6 -5
  51. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +3 -1
  52. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +5 -4
  53. data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +0 -2
  54. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +13 -2
  55. data/lib/rubocop/cop/internal_affairs.rb +7 -16
  56. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +1 -1
  57. data/lib/rubocop/cop/layout/argument_alignment.rb +2 -9
  58. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  59. data/lib/rubocop/cop/layout/begin_end_alignment.rb +0 -1
  60. data/lib/rubocop/cop/layout/block_alignment.rb +3 -2
  61. data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
  62. data/lib/rubocop/cop/layout/class_structure.rb +9 -9
  63. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +4 -4
  64. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  65. data/lib/rubocop/cop/layout/dot_position.rb +1 -1
  66. data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
  67. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +3 -3
  68. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +7 -11
  69. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +30 -4
  70. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +5 -6
  71. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -0
  72. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +4 -5
  73. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +23 -1
  74. data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
  75. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
  76. data/lib/rubocop/cop/layout/first_argument_indentation.rb +3 -8
  77. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -7
  78. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -7
  79. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
  80. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
  81. data/lib/rubocop/cop/layout/hash_alignment.rb +8 -6
  82. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -1
  83. data/lib/rubocop/cop/layout/indentation_width.rb +8 -7
  84. data/lib/rubocop/cop/layout/leading_comment_space.rb +57 -2
  85. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +11 -2
  86. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +7 -1
  87. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -2
  88. data/lib/rubocop/cop/layout/line_length.rb +123 -4
  89. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -0
  90. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
  91. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +25 -0
  92. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -1
  93. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +4 -4
  94. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
  95. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +1 -0
  96. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +3 -4
  97. data/lib/rubocop/cop/layout/parameter_alignment.rb +3 -4
  98. data/lib/rubocop/cop/layout/redundant_line_break.rb +19 -46
  99. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +6 -7
  100. data/lib/rubocop/cop/layout/single_line_block_chain.rb +1 -1
  101. data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
  102. data/lib/rubocop/cop/layout/space_after_comma.rb +1 -1
  103. data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
  104. data/lib/rubocop/cop/layout/space_after_semicolon.rb +11 -1
  105. data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -1
  106. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
  107. data/lib/rubocop/cop/layout/space_around_operators.rb +23 -21
  108. data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -0
  109. data/lib/rubocop/cop/layout/space_before_brackets.rb +5 -5
  110. data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
  111. data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
  112. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +10 -1
  113. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -0
  114. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +7 -0
  115. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +0 -1
  116. data/lib/rubocop/cop/layout/trailing_whitespace.rb +5 -3
  117. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
  118. data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +118 -0
  119. data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -3
  120. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +10 -12
  121. data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
  122. data/lib/rubocop/cop/lint/circular_argument_reference.rb +4 -1
  123. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
  124. data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
  125. data/lib/rubocop/cop/lint/cop_directive_syntax.rb +84 -0
  126. data/lib/rubocop/cop/lint/debugger.rb +3 -3
  127. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +3 -2
  128. data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
  129. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +1 -1
  130. data/lib/rubocop/cop/lint/duplicate_methods.rb +2 -17
  131. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -1
  132. data/lib/rubocop/cop/lint/duplicate_set_element.rb +20 -7
  133. data/lib/rubocop/cop/lint/empty_conditional_body.rb +14 -64
  134. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  135. data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
  136. data/lib/rubocop/cop/lint/empty_file.rb +0 -2
  137. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  138. data/lib/rubocop/cop/lint/erb_new_arguments.rb +0 -6
  139. data/lib/rubocop/cop/lint/float_comparison.rb +20 -14
  140. data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -4
  141. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +2 -2
  142. data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
  143. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
  144. data/lib/rubocop/cop/lint/interpolation_check.rb +9 -0
  145. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +3 -0
  146. data/lib/rubocop/cop/lint/literal_as_condition.rb +118 -9
  147. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +1 -1
  148. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +24 -6
  149. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -1
  150. data/lib/rubocop/cop/lint/missing_super.rb +2 -2
  151. data/lib/rubocop/cop/lint/mixed_case_range.rb +5 -8
  152. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
  153. data/lib/rubocop/cop/lint/nested_method_definition.rb +10 -6
  154. data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
  155. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +2 -2
  156. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +12 -3
  157. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -3
  158. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -3
  159. data/lib/rubocop/cop/lint/number_conversion.rb +0 -1
  160. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -2
  161. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +93 -0
  162. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -3
  163. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +3 -2
  164. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -5
  165. data/lib/rubocop/cop/lint/raise_exception.rb +29 -10
  166. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +1 -1
  167. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +1 -1
  168. data/lib/rubocop/cop/lint/redundant_require_statement.rb +0 -21
  169. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +12 -7
  170. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +8 -7
  171. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -2
  172. data/lib/rubocop/cop/lint/redundant_type_conversion.rb +261 -0
  173. data/lib/rubocop/cop/lint/redundant_with_index.rb +3 -0
  174. data/lib/rubocop/cop/lint/redundant_with_object.rb +3 -0
  175. data/lib/rubocop/cop/lint/refinement_import_methods.rb +1 -1
  176. data/lib/rubocop/cop/lint/regexp_as_condition.rb +0 -1
  177. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  178. data/lib/rubocop/cop/lint/rescue_type.rb +3 -7
  179. data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -11
  180. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +17 -1
  181. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +5 -1
  182. data/lib/rubocop/cop/lint/self_assignment.rb +8 -10
  183. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
  184. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +8 -1
  185. data/lib/rubocop/cop/lint/shared_mutable_default.rb +76 -0
  186. data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
  187. data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
  188. data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
  189. data/lib/rubocop/cop/lint/syntax.rb +4 -1
  190. data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
  191. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
  192. data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +88 -0
  193. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +3 -1
  194. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +1 -1
  195. data/lib/rubocop/cop/lint/unreachable_code.rb +52 -2
  196. data/lib/rubocop/cop/lint/unreachable_loop.rb +6 -6
  197. data/lib/rubocop/cop/lint/unused_method_argument.rb +18 -2
  198. data/lib/rubocop/cop/lint/useless_access_modifier.rb +5 -4
  199. data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
  200. data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
  201. data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
  202. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -0
  203. data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
  204. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +2 -1
  205. data/lib/rubocop/cop/lint/useless_rescue.rb +2 -2
  206. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +2 -2
  207. data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -25
  208. data/lib/rubocop/cop/lint/void.rb +16 -12
  209. data/lib/rubocop/cop/message_annotator.rb +7 -3
  210. data/lib/rubocop/cop/metrics/block_length.rb +1 -0
  211. data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
  212. data/lib/rubocop/cop/metrics/class_length.rb +9 -9
  213. data/lib/rubocop/cop/metrics/collection_literal_length.rb +7 -0
  214. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +5 -2
  215. data/lib/rubocop/cop/metrics/method_length.rb +9 -1
  216. data/lib/rubocop/cop/metrics/module_length.rb +1 -1
  217. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  218. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
  219. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +3 -4
  220. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
  221. data/lib/rubocop/cop/mixin/alignment.rb +2 -2
  222. data/lib/rubocop/cop/mixin/allowed_pattern.rb +4 -4
  223. data/lib/rubocop/cop/mixin/check_assignment.rb +4 -12
  224. data/lib/rubocop/cop/mixin/check_line_breakable.rb +22 -12
  225. data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +49 -0
  226. data/lib/rubocop/cop/mixin/comments_help.rb +8 -3
  227. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  228. data/lib/rubocop/cop/mixin/dig_help.rb +27 -0
  229. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
  230. data/lib/rubocop/cop/mixin/endless_method_rewriter.rb +24 -0
  231. data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
  232. data/lib/rubocop/cop/mixin/forbidden_pattern.rb +16 -0
  233. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +3 -2
  234. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +15 -14
  235. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +22 -22
  236. data/lib/rubocop/cop/mixin/hash_subset.rb +203 -0
  237. data/lib/rubocop/cop/mixin/hash_transform_method.rb +74 -74
  238. data/lib/rubocop/cop/mixin/line_length_help.rb +5 -4
  239. data/lib/rubocop/cop/mixin/method_complexity.rb +2 -1
  240. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +7 -9
  241. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  242. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +68 -30
  243. data/lib/rubocop/cop/mixin/range_help.rb +15 -4
  244. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
  245. data/lib/rubocop/cop/mixin/statement_modifier.rb +8 -3
  246. data/lib/rubocop/cop/mixin/string_help.rb +2 -2
  247. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
  248. data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
  249. data/lib/rubocop/cop/mixin/trailing_comma.rb +21 -5
  250. data/lib/rubocop/cop/naming/accessor_method_name.rb +6 -6
  251. data/lib/rubocop/cop/naming/block_forwarding.rb +20 -16
  252. data/lib/rubocop/cop/naming/constant_name.rb +6 -7
  253. data/lib/rubocop/cop/naming/file_name.rb +0 -2
  254. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +12 -13
  255. data/lib/rubocop/cop/naming/method_name.rb +64 -8
  256. data/lib/rubocop/cop/naming/predicate_name.rb +44 -0
  257. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +6 -14
  258. data/lib/rubocop/cop/naming/variable_name.rb +50 -6
  259. data/lib/rubocop/cop/naming/variable_number.rb +2 -3
  260. data/lib/rubocop/cop/offense.rb +2 -3
  261. data/lib/rubocop/cop/registry.rb +9 -6
  262. data/lib/rubocop/cop/security/compound_hash.rb +2 -0
  263. data/lib/rubocop/cop/security/yaml_load.rb +3 -2
  264. data/lib/rubocop/cop/style/access_modifier_declarations.rb +86 -28
  265. data/lib/rubocop/cop/style/accessor_grouping.rb +19 -5
  266. data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +79 -0
  267. data/lib/rubocop/cop/style/and_or.rb +1 -1
  268. data/lib/rubocop/cop/style/arguments_forwarding.rb +47 -28
  269. data/lib/rubocop/cop/style/array_first_last.rb +18 -2
  270. data/lib/rubocop/cop/style/array_intersect.rb +42 -30
  271. data/lib/rubocop/cop/style/bitwise_predicate.rb +100 -0
  272. data/lib/rubocop/cop/style/block_delimiters.rb +43 -25
  273. data/lib/rubocop/cop/style/case_like_if.rb +8 -11
  274. data/lib/rubocop/cop/style/class_and_module_children.rb +52 -11
  275. data/lib/rubocop/cop/style/class_equality_comparison.rb +1 -1
  276. data/lib/rubocop/cop/style/collection_methods.rb +2 -1
  277. data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
  278. data/lib/rubocop/cop/style/combinable_loops.rb +3 -2
  279. data/lib/rubocop/cop/style/commented_keyword.rb +20 -3
  280. data/lib/rubocop/cop/style/comparable_between.rb +75 -0
  281. data/lib/rubocop/cop/style/concat_array_literals.rb +1 -1
  282. data/lib/rubocop/cop/style/conditional_assignment.rb +39 -27
  283. data/lib/rubocop/cop/style/constant_visibility.rb +3 -12
  284. data/lib/rubocop/cop/style/dig_chain.rb +89 -0
  285. data/lib/rubocop/cop/style/documentation.rb +1 -1
  286. data/lib/rubocop/cop/style/double_negation.rb +4 -4
  287. data/lib/rubocop/cop/style/each_for_simple_loop.rb +4 -7
  288. data/lib/rubocop/cop/style/each_with_object.rb +2 -3
  289. data/lib/rubocop/cop/style/empty_else.rb +4 -2
  290. data/lib/rubocop/cop/style/empty_literal.rb +5 -1
  291. data/lib/rubocop/cop/style/empty_method.rb +1 -1
  292. data/lib/rubocop/cop/style/endless_method.rb +150 -18
  293. data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
  294. data/lib/rubocop/cop/style/exact_regexp_match.rb +2 -3
  295. data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
  296. data/lib/rubocop/cop/style/explicit_block_argument.rb +16 -3
  297. data/lib/rubocop/cop/style/exponential_notation.rb +3 -3
  298. data/lib/rubocop/cop/style/fetch_env_var.rb +2 -1
  299. data/lib/rubocop/cop/style/file_null.rb +89 -0
  300. data/lib/rubocop/cop/style/file_touch.rb +75 -0
  301. data/lib/rubocop/cop/style/float_division.rb +8 -4
  302. data/lib/rubocop/cop/style/for.rb +1 -1
  303. data/lib/rubocop/cop/style/format_string_token.rb +38 -11
  304. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -2
  305. data/lib/rubocop/cop/style/global_std_stream.rb +3 -0
  306. data/lib/rubocop/cop/style/global_vars.rb +1 -3
  307. data/lib/rubocop/cop/style/guard_clause.rb +17 -3
  308. data/lib/rubocop/cop/style/hash_conversion.rb +1 -2
  309. data/lib/rubocop/cop/style/hash_each_methods.rb +6 -8
  310. data/lib/rubocop/cop/style/hash_except.rb +35 -147
  311. data/lib/rubocop/cop/style/hash_fetch_chain.rb +104 -0
  312. data/lib/rubocop/cop/style/hash_slice.rb +80 -0
  313. data/lib/rubocop/cop/style/hash_syntax.rb +9 -3
  314. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  315. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  316. data/lib/rubocop/cop/style/identical_conditional_branches.rb +25 -6
  317. data/lib/rubocop/cop/style/if_inside_else.rb +10 -14
  318. data/lib/rubocop/cop/style/if_unless_modifier.rb +5 -5
  319. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +3 -4
  320. data/lib/rubocop/cop/style/if_with_semicolon.rb +20 -9
  321. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  322. data/lib/rubocop/cop/style/inverse_methods.rb +15 -12
  323. data/lib/rubocop/cop/style/invertible_unless_condition.rb +2 -2
  324. data/lib/rubocop/cop/style/ip_addresses.rb +2 -2
  325. data/lib/rubocop/cop/style/it_assignment.rb +36 -0
  326. data/lib/rubocop/cop/style/it_block_parameter.rb +100 -0
  327. data/lib/rubocop/cop/style/keyword_arguments_merging.rb +67 -0
  328. data/lib/rubocop/cop/style/keyword_parameters_order.rb +14 -8
  329. data/lib/rubocop/cop/style/lambda.rb +1 -0
  330. data/lib/rubocop/cop/style/lambda_call.rb +10 -4
  331. data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
  332. data/lib/rubocop/cop/style/map_into_array.rb +11 -3
  333. data/lib/rubocop/cop/style/map_to_hash.rb +1 -1
  334. data/lib/rubocop/cop/style/map_to_set.rb +3 -2
  335. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +27 -17
  336. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +2 -0
  337. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +8 -11
  338. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -4
  339. data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
  340. data/lib/rubocop/cop/style/missing_else.rb +2 -0
  341. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +33 -3
  342. data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -2
  343. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  344. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -9
  345. data/lib/rubocop/cop/style/multiple_comparison.rb +52 -51
  346. data/lib/rubocop/cop/style/mutable_constant.rb +7 -8
  347. data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -5
  348. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
  349. data/lib/rubocop/cop/style/nested_ternary_operator.rb +5 -4
  350. data/lib/rubocop/cop/style/next.rb +44 -0
  351. data/lib/rubocop/cop/style/not.rb +1 -1
  352. data/lib/rubocop/cop/style/object_then.rb +15 -15
  353. data/lib/rubocop/cop/style/one_line_conditional.rb +25 -4
  354. data/lib/rubocop/cop/style/open_struct_use.rb +5 -5
  355. data/lib/rubocop/cop/style/operator_method_call.rb +5 -6
  356. data/lib/rubocop/cop/style/or_assignment.rb +3 -6
  357. data/lib/rubocop/cop/style/parallel_assignment.rb +9 -18
  358. data/lib/rubocop/cop/style/parentheses_around_condition.rb +2 -2
  359. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  360. data/lib/rubocop/cop/style/proc.rb +2 -2
  361. data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
  362. data/lib/rubocop/cop/style/raise_args.rb +15 -13
  363. data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
  364. data/lib/rubocop/cop/style/redundant_argument.rb +3 -1
  365. data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
  366. data/lib/rubocop/cop/style/redundant_begin.rb +2 -1
  367. data/lib/rubocop/cop/style/redundant_condition.rb +95 -23
  368. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +16 -5
  369. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +6 -10
  370. data/lib/rubocop/cop/style/redundant_each.rb +1 -1
  371. data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
  372. data/lib/rubocop/cop/style/redundant_format.rb +257 -0
  373. data/lib/rubocop/cop/style/redundant_freeze.rb +3 -3
  374. data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
  375. data/lib/rubocop/cop/style/redundant_line_continuation.rb +54 -18
  376. data/lib/rubocop/cop/style/redundant_parentheses.rb +56 -26
  377. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +4 -0
  378. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
  379. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
  380. data/lib/rubocop/cop/style/redundant_return.rb +2 -2
  381. data/lib/rubocop/cop/style/redundant_self.rb +9 -15
  382. data/lib/rubocop/cop/style/redundant_self_assignment.rb +20 -32
  383. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +4 -4
  384. data/lib/rubocop/cop/style/redundant_sort.rb +3 -3
  385. data/lib/rubocop/cop/style/redundant_sort_by.rb +17 -1
  386. data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -2
  387. data/lib/rubocop/cop/style/rescue_modifier.rb +5 -3
  388. data/lib/rubocop/cop/style/return_nil.rb +2 -2
  389. data/lib/rubocop/cop/style/safe_navigation.rb +32 -5
  390. data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
  391. data/lib/rubocop/cop/style/select_by_regexp.rb +5 -2
  392. data/lib/rubocop/cop/style/self_assignment.rb +11 -17
  393. data/lib/rubocop/cop/style/semicolon.rb +1 -1
  394. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +2 -1
  395. data/lib/rubocop/cop/style/signal_exception.rb +2 -3
  396. data/lib/rubocop/cop/style/single_argument_dig.rb +9 -5
  397. data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
  398. data/lib/rubocop/cop/style/single_line_do_end_block.rb +15 -4
  399. data/lib/rubocop/cop/style/single_line_methods.rb +6 -7
  400. data/lib/rubocop/cop/style/slicing_with_range.rb +40 -11
  401. data/lib/rubocop/cop/style/sole_nested_conditional.rb +40 -106
  402. data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
  403. data/lib/rubocop/cop/style/string_concatenation.rb +15 -14
  404. data/lib/rubocop/cop/style/string_literals.rb +1 -1
  405. data/lib/rubocop/cop/style/string_methods.rb +1 -1
  406. data/lib/rubocop/cop/style/super_arguments.rb +66 -19
  407. data/lib/rubocop/cop/style/swap_values.rb +4 -15
  408. data/lib/rubocop/cop/style/symbol_proc.rb +2 -0
  409. data/lib/rubocop/cop/style/ternary_parentheses.rb +25 -4
  410. data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -1
  411. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +11 -2
  412. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
  413. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
  414. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -4
  415. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  416. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
  417. data/lib/rubocop/cop/style/while_until_modifier.rb +0 -1
  418. data/lib/rubocop/cop/style/yoda_condition.rb +8 -4
  419. data/lib/rubocop/cop/style/yoda_expression.rb +2 -1
  420. data/lib/rubocop/cop/util.rb +12 -5
  421. data/lib/rubocop/cop/utils/format_string.rb +10 -5
  422. data/lib/rubocop/cop/variable_force/assignment.rb +18 -3
  423. data/lib/rubocop/cop/variable_force/branch.rb +1 -1
  424. data/lib/rubocop/cop/variable_force/scope.rb +1 -1
  425. data/lib/rubocop/cop/variable_force/variable.rb +14 -3
  426. data/lib/rubocop/cop/variable_force/variable_table.rb +5 -5
  427. data/lib/rubocop/cop/variable_force.rb +5 -11
  428. data/lib/rubocop/cops_documentation_generator.rb +50 -25
  429. data/lib/rubocop/directive_comment.rb +45 -11
  430. data/lib/rubocop/ext/regexp_node.rb +0 -1
  431. data/lib/rubocop/formatter/disabled_config_formatter.rb +2 -2
  432. data/lib/rubocop/formatter/formatter_set.rb +1 -1
  433. data/lib/rubocop/formatter/pacman_formatter.rb +1 -1
  434. data/lib/rubocop/lsp/diagnostic.rb +189 -0
  435. data/lib/rubocop/lsp/logger.rb +2 -2
  436. data/lib/rubocop/lsp/routes.rb +7 -23
  437. data/lib/rubocop/lsp/runtime.rb +18 -50
  438. data/lib/rubocop/lsp/server.rb +0 -2
  439. data/lib/rubocop/lsp/stdin_runner.rb +85 -0
  440. data/lib/rubocop/magic_comment.rb +11 -3
  441. data/lib/rubocop/options.rb +28 -12
  442. data/lib/rubocop/path_util.rb +15 -8
  443. data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
  444. data/lib/rubocop/plugin/load_error.rb +26 -0
  445. data/lib/rubocop/plugin/loader.rb +100 -0
  446. data/lib/rubocop/plugin/not_supported_error.rb +29 -0
  447. data/lib/rubocop/plugin.rb +46 -0
  448. data/lib/rubocop/rake_task.rb +4 -1
  449. data/lib/rubocop/result_cache.rb +13 -13
  450. data/lib/rubocop/rspec/cop_helper.rb +13 -1
  451. data/lib/rubocop/rspec/expect_offense.rb +6 -2
  452. data/lib/rubocop/rspec/shared_contexts.rb +38 -1
  453. data/lib/rubocop/rspec/support.rb +4 -2
  454. data/lib/rubocop/runner.rb +26 -15
  455. data/lib/rubocop/server/cache.rb +47 -11
  456. data/lib/rubocop/server/cli.rb +2 -2
  457. data/lib/rubocop/target_finder.rb +7 -2
  458. data/lib/rubocop/target_ruby.rb +17 -2
  459. data/lib/rubocop/version.rb +53 -12
  460. data/lib/rubocop.rb +32 -1
  461. data/lib/ruby_lsp/rubocop/addon.rb +75 -0
  462. data/lib/ruby_lsp/rubocop/runtime_adapter.rb +65 -0
  463. metadata +78 -16
  464. data/lib/rubocop/cop/utils/regexp_ranges.rb +0 -113
  465. 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,7 +274,8 @@ 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/rubygems/rubygems/issues/7799#issuecomment-2192720316
276
279
  Enabled: pending
277
280
  VersionAdded: '1.65'
278
281
  Include:
@@ -341,7 +344,7 @@ Gemspec/RequireMFA:
341
344
  Severity: warning
342
345
  VersionAdded: '1.23'
343
346
  VersionChanged: '1.40'
344
- Reference:
347
+ References:
345
348
  - https://guides.rubygems.org/mfa-requirement-opt-in/
346
349
  Include:
347
350
  - '**/*.gemspec'
@@ -602,7 +605,7 @@ Layout/EmptyLineAfterMultilineCondition:
602
605
  # This is disabled, because this style is not very common in practice.
603
606
  Enabled: false
604
607
  VersionAdded: '0.90'
605
- Reference:
608
+ References:
606
609
  - https://github.com/airbnb/ruby#multiline-if-newline
607
610
 
608
611
  Layout/EmptyLineBetweenDefs:
@@ -637,7 +640,7 @@ Layout/EmptyLinesAroundAccessModifier:
637
640
  SupportedStyles:
638
641
  - around
639
642
  - only_before
640
- Reference:
643
+ References:
641
644
  # A reference to `EnforcedStyle: only_before`.
642
645
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
643
646
 
@@ -994,7 +997,7 @@ Layout/IndentationConsistency:
994
997
  SupportedStyles:
995
998
  - normal
996
999
  - indented_internal_methods
997
- Reference:
1000
+ References:
998
1001
  # A reference to `EnforcedStyle: indented_internal_methods`.
999
1002
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
1000
1003
 
@@ -1038,6 +1041,7 @@ Layout/LeadingCommentSpace:
1038
1041
  AllowDoxygenCommentStyle: false
1039
1042
  AllowGemfileRubyComment: false
1040
1043
  AllowRBSInlineAnnotation: false
1044
+ AllowSteepAnnotation: false
1041
1045
 
1042
1046
  Layout/LeadingEmptyLines:
1043
1047
  Description: Check for unnecessary blank lines at the beginning of a file.
@@ -1085,11 +1089,11 @@ Layout/LineLength:
1085
1089
  StyleGuide: '#max-line-length'
1086
1090
  Enabled: true
1087
1091
  VersionAdded: '0.25'
1088
- VersionChanged: '1.4'
1092
+ VersionChanged: '1.69'
1089
1093
  Max: 120
1094
+ AllowHeredoc: true
1090
1095
  # To make it possible to copy or click on URIs in the code, we allow lines
1091
1096
  # containing a URI to be longer than Max.
1092
- AllowHeredoc: true
1093
1097
  AllowURI: true
1094
1098
  URISchemes:
1095
1099
  - http
@@ -1101,6 +1105,8 @@ Layout/LineLength:
1101
1105
  # elements. Strings will be converted to Regexp objects. A line that matches
1102
1106
  # any regular expression listed in this option will be ignored by LineLength.
1103
1107
  AllowedPatterns: []
1108
+ # If SplitStrings is true, long strings will be split using continuations
1109
+ SplitStrings: false
1104
1110
 
1105
1111
  Layout/MultilineArrayBraceLayout:
1106
1112
  Description: >-
@@ -1498,7 +1504,6 @@ Layout/SpaceInsideHashLiteralBraces:
1498
1504
  - space
1499
1505
  - no_space
1500
1506
 
1501
-
1502
1507
  Layout/SpaceInsideParens:
1503
1508
  Description: 'No spaces after ( or before ).'
1504
1509
  StyleGuide: '#spaces-braces'
@@ -1614,6 +1619,12 @@ Lint/AmbiguousRegexpLiteral:
1614
1619
  VersionAdded: '0.17'
1615
1620
  VersionChanged: '0.83'
1616
1621
 
1622
+ Lint/ArrayLiteralInRegexp:
1623
+ Description: 'Checks for an array literal interpolated inside a regexp.'
1624
+ Enabled: pending
1625
+ VersionAdded: '1.71'
1626
+ SafeAutoCorrect: false
1627
+
1617
1628
  Lint/AssignmentInCondition:
1618
1629
  Description: "Don't use assignment in conditions."
1619
1630
  StyleGuide: '#safe-assignment-in-condition'
@@ -1633,7 +1644,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
1633
1644
  Enabled: true
1634
1645
  Safe: false
1635
1646
  VersionAdded: '0.89'
1636
- VersionChanged: '1.7'
1647
+ VersionChanged: '1.69'
1637
1648
 
1638
1649
  Lint/BooleanSymbol:
1639
1650
  Description: 'Check for `:true` and `:false` symbols.'
@@ -1663,6 +1674,11 @@ Lint/ConstantOverwrittenInRescue:
1663
1674
  Enabled: pending
1664
1675
  VersionAdded: '1.31'
1665
1676
 
1677
+ Lint/ConstantReassignment:
1678
+ Description: 'Checks for constant reassignments.'
1679
+ Enabled: pending
1680
+ VersionAdded: '1.70'
1681
+
1666
1682
  Lint/ConstantResolution:
1667
1683
  Description: 'Check that constants are fully qualified with `::`.'
1668
1684
  Enabled: false
@@ -1672,6 +1688,11 @@ Lint/ConstantResolution:
1672
1688
  # Restrict this cop from only looking at certain names
1673
1689
  Ignore: []
1674
1690
 
1691
+ Lint/CopDirectiveSyntax:
1692
+ Description: 'Checks that `# rubocop:` directives are strictly formatted.'
1693
+ Enabled: pending
1694
+ VersionAdded: '1.72'
1695
+
1675
1696
  Lint/Debugger:
1676
1697
  Description: 'Check for debugger calls.'
1677
1698
  Enabled: true
@@ -1785,6 +1806,7 @@ Lint/DuplicateBranch:
1785
1806
  VersionChanged: '1.7'
1786
1807
  IgnoreLiteralBranches: false
1787
1808
  IgnoreConstantBranches: false
1809
+ IgnoreDuplicateElseBranch: false
1788
1810
 
1789
1811
  Lint/DuplicateCaseCondition:
1790
1812
  Description: 'Do not repeat values in case conditionals.'
@@ -1868,10 +1890,9 @@ Lint/EmptyConditionalBody:
1868
1890
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1869
1891
  Enabled: true
1870
1892
  AutoCorrect: contextual
1871
- SafeAutoCorrect: false
1872
1893
  AllowComments: true
1873
1894
  VersionAdded: '0.89'
1874
- VersionChanged: '1.61'
1895
+ VersionChanged: '1.73'
1875
1896
 
1876
1897
  Lint/EmptyEnsure:
1877
1898
  Description: 'Checks for empty ensure block.'
@@ -1954,6 +1975,11 @@ Lint/HashCompareByIdentity:
1954
1975
  Safe: false
1955
1976
  VersionAdded: '0.93'
1956
1977
 
1978
+ Lint/HashNewWithKeywordArgumentsAsDefault:
1979
+ Description: 'Checks for the deprecated use of keyword arguments for hash default in `Hash.new`.'
1980
+ Enabled: pending
1981
+ VersionAdded: '1.69'
1982
+
1957
1983
  Lint/HeredocMethodCallPosition:
1958
1984
  Description: >-
1959
1985
  Checks for the ordering of a method call where
@@ -2010,7 +2036,8 @@ Lint/InterpolationCheck:
2010
2036
 
2011
2037
  Lint/ItWithoutArgumentsInBlock:
2012
2038
  Description: 'Checks uses of `it` calls without arguments in block.'
2013
- Reference: 'https://bugs.ruby-lang.org/issues/18980'
2039
+ References:
2040
+ - 'https://bugs.ruby-lang.org/issues/18980'
2014
2041
  Enabled: pending
2015
2042
  VersionAdded: '1.59'
2016
2043
 
@@ -2022,6 +2049,7 @@ Lint/LambdaWithoutLiteralBlock:
2022
2049
  Lint/LiteralAsCondition:
2023
2050
  Description: 'Checks of literals used in conditions.'
2024
2051
  Enabled: true
2052
+ AutoCorrect: contextual
2025
2053
  VersionAdded: '0.51'
2026
2054
 
2027
2055
  Lint/LiteralAssignmentInCondition:
@@ -2144,6 +2172,11 @@ Lint/NumberedParameterAssignment:
2144
2172
  Enabled: pending
2145
2173
  VersionAdded: '1.9'
2146
2174
 
2175
+ Lint/NumericOperationWithConstantResult:
2176
+ Description: 'Checks for numeric operations with constant results.'
2177
+ Enabled: pending
2178
+ VersionAdded: '1.69'
2179
+
2147
2180
  Lint/OrAssignmentToConstant:
2148
2181
  Description: 'Checks unintended or-assignment to constant.'
2149
2182
  Enabled: pending
@@ -2230,9 +2263,8 @@ Lint/RedundantRegexpQuantifiers:
2230
2263
  Lint/RedundantRequireStatement:
2231
2264
  Description: 'Checks for unnecessary `require` statement.'
2232
2265
  Enabled: true
2233
- SafeAutoCorrect: false
2234
2266
  VersionAdded: '0.76'
2235
- VersionChanged: '1.57'
2267
+ VersionChanged: '1.73'
2236
2268
 
2237
2269
  Lint/RedundantSafeNavigation:
2238
2270
  Description: 'Checks for redundant safe navigation calls.'
@@ -2261,6 +2293,11 @@ Lint/RedundantStringCoercion:
2261
2293
  VersionAdded: '0.19'
2262
2294
  VersionChanged: '0.77'
2263
2295
 
2296
+ Lint/RedundantTypeConversion:
2297
+ Description: 'Checks for redundantly converting a literal to the same type.'
2298
+ Enabled: pending
2299
+ VersionAdded: '1.72'
2300
+
2264
2301
  Lint/RedundantWithIndex:
2265
2302
  Description: 'Checks for redundant `with_index`.'
2266
2303
  Enabled: true
@@ -2375,7 +2412,6 @@ Lint/ShadowedArgument:
2375
2412
  VersionAdded: '0.52'
2376
2413
  IgnoreImplicitReferences: false
2377
2414
 
2378
-
2379
2415
  Lint/ShadowedException:
2380
2416
  Description: >-
2381
2417
  Avoid rescuing a higher level exception
@@ -2390,6 +2426,12 @@ Lint/ShadowingOuterLocalVariable:
2390
2426
  Enabled: true
2391
2427
  VersionAdded: '0.9'
2392
2428
 
2429
+ Lint/SharedMutableDefault:
2430
+ Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
2431
+ StyleGuide: '#no-mutable-defaults'
2432
+ Enabled: pending
2433
+ VersionAdded: '1.70'
2434
+
2393
2435
  Lint/StructNewOverride:
2394
2436
  Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
2395
2437
  Enabled: true
@@ -2404,6 +2446,12 @@ Lint/SuppressedException:
2404
2446
  VersionAdded: '0.9'
2405
2447
  VersionChanged: '1.12'
2406
2448
 
2449
+ Lint/SuppressedExceptionInNumberConversion:
2450
+ Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
2451
+ Enabled: pending
2452
+ SafeAutoCorrect: false
2453
+ VersionAdded: '1.72'
2454
+
2407
2455
  Lint/SymbolConversion:
2408
2456
  Description: 'Checks for unnecessary symbol conversions.'
2409
2457
  Enabled: pending
@@ -2455,6 +2503,11 @@ Lint/UnderscorePrefixedVariableName:
2455
2503
  VersionAdded: '0.21'
2456
2504
  AllowKeywordBlockArguments: false
2457
2505
 
2506
+ Lint/UnescapedBracketInRegexp:
2507
+ Description: 'Checks for unescaped literal `]` in Regexp.'
2508
+ Enabled: pending
2509
+ VersionAdded: '1.68'
2510
+
2458
2511
  Lint/UnexpectedBlockArity:
2459
2512
  Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2460
2513
  Enabled: pending
@@ -2514,10 +2567,12 @@ Lint/UnusedMethodArgument:
2514
2567
  Enabled: true
2515
2568
  AutoCorrect: contextual
2516
2569
  VersionAdded: '0.21'
2517
- VersionChanged: '1.61'
2570
+ VersionChanged: '1.69'
2518
2571
  AllowUnusedKeywordArguments: false
2519
2572
  IgnoreEmptyMethods: true
2520
2573
  IgnoreNotImplementedMethods: true
2574
+ NotImplementedExceptions:
2575
+ - NotImplementedError
2521
2576
 
2522
2577
  Lint/UriEscapeUnescape:
2523
2578
  Description: >-
@@ -2552,6 +2607,16 @@ Lint/UselessAssignment:
2552
2607
  VersionAdded: '0.11'
2553
2608
  VersionChanged: '1.66'
2554
2609
 
2610
+ Lint/UselessConstantScoping:
2611
+ Description: 'Checks for useless constant scoping.'
2612
+ Enabled: pending
2613
+ VersionAdded: '1.72'
2614
+
2615
+ Lint/UselessDefined:
2616
+ Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
2617
+ Enabled: pending
2618
+ VersionAdded: '1.69'
2619
+
2555
2620
  Lint/UselessElseWithoutRescue:
2556
2621
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2557
2622
  Enabled: true
@@ -2610,7 +2675,7 @@ Metrics/AbcSize:
2610
2675
  Description: >-
2611
2676
  A calculated magnitude based on number of assignments,
2612
2677
  branches, and conditions.
2613
- Reference:
2678
+ References:
2614
2679
  - http://c2.com/cgi/wiki?AbcMetric
2615
2680
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
2616
2681
  Enabled: true
@@ -2934,6 +2999,7 @@ Naming/MethodName:
2934
2999
  StyleGuide: '#snake-case-symbols-methods-vars'
2935
3000
  Enabled: true
2936
3001
  VersionAdded: '0.50'
3002
+ VersionChanged: '1.75'
2937
3003
  EnforcedStyle: snake_case
2938
3004
  SupportedStyles:
2939
3005
  - snake_case
@@ -2945,6 +3011,10 @@ Naming/MethodName:
2945
3011
  # - '\A\s*onSelectionCleared\s*'
2946
3012
  #
2947
3013
  AllowedPatterns: []
3014
+ ForbiddenIdentifiers:
3015
+ - __id__
3016
+ - __send__
3017
+ ForbiddenPatterns: []
2948
3018
 
2949
3019
  Naming/MethodParameterName:
2950
3020
  Description: >-
@@ -2981,17 +3051,19 @@ Naming/PredicateName:
2981
3051
  StyleGuide: '#bool-methods-qmark'
2982
3052
  Enabled: true
2983
3053
  VersionAdded: '0.50'
2984
- VersionChanged: '0.77'
3054
+ VersionChanged: '1.75'
2985
3055
  # Predicate name prefixes.
2986
3056
  NamePrefix:
2987
3057
  - is_
2988
3058
  - has_
2989
3059
  - have_
3060
+ - does_
2990
3061
  # Predicate name prefixes that should be removed.
2991
3062
  ForbiddenPrefixes:
2992
3063
  - is_
2993
3064
  - has_
2994
3065
  - have_
3066
+ - does_
2995
3067
  # Predicate names which, despite having a forbidden prefix, or no `?`,
2996
3068
  # should still be accepted
2997
3069
  AllowedMethods:
@@ -3000,6 +3072,8 @@ Naming/PredicateName:
3000
3072
  MethodDefinitionMacros:
3001
3073
  - define_method
3002
3074
  - define_singleton_method
3075
+ # Use Sorbet's T::Boolean return type to detect predicate methods.
3076
+ UseSorbetSigs: false
3003
3077
  # Exclude Rspec specs because there is a strong convention to write spec
3004
3078
  # helpers in the form of `have_something` or `be_something`.
3005
3079
  Exclude:
@@ -3017,13 +3091,15 @@ Naming/VariableName:
3017
3091
  StyleGuide: '#snake-case-symbols-methods-vars'
3018
3092
  Enabled: true
3019
3093
  VersionAdded: '0.50'
3020
- VersionChanged: '1.8'
3094
+ VersionChanged: '1.73'
3021
3095
  EnforcedStyle: snake_case
3022
3096
  SupportedStyles:
3023
3097
  - snake_case
3024
3098
  - camelCase
3025
3099
  AllowedIdentifiers: []
3026
3100
  AllowedPatterns: []
3101
+ ForbiddenIdentifiers: []
3102
+ ForbiddenPatterns: []
3027
3103
 
3028
3104
  Naming/VariableNumber:
3029
3105
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -3039,6 +3115,8 @@ Naming/VariableNumber:
3039
3115
  CheckMethodNames: true
3040
3116
  CheckSymbols: true
3041
3117
  AllowedIdentifiers:
3118
+ - TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
3119
+ - TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
3042
3120
  - capture3 # Open3.capture3
3043
3121
  - iso8601 # Time#iso8601
3044
3122
  - rfc1123_date # CGI.rfc1123_date
@@ -3074,7 +3152,8 @@ Security/JSONLoad:
3074
3152
  Description: >-
3075
3153
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
3076
3154
  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'
3155
+ References:
3156
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3078
3157
  Enabled: true
3079
3158
  VersionAdded: '0.43'
3080
3159
  VersionChanged: '1.22'
@@ -3086,7 +3165,8 @@ Security/MarshalLoad:
3086
3165
  Description: >-
3087
3166
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
3088
3167
  security issues. See reference for more information.
3089
- Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3168
+ References:
3169
+ - 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3090
3170
  Enabled: true
3091
3171
  VersionAdded: '0.47'
3092
3172
 
@@ -3101,7 +3181,8 @@ Security/YAMLLoad:
3101
3181
  Description: >-
3102
3182
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
3103
3183
  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'
3184
+ References:
3185
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3105
3186
  Enabled: true
3106
3187
  VersionAdded: '0.47'
3107
3188
  SafeAutoCorrect: false
@@ -3112,13 +3193,14 @@ Style/AccessModifierDeclarations:
3112
3193
  Description: 'Checks style of how access modifiers are used.'
3113
3194
  Enabled: true
3114
3195
  VersionAdded: '0.57'
3115
- VersionChanged: '0.81'
3196
+ VersionChanged: '1.70'
3116
3197
  EnforcedStyle: group
3117
3198
  SupportedStyles:
3118
3199
  - inline
3119
3200
  - group
3120
3201
  AllowModifiersOnSymbols: true
3121
3202
  AllowModifiersOnAttrs: true
3203
+ AllowModifiersOnAliasMethod: true
3122
3204
  SafeAutoCorrect: false
3123
3205
 
3124
3206
  Style/AccessorGrouping:
@@ -3143,6 +3225,12 @@ Style/Alias:
3143
3225
  - prefer_alias
3144
3226
  - prefer_alias_method
3145
3227
 
3228
+ Style/AmbiguousEndlessMethodDefinition:
3229
+ Description: 'Checks for endless methods inside operators of lower precedence.'
3230
+ StyleGuide: '#ambiguous-endless-method-defintions'
3231
+ Enabled: pending
3232
+ VersionAdded: '1.68'
3233
+
3146
3234
  Style/AndOr:
3147
3235
  Description: 'Use &&/|| instead of and/or.'
3148
3236
  StyleGuide: '#no-and-or-or'
@@ -3188,7 +3276,8 @@ Style/ArrayCoercion:
3188
3276
 
3189
3277
  Style/ArrayFirstLast:
3190
3278
  Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3191
- Reference: '#first-and-last'
3279
+ References:
3280
+ - '#first-and-last'
3192
3281
  Enabled: false
3193
3282
  VersionAdded: '1.58'
3194
3283
  Safe: false
@@ -3250,6 +3339,13 @@ Style/BisectedAttrAccessor:
3250
3339
  Enabled: true
3251
3340
  VersionAdded: '0.87'
3252
3341
 
3342
+ Style/BitwisePredicate:
3343
+ Description: 'Prefer bitwise predicate methods over direct comparison operations.'
3344
+ StyleGuide: '#bitwise-predicate-methods'
3345
+ Enabled: pending
3346
+ Safe: false
3347
+ VersionAdded: '1.68'
3348
+
3253
3349
  Style/BlockComments:
3254
3350
  Description: 'Do not use block comments.'
3255
3351
  StyleGuide: '#no-block-comments'
@@ -3420,6 +3516,7 @@ Style/ClassAndModuleChildren:
3420
3516
  SafeAutoCorrect: false
3421
3517
  Enabled: true
3422
3518
  VersionAdded: '0.19'
3519
+ VersionChanged: '1.74'
3423
3520
  #
3424
3521
  # Basically there are two different styles:
3425
3522
  #
@@ -3435,7 +3532,21 @@ Style/ClassAndModuleChildren:
3435
3532
  #
3436
3533
  # The compact style is only forced, for classes or modules with one child.
3437
3534
  EnforcedStyle: nested
3438
- SupportedStyles:
3535
+ SupportedStyles: &supported_styles
3536
+ - nested
3537
+ - compact
3538
+ # Configure classes separately, if desired. If not set, or set to `nil`,
3539
+ # the `EnforcedStyle` value will be used.
3540
+ EnforcedStyleForClasses: ~
3541
+ SupportedStylesForClasses:
3542
+ - ~
3543
+ - nested
3544
+ - compact
3545
+ # Configure modules separately, if desired. If not set, or set to `nil`,
3546
+ # the `EnforcedStyle` value will be used.
3547
+ EnforcedStyleForModules: ~
3548
+ SupportedStylesForModules:
3549
+ - ~
3439
3550
  - nested
3440
3551
  - compact
3441
3552
 
@@ -3533,6 +3644,11 @@ Style/ColonMethodDefinition:
3533
3644
  Enabled: true
3534
3645
  VersionAdded: '0.52'
3535
3646
 
3647
+ Style/CombinableDefined:
3648
+ Description: 'Checks successive `defined?` calls that can be combined into a single call.'
3649
+ Enabled: pending
3650
+ VersionAdded: '1.68'
3651
+
3536
3652
  Style/CombinableLoops:
3537
3653
  Description: >-
3538
3654
  Checks for places where multiple consecutive loops over the same data
@@ -3583,6 +3699,12 @@ Style/CommentedKeyword:
3583
3699
  VersionAdded: '0.51'
3584
3700
  VersionChanged: '1.19'
3585
3701
 
3702
+ Style/ComparableBetween:
3703
+ Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
3704
+ Enabled: pending
3705
+ VersionAdded: '1.74'
3706
+ StyleGuide: '#ranges-or-between'
3707
+
3586
3708
  Style/ComparableClamp:
3587
3709
  Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3588
3710
  Enabled: pending
@@ -3673,6 +3795,12 @@ Style/DefWithParentheses:
3673
3795
  VersionAdded: '0.9'
3674
3796
  VersionChanged: '0.12'
3675
3797
 
3798
+ Style/DigChain:
3799
+ Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
3800
+ Enabled: pending
3801
+ Safe: false
3802
+ VersionAdded: '1.69'
3803
+
3676
3804
  Style/Dir:
3677
3805
  Description: >-
3678
3806
  Use the `__dir__` method to retrieve the canonicalized
@@ -3833,6 +3961,8 @@ Style/EndlessMethod:
3833
3961
  - allow_single_line
3834
3962
  - allow_always
3835
3963
  - disallow
3964
+ - require_single_line
3965
+ - require_always
3836
3966
 
3837
3967
  Style/EnvHome:
3838
3968
  Description: "Checks for consistent usage of `ENV['HOME']`."
@@ -3885,7 +4015,7 @@ Style/ExponentialNotation:
3885
4015
  Style/FetchEnvVar:
3886
4016
  Description: >-
3887
4017
  Suggests `ENV.fetch` for the replacement of `ENV[]`.
3888
- Reference:
4018
+ References:
3889
4019
  - https://rubystyle.guide/#hash-fetch-defaults
3890
4020
  Enabled: pending
3891
4021
  VersionAdded: '1.28'
@@ -3899,12 +4029,24 @@ Style/FileEmpty:
3899
4029
  Safe: false
3900
4030
  VersionAdded: '1.48'
3901
4031
 
4032
+ Style/FileNull:
4033
+ Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
4034
+ Enabled: pending
4035
+ SafeAutoCorrect: false
4036
+ VersionAdded: '1.69'
4037
+
3902
4038
  Style/FileRead:
3903
4039
  Description: 'Favor `File.(bin)read` convenience methods.'
3904
4040
  StyleGuide: '#file-read'
3905
4041
  Enabled: pending
3906
4042
  VersionAdded: '1.24'
3907
4043
 
4044
+ Style/FileTouch:
4045
+ Description: 'Favor `FileUtils.touch` for touching files.'
4046
+ Enabled: pending
4047
+ VersionAdded: '1.69'
4048
+ SafeAutoCorrect: false
4049
+
3908
4050
  Style/FileWrite:
3909
4051
  Description: 'Favor `File.(bin)write` convenience methods.'
3910
4052
  StyleGuide: '#file-write'
@@ -3914,7 +4056,8 @@ Style/FileWrite:
3914
4056
  Style/FloatDivision:
3915
4057
  Description: 'For performing float division, coerce one side only.'
3916
4058
  StyleGuide: '#float-division'
3917
- Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
4059
+ References:
4060
+ - 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3918
4061
  Enabled: true
3919
4062
  VersionAdded: '0.72'
3920
4063
  VersionChanged: '1.9'
@@ -3965,8 +4108,14 @@ Style/FormatStringToken:
3965
4108
  # style token in a format string to be allowed when enforced style is not
3966
4109
  # `unannotated`.
3967
4110
  MaxUnannotatedPlaceholdersAllowed: 1
4111
+ # The mode the cop operates in. Two values are allowed:
4112
+ # * aggressive (default): all strings are considered
4113
+ # * conservative:
4114
+ # only register offenses for strings given to `printf`, `sprintf`,
4115
+ # format` and `%` methods. Other strings are not considered.
4116
+ Mode: aggressive
3968
4117
  VersionAdded: '0.49'
3969
- VersionChanged: '1.0'
4118
+ VersionChanged: '1.74'
3970
4119
  AllowedMethods: []
3971
4120
  AllowedPatterns: []
3972
4121
 
@@ -3991,6 +4140,9 @@ Style/FrozenStringLiteralComment:
3991
4140
  # exist in a file.
3992
4141
  - never
3993
4142
  SafeAutoCorrect: false
4143
+ Exclude:
4144
+ # Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
4145
+ - '**/*.arb'
3994
4146
 
3995
4147
  Style/GlobalStdStream:
3996
4148
  Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
@@ -4002,7 +4154,8 @@ Style/GlobalStdStream:
4002
4154
  Style/GlobalVars:
4003
4155
  Description: 'Do not introduce global variables.'
4004
4156
  StyleGuide: '#instance-vars'
4005
- Reference: 'https://www.zenspider.com/ruby/quickref.html'
4157
+ References:
4158
+ - 'https://www.zenspider.com/ruby/quickref.html'
4006
4159
  Enabled: true
4007
4160
  VersionAdded: '0.13'
4008
4161
  # Built-in global variables are allowed by default.
@@ -4059,6 +4212,12 @@ Style/HashExcept:
4059
4212
  VersionAdded: '1.7'
4060
4213
  VersionChanged: '1.39'
4061
4214
 
4215
+ Style/HashFetchChain:
4216
+ Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
4217
+ Enabled: pending
4218
+ Safe: false
4219
+ VersionAdded: '1.75'
4220
+
4062
4221
  Style/HashLikeCase:
4063
4222
  Description: >-
4064
4223
  Checks for places where `case-when` represents a simple 1:1
@@ -4069,6 +4228,14 @@ Style/HashLikeCase:
4069
4228
  # to trigger this cop
4070
4229
  MinBranchesCount: 3
4071
4230
 
4231
+ Style/HashSlice:
4232
+ Description: >-
4233
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
4234
+ that can be replaced with `Hash#slice` method.
4235
+ Enabled: pending
4236
+ Safe: false
4237
+ VersionAdded: '1.71'
4238
+
4072
4239
  Style/HashSyntax:
4073
4240
  Description: >-
4074
4241
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -4256,6 +4423,29 @@ Style/IpAddresses:
4256
4423
  - '**/gems.rb'
4257
4424
  - '**/*.gemspec'
4258
4425
 
4426
+ Style/ItAssignment:
4427
+ Description: 'Checks for assignment to `it` inside a block.'
4428
+ Enabled: pending
4429
+ VersionAdded: '1.70'
4430
+
4431
+ Style/ItBlockParameter:
4432
+ Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
4433
+ Enabled: pending
4434
+ EnforcedStyle: only_numbered_parameters
4435
+ SupportedStyles:
4436
+ - only_numbered_parameters
4437
+ - always
4438
+ - disallow
4439
+ VersionAdded: '1.75'
4440
+
4441
+ Style/KeywordArgumentsMerging:
4442
+ Description: >-
4443
+ When passing an existing hash as keyword arguments, provide additional arguments
4444
+ directly rather than using `merge`.
4445
+ StyleGuide: '#merging-keyword-arguments'
4446
+ Enabled: pending
4447
+ VersionAdded: '1.68'
4448
+
4259
4449
  Style/KeywordParametersOrder:
4260
4450
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
4261
4451
  StyleGuide: '#keyword-parameters-order'
@@ -4636,7 +4826,7 @@ Style/Next:
4636
4826
  StyleGuide: '#no-nested-conditionals'
4637
4827
  Enabled: true
4638
4828
  VersionAdded: '0.22'
4639
- VersionChanged: '0.35'
4829
+ VersionChanged: '1.75'
4640
4830
  # With `always` all conditions at the end of an iteration needs to be
4641
4831
  # replaced by next - with `skip_modifier_ifs` the modifier if like this one
4642
4832
  # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
@@ -4644,6 +4834,7 @@ Style/Next:
4644
4834
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
4645
4835
  # needs to have to trigger this cop
4646
4836
  MinBodyLength: 3
4837
+ AllowConsecutiveConditionals: false
4647
4838
  SupportedStyles:
4648
4839
  - skip_modifier_ifs
4649
4840
  - always
@@ -4775,7 +4966,7 @@ Style/OpenStructUse:
4775
4966
  Description: >-
4776
4967
  Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4777
4968
  version compatibility, and potential security issues.
4778
- Reference:
4969
+ References:
4779
4970
  - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4780
4971
 
4781
4972
  Enabled: pending
@@ -4979,6 +5170,9 @@ Style/RedundantCondition:
4979
5170
  Description: 'Checks for unnecessary conditional expressions.'
4980
5171
  Enabled: true
4981
5172
  VersionAdded: '0.76'
5173
+ VersionChanged: '1.73'
5174
+ AllowedMethods:
5175
+ - nonzero?
4982
5176
 
4983
5177
  Style/RedundantConditional:
4984
5178
  Description: "Don't return true/false from a conditional."
@@ -4991,7 +5185,7 @@ Style/RedundantConstantBase:
4991
5185
  VersionAdded: '1.40'
4992
5186
 
4993
5187
  Style/RedundantCurrentDirectoryInPath:
4994
- Description: 'Checks for uses a redundant current directory in path.'
5188
+ Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
4995
5189
  Enabled: pending
4996
5190
  VersionAdded: '1.53'
4997
5191
 
@@ -5017,7 +5211,8 @@ Style/RedundantFetchBlock:
5017
5211
  Description: >-
5018
5212
  Use `fetch(key, value)` instead of `fetch(key) { value }`
5019
5213
  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'
5214
+ References:
5215
+ - 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
5021
5216
  Enabled: true
5022
5217
  Safe: false
5023
5218
  # If enabled, this cop will autocorrect usages of
@@ -5043,6 +5238,13 @@ Style/RedundantFilterChain:
5043
5238
  VersionAdded: '1.52'
5044
5239
  VersionChanged: '1.57'
5045
5240
 
5241
+ Style/RedundantFormat:
5242
+ Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
5243
+ Enabled: pending
5244
+ SafeAutoCorrect: false
5245
+ VersionAdded: '1.72'
5246
+ VersionChanged: '1.72'
5247
+
5046
5248
  Style/RedundantFreeze:
5047
5249
  Description: "Checks usages of Object#freeze on immutable objects."
5048
5250
  Enabled: true
@@ -5241,11 +5443,19 @@ Style/SafeNavigation:
5241
5443
  # Maximum length of method chains for register an offense.
5242
5444
  MaxChainLength: 2
5243
5445
 
5446
+ Style/SafeNavigationChainLength:
5447
+ Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
5448
+ StyleGuide: '#safe-navigation'
5449
+ Enabled: pending
5450
+ VersionAdded: '1.68'
5451
+ Max: 2
5452
+
5244
5453
  Style/Sample:
5245
5454
  Description: >-
5246
5455
  Use `sample` instead of `shuffle.first`,
5247
5456
  `shuffle.last`, and `shuffle[Integer]`.
5248
- Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5457
+ References:
5458
+ - 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5249
5459
  Enabled: true
5250
5460
  VersionAdded: '0.30'
5251
5461
 
@@ -5562,14 +5772,17 @@ Style/TrailingCommaInArrayLiteral:
5562
5772
  StyleGuide: '#no-trailing-array-commas'
5563
5773
  Enabled: true
5564
5774
  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.
5775
+ # If `comma`, the cop requires a comma after the last item in an array, but only when each item is
5776
+ # on its own line.
5777
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
5778
+ # array literals.
5779
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
5780
+ # literals, but only when that last item immediately precedes a newline.
5569
5781
  EnforcedStyleForMultiline: no_comma
5570
5782
  SupportedStylesForMultiline:
5571
5783
  - comma
5572
5784
  - consistent_comma
5785
+ - diff_comma
5573
5786
  - no_comma
5574
5787
 
5575
5788
  Style/TrailingCommaInBlockArgs:
@@ -5581,14 +5794,17 @@ Style/TrailingCommaInBlockArgs:
5581
5794
  Style/TrailingCommaInHashLiteral:
5582
5795
  Description: 'Checks for trailing comma in hash literals.'
5583
5796
  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.
5797
+ # If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
5798
+ # on its own line.
5799
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
5800
+ # hash literals.
5801
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
5802
+ # literals, but only when that last item immediately precedes a newline.
5588
5803
  EnforcedStyleForMultiline: no_comma
5589
5804
  SupportedStylesForMultiline:
5590
5805
  - comma
5591
5806
  - consistent_comma
5807
+ - diff_comma
5592
5808
  - no_comma
5593
5809
  VersionAdded: '0.53'
5594
5810
 
@@ -5734,7 +5950,8 @@ Style/YAMLFileRead:
5734
5950
 
5735
5951
  Style/YodaCondition:
5736
5952
  Description: 'Forbid or enforce yoda conditions.'
5737
- Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
5953
+ References:
5954
+ - 'https://en.wikipedia.org/wiki/Yoda_conditions'
5738
5955
  Enabled: true
5739
5956
  EnforcedStyle: forbid_for_all_comparison_operators
5740
5957
  SupportedStyles: