rubocop 1.57.1 → 1.81.6

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 (638) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +92 -89
  4. data/assets/output.css.erb +159 -0
  5. data/assets/output.html.erb +1 -160
  6. data/config/default.yml +540 -86
  7. data/config/internal_affairs.yml +31 -0
  8. data/config/obsoletion.yml +8 -3
  9. data/exe/rubocop +1 -7
  10. data/lib/rubocop/cached_data.rb +21 -5
  11. data/lib/rubocop/cli/command/auto_generate_config.rb +30 -17
  12. data/lib/rubocop/cli/command/execute_runner.rb +4 -4
  13. data/lib/rubocop/cli/command/lsp.rb +4 -4
  14. data/lib/rubocop/cli/command/show_cops.rb +24 -2
  15. data/lib/rubocop/cli/command/show_docs_url.rb +2 -2
  16. data/lib/rubocop/cli/command/suggest_extensions.rb +7 -1
  17. data/lib/rubocop/cli/command/version.rb +2 -2
  18. data/lib/rubocop/cli.rb +28 -4
  19. data/lib/rubocop/comment_config.rb +3 -3
  20. data/lib/rubocop/config.rb +92 -22
  21. data/lib/rubocop/config_finder.rb +12 -2
  22. data/lib/rubocop/config_loader.rb +71 -58
  23. data/lib/rubocop/config_loader_resolver.rb +48 -17
  24. data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -3
  25. data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
  26. data/lib/rubocop/config_obsoletion.rb +56 -9
  27. data/lib/rubocop/config_store.rb +5 -0
  28. data/lib/rubocop/config_validator.rb +39 -20
  29. data/lib/rubocop/cop/autocorrect_logic.rb +57 -27
  30. data/lib/rubocop/cop/base.rb +79 -18
  31. data/lib/rubocop/cop/bundler/duplicated_gem.rb +2 -2
  32. data/lib/rubocop/cop/bundler/gem_comment.rb +2 -2
  33. data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
  34. data/lib/rubocop/cop/bundler/gem_version.rb +4 -5
  35. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
  36. data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
  37. data/lib/rubocop/cop/cop.rb +30 -4
  38. data/lib/rubocop/cop/correctors/alignment_corrector.rb +8 -16
  39. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +4 -8
  40. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +13 -16
  41. data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -0
  42. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +6 -3
  43. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
  44. data/lib/rubocop/cop/documentation.rb +32 -5
  45. data/lib/rubocop/cop/exclude_limit.rb +1 -1
  46. data/lib/rubocop/cop/force.rb +12 -0
  47. data/lib/rubocop/cop/gemspec/add_runtime_dependency.rb +38 -0
  48. data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
  49. data/lib/rubocop/cop/gemspec/dependency_version.rb +3 -5
  50. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +3 -4
  51. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +39 -17
  52. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  53. data/lib/rubocop/cop/gemspec/require_mfa.rb +15 -1
  54. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -3
  55. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +3 -3
  56. data/lib/rubocop/cop/generator.rb +6 -0
  57. data/lib/rubocop/cop/internal_affairs/cop_description.rb +0 -4
  58. data/lib/rubocop/cop/internal_affairs/cop_enabled.rb +85 -0
  59. data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +2 -1
  60. data/lib/rubocop/cop/internal_affairs/example_description.rb +13 -8
  61. data/lib/rubocop/cop/internal_affairs/location_exists.rb +116 -0
  62. data/lib/rubocop/cop/internal_affairs/location_expression.rb +2 -1
  63. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -4
  64. data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +8 -6
  65. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
  66. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +54 -0
  67. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +124 -30
  68. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +63 -0
  69. data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +131 -0
  70. data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +233 -0
  71. data/lib/rubocop/cop/internal_affairs/node_type_group.rb +92 -0
  72. data/lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb +126 -0
  73. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +4 -3
  74. data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +1 -1
  75. data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +90 -0
  76. data/lib/rubocop/cop/internal_affairs/operator_keyword.rb +48 -0
  77. data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
  78. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +6 -5
  79. data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
  80. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +6 -21
  81. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +11 -2
  82. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +5 -4
  83. data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +0 -2
  84. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +23 -2
  85. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +0 -5
  86. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
  87. data/lib/rubocop/cop/internal_affairs.rb +9 -0
  88. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +6 -2
  89. data/lib/rubocop/cop/layout/argument_alignment.rb +3 -10
  90. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  91. data/lib/rubocop/cop/layout/assignment_indentation.rb +3 -2
  92. data/lib/rubocop/cop/layout/begin_end_alignment.rb +0 -1
  93. data/lib/rubocop/cop/layout/block_alignment.rb +32 -13
  94. data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
  95. data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
  96. data/lib/rubocop/cop/layout/class_structure.rb +45 -10
  97. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +5 -5
  98. data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
  99. data/lib/rubocop/cop/layout/condition_position.rb +0 -4
  100. data/lib/rubocop/cop/layout/def_end_alignment.rb +2 -2
  101. data/lib/rubocop/cop/layout/dot_position.rb +1 -1
  102. data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
  103. data/lib/rubocop/cop/layout/empty_comment.rb +3 -1
  104. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +4 -4
  105. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
  106. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
  107. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +36 -21
  108. data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +101 -0
  109. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +37 -7
  110. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +8 -29
  111. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +5 -6
  112. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -0
  113. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
  114. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +12 -8
  115. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +23 -1
  116. data/lib/rubocop/cop/layout/end_alignment.rb +16 -4
  117. data/lib/rubocop/cop/layout/extra_spacing.rb +5 -11
  118. data/lib/rubocop/cop/layout/first_argument_indentation.rb +6 -11
  119. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +19 -10
  120. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -7
  121. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
  122. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +8 -0
  123. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +3 -3
  124. data/lib/rubocop/cop/layout/hash_alignment.rb +8 -11
  125. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +4 -3
  126. data/lib/rubocop/cop/layout/heredoc_indentation.rb +2 -2
  127. data/lib/rubocop/cop/layout/indentation_width.rb +13 -13
  128. data/lib/rubocop/cop/layout/leading_comment_space.rb +83 -1
  129. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +12 -3
  130. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +7 -1
  131. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -2
  132. data/lib/rubocop/cop/layout/line_length.rb +177 -29
  133. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -0
  134. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
  135. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +25 -0
  136. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -1
  137. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +4 -4
  138. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
  139. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +1 -0
  140. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +11 -8
  141. data/lib/rubocop/cop/layout/parameter_alignment.rb +3 -4
  142. data/lib/rubocop/cop/layout/redundant_line_break.rb +32 -46
  143. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +16 -9
  144. data/lib/rubocop/cop/layout/single_line_block_chain.rb +6 -1
  145. data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
  146. data/lib/rubocop/cop/layout/space_after_comma.rb +1 -1
  147. data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
  148. data/lib/rubocop/cop/layout/space_after_semicolon.rb +11 -1
  149. data/lib/rubocop/cop/layout/space_around_keyword.rb +8 -2
  150. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
  151. data/lib/rubocop/cop/layout/space_around_operators.rb +80 -37
  152. data/lib/rubocop/cop/layout/space_before_block_braces.rb +20 -10
  153. data/lib/rubocop/cop/layout/space_before_brackets.rb +7 -40
  154. data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
  155. data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
  156. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +18 -3
  157. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -0
  158. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +8 -1
  159. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +3 -5
  160. data/lib/rubocop/cop/layout/trailing_whitespace.rb +6 -4
  161. data/lib/rubocop/cop/legacy/corrector.rb +12 -2
  162. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -3
  163. data/lib/rubocop/cop/lint/ambiguous_operator.rb +0 -2
  164. data/lib/rubocop/cop/lint/ambiguous_range.rb +9 -1
  165. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +0 -2
  166. data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +118 -0
  167. data/lib/rubocop/cop/lint/assignment_in_condition.rb +7 -9
  168. data/lib/rubocop/cop/lint/big_decimal_new.rb +4 -7
  169. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +11 -13
  170. data/lib/rubocop/cop/lint/boolean_symbol.rb +2 -4
  171. data/lib/rubocop/cop/lint/circular_argument_reference.rb +4 -14
  172. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
  173. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +4 -3
  174. data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
  175. data/lib/rubocop/cop/lint/cop_directive_syntax.rb +90 -0
  176. data/lib/rubocop/cop/lint/debugger.rb +30 -8
  177. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +2 -2
  178. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +7 -13
  179. data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
  180. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -5
  181. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +0 -4
  182. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +1 -1
  183. data/lib/rubocop/cop/lint/duplicate_methods.rb +110 -32
  184. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +6 -43
  185. data/lib/rubocop/cop/lint/duplicate_set_element.rb +87 -0
  186. data/lib/rubocop/cop/lint/each_with_object_argument.rb +0 -4
  187. data/lib/rubocop/cop/lint/else_layout.rb +0 -2
  188. data/lib/rubocop/cop/lint/empty_conditional_body.rb +29 -58
  189. data/lib/rubocop/cop/lint/empty_ensure.rb +2 -12
  190. data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
  191. data/lib/rubocop/cop/lint/empty_file.rb +0 -2
  192. data/lib/rubocop/cop/lint/empty_interpolation.rb +14 -5
  193. data/lib/rubocop/cop/lint/empty_when.rb +1 -3
  194. data/lib/rubocop/cop/lint/ensure_return.rb +2 -10
  195. data/lib/rubocop/cop/lint/erb_new_arguments.rb +24 -23
  196. data/lib/rubocop/cop/lint/float_comparison.rb +58 -15
  197. data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -8
  198. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +2 -12
  199. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
  200. data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
  201. data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
  202. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +23 -12
  203. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +0 -7
  204. data/lib/rubocop/cop/lint/interpolation_check.rb +9 -4
  205. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +50 -0
  206. data/lib/rubocop/cop/lint/literal_as_condition.rb +126 -11
  207. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +85 -0
  208. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +49 -12
  209. data/lib/rubocop/cop/lint/loop.rb +6 -12
  210. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -2
  211. data/lib/rubocop/cop/lint/missing_super.rb +2 -2
  212. data/lib/rubocop/cop/lint/mixed_case_range.rb +14 -12
  213. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
  214. data/lib/rubocop/cop/lint/nested_method_definition.rb +10 -12
  215. data/lib/rubocop/cop/lint/next_without_accumulator.rb +6 -25
  216. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +2 -7
  217. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +12 -3
  218. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +6 -8
  219. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -3
  220. data/lib/rubocop/cop/lint/number_conversion.rb +9 -5
  221. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -2
  222. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +94 -0
  223. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -3
  224. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +3 -2
  225. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +6 -11
  226. data/lib/rubocop/cop/lint/percent_string_array.rb +0 -4
  227. data/lib/rubocop/cop/lint/percent_symbol_array.rb +0 -4
  228. data/lib/rubocop/cop/lint/raise_exception.rb +29 -10
  229. data/lib/rubocop/cop/lint/rand_one.rb +0 -4
  230. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +4 -2
  231. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +2 -2
  232. data/lib/rubocop/cop/lint/redundant_require_statement.rb +0 -21
  233. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +164 -12
  234. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +9 -8
  235. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -6
  236. data/lib/rubocop/cop/lint/redundant_type_conversion.rb +261 -0
  237. data/lib/rubocop/cop/lint/redundant_with_index.rb +9 -2
  238. data/lib/rubocop/cop/lint/redundant_with_object.rb +5 -2
  239. data/lib/rubocop/cop/lint/refinement_import_methods.rb +1 -1
  240. data/lib/rubocop/cop/lint/regexp_as_condition.rb +0 -1
  241. data/lib/rubocop/cop/lint/require_parentheses.rb +0 -4
  242. data/lib/rubocop/cop/lint/require_range_parentheses.rb +1 -1
  243. data/lib/rubocop/cop/lint/rescue_exception.rb +2 -9
  244. data/lib/rubocop/cop/lint/rescue_type.rb +5 -11
  245. data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -13
  246. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +20 -9
  247. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +109 -41
  248. data/lib/rubocop/cop/lint/script_permission.rb +3 -3
  249. data/lib/rubocop/cop/lint/self_assignment.rb +72 -10
  250. data/lib/rubocop/cop/lint/shadowed_argument.rb +8 -7
  251. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
  252. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +19 -11
  253. data/lib/rubocop/cop/lint/shared_mutable_default.rb +76 -0
  254. data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
  255. data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
  256. data/lib/rubocop/cop/lint/symbol_conversion.rb +8 -3
  257. data/lib/rubocop/cop/lint/syntax.rb +10 -4
  258. data/lib/rubocop/cop/lint/to_enum_arguments.rb +2 -4
  259. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
  260. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
  261. data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +88 -0
  262. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +3 -1
  263. data/lib/rubocop/cop/lint/unified_integer.rb +0 -4
  264. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +4 -3
  265. data/lib/rubocop/cop/lint/unreachable_code.rb +56 -9
  266. data/lib/rubocop/cop/lint/unreachable_loop.rb +14 -8
  267. data/lib/rubocop/cop/lint/unused_method_argument.rb +18 -2
  268. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +2 -0
  269. data/lib/rubocop/cop/lint/uri_regexp.rb +25 -7
  270. data/lib/rubocop/cop/lint/useless_access_modifier.rb +36 -10
  271. data/lib/rubocop/cop/lint/useless_assignment.rb +21 -16
  272. data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
  273. data/lib/rubocop/cop/lint/useless_default_value_argument.rb +90 -0
  274. data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
  275. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -4
  276. data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
  277. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +79 -0
  278. data/lib/rubocop/cop/lint/useless_or.rb +98 -0
  279. data/lib/rubocop/cop/lint/useless_rescue.rb +2 -2
  280. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +5 -5
  281. data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -29
  282. data/lib/rubocop/cop/lint/useless_times.rb +2 -2
  283. data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +121 -0
  284. data/lib/rubocop/cop/lint/void.rb +92 -18
  285. data/lib/rubocop/cop/message_annotator.rb +7 -3
  286. data/lib/rubocop/cop/metrics/abc_size.rb +4 -4
  287. data/lib/rubocop/cop/metrics/block_length.rb +7 -5
  288. data/lib/rubocop/cop/metrics/block_nesting.rb +20 -8
  289. data/lib/rubocop/cop/metrics/class_length.rb +21 -15
  290. data/lib/rubocop/cop/metrics/collection_literal_length.rb +7 -0
  291. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +5 -2
  292. data/lib/rubocop/cop/metrics/method_length.rb +15 -6
  293. data/lib/rubocop/cop/metrics/module_length.rb +7 -6
  294. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  295. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
  296. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +8 -9
  297. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
  298. data/lib/rubocop/cop/mixin/alignment.rb +8 -4
  299. data/lib/rubocop/cop/mixin/allowed_methods.rb +7 -1
  300. data/lib/rubocop/cop/mixin/allowed_pattern.rb +15 -3
  301. data/lib/rubocop/cop/mixin/annotation_comment.rb +0 -2
  302. data/lib/rubocop/cop/mixin/check_assignment.rb +4 -12
  303. data/lib/rubocop/cop/mixin/check_line_breakable.rb +22 -12
  304. data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +49 -0
  305. data/lib/rubocop/cop/mixin/code_length.rb +12 -1
  306. data/lib/rubocop/cop/mixin/comments_help.rb +23 -14
  307. data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
  308. data/lib/rubocop/cop/mixin/configurable_max.rb +5 -1
  309. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  310. data/lib/rubocop/cop/mixin/dig_help.rb +27 -0
  311. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
  312. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -7
  313. data/lib/rubocop/cop/mixin/endless_method_rewriter.rb +24 -0
  314. data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
  315. data/lib/rubocop/cop/mixin/forbidden_pattern.rb +16 -0
  316. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +23 -12
  317. data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
  318. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +15 -14
  319. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +45 -35
  320. data/lib/rubocop/cop/mixin/hash_subset.rb +203 -0
  321. data/lib/rubocop/cop/mixin/hash_transform_method.rb +74 -74
  322. data/lib/rubocop/cop/mixin/line_length_help.rb +34 -12
  323. data/lib/rubocop/cop/mixin/method_complexity.rb +17 -7
  324. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +7 -9
  325. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  326. data/lib/rubocop/cop/mixin/percent_array.rb +1 -1
  327. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  328. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +68 -30
  329. data/lib/rubocop/cop/mixin/range_help.rb +15 -4
  330. data/lib/rubocop/cop/mixin/rescue_node.rb +4 -0
  331. data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
  332. data/lib/rubocop/cop/mixin/statement_modifier.rb +11 -5
  333. data/lib/rubocop/cop/mixin/string_help.rb +2 -2
  334. data/lib/rubocop/cop/mixin/string_literals_help.rb +12 -0
  335. data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
  336. data/lib/rubocop/cop/mixin/trailing_comma.rb +21 -5
  337. data/lib/rubocop/cop/naming/accessor_method_name.rb +11 -6
  338. data/lib/rubocop/cop/naming/block_forwarding.rb +39 -8
  339. data/lib/rubocop/cop/naming/constant_name.rb +7 -9
  340. data/lib/rubocop/cop/naming/file_name.rb +4 -6
  341. data/lib/rubocop/cop/naming/inclusive_language.rb +13 -5
  342. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +13 -14
  343. data/lib/rubocop/cop/naming/method_name.rb +185 -15
  344. data/lib/rubocop/cop/naming/predicate_method.rb +319 -0
  345. data/lib/rubocop/cop/naming/predicate_prefix.rb +204 -0
  346. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +14 -13
  347. data/lib/rubocop/cop/naming/variable_name.rb +50 -6
  348. data/lib/rubocop/cop/naming/variable_number.rb +2 -3
  349. data/lib/rubocop/cop/offense.rb +4 -5
  350. data/lib/rubocop/cop/registry.rb +9 -6
  351. data/lib/rubocop/cop/security/compound_hash.rb +4 -2
  352. data/lib/rubocop/cop/security/eval.rb +2 -1
  353. data/lib/rubocop/cop/security/json_load.rb +33 -11
  354. data/lib/rubocop/cop/security/open.rb +3 -2
  355. data/lib/rubocop/cop/security/yaml_load.rb +3 -2
  356. data/lib/rubocop/cop/style/access_modifier_declarations.rb +172 -32
  357. data/lib/rubocop/cop/style/accessor_grouping.rb +43 -9
  358. data/lib/rubocop/cop/style/alias.rb +2 -1
  359. data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +79 -0
  360. data/lib/rubocop/cop/style/and_or.rb +1 -1
  361. data/lib/rubocop/cop/style/arguments_forwarding.rb +228 -36
  362. data/lib/rubocop/cop/style/array_first_last.rb +80 -0
  363. data/lib/rubocop/cop/style/array_intersect.rb +115 -39
  364. data/lib/rubocop/cop/style/array_intersect_with_single_element.rb +47 -0
  365. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
  366. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +2 -2
  367. data/lib/rubocop/cop/style/bitwise_predicate.rb +107 -0
  368. data/lib/rubocop/cop/style/block_delimiters.rb +52 -21
  369. data/lib/rubocop/cop/style/case_like_if.rb +14 -17
  370. data/lib/rubocop/cop/style/class_and_module_children.rb +52 -11
  371. data/lib/rubocop/cop/style/class_check.rb +1 -0
  372. data/lib/rubocop/cop/style/class_equality_comparison.rb +1 -1
  373. data/lib/rubocop/cop/style/class_vars.rb +3 -3
  374. data/lib/rubocop/cop/style/collection_compact.rb +25 -15
  375. data/lib/rubocop/cop/style/collection_methods.rb +2 -1
  376. data/lib/rubocop/cop/style/collection_querying.rb +167 -0
  377. data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
  378. data/lib/rubocop/cop/style/combinable_loops.rb +22 -8
  379. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  380. data/lib/rubocop/cop/style/commented_keyword.rb +30 -4
  381. data/lib/rubocop/cop/style/comparable_between.rb +78 -0
  382. data/lib/rubocop/cop/style/concat_array_literals.rb +2 -1
  383. data/lib/rubocop/cop/style/conditional_assignment.rb +57 -40
  384. data/lib/rubocop/cop/style/constant_visibility.rb +3 -12
  385. data/lib/rubocop/cop/style/copyright.rb +31 -21
  386. data/lib/rubocop/cop/style/data_inheritance.rb +8 -1
  387. data/lib/rubocop/cop/style/date_time.rb +5 -4
  388. data/lib/rubocop/cop/style/def_with_parentheses.rb +18 -7
  389. data/lib/rubocop/cop/style/dig_chain.rb +89 -0
  390. data/lib/rubocop/cop/style/documentation.rb +25 -25
  391. data/lib/rubocop/cop/style/documentation_method.rb +20 -0
  392. data/lib/rubocop/cop/style/double_negation.rb +5 -5
  393. data/lib/rubocop/cop/style/each_for_simple_loop.rb +11 -15
  394. data/lib/rubocop/cop/style/each_with_object.rb +3 -4
  395. data/lib/rubocop/cop/style/empty_else.rb +10 -7
  396. data/lib/rubocop/cop/style/empty_heredoc.rb +1 -14
  397. data/lib/rubocop/cop/style/empty_literal.rb +36 -23
  398. data/lib/rubocop/cop/style/empty_method.rb +1 -1
  399. data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
  400. data/lib/rubocop/cop/style/endless_method.rb +163 -18
  401. data/lib/rubocop/cop/style/eval_with_location.rb +23 -31
  402. data/lib/rubocop/cop/style/exact_regexp_match.rb +6 -5
  403. data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
  404. data/lib/rubocop/cop/style/explicit_block_argument.rb +19 -6
  405. data/lib/rubocop/cop/style/exponential_notation.rb +6 -5
  406. data/lib/rubocop/cop/style/fetch_env_var.rb +34 -7
  407. data/lib/rubocop/cop/style/file_null.rb +89 -0
  408. data/lib/rubocop/cop/style/file_read.rb +2 -5
  409. data/lib/rubocop/cop/style/file_touch.rb +75 -0
  410. data/lib/rubocop/cop/style/file_write.rb +2 -5
  411. data/lib/rubocop/cop/style/float_division.rb +8 -4
  412. data/lib/rubocop/cop/style/for.rb +3 -1
  413. data/lib/rubocop/cop/style/format_string.rb +9 -9
  414. data/lib/rubocop/cop/style/format_string_token.rb +38 -11
  415. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -2
  416. data/lib/rubocop/cop/style/global_std_stream.rb +10 -1
  417. data/lib/rubocop/cop/style/global_vars.rb +1 -3
  418. data/lib/rubocop/cop/style/guard_clause.rb +20 -4
  419. data/lib/rubocop/cop/style/hash_conversion.rb +16 -9
  420. data/lib/rubocop/cop/style/hash_each_methods.rb +110 -12
  421. data/lib/rubocop/cop/style/hash_except.rb +38 -146
  422. data/lib/rubocop/cop/style/hash_fetch_chain.rb +104 -0
  423. data/lib/rubocop/cop/style/hash_slice.rb +80 -0
  424. data/lib/rubocop/cop/style/hash_syntax.rb +35 -7
  425. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  426. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  427. data/lib/rubocop/cop/style/identical_conditional_branches.rb +37 -7
  428. data/lib/rubocop/cop/style/if_inside_else.rb +11 -15
  429. data/lib/rubocop/cop/style/if_unless_modifier.rb +36 -9
  430. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +4 -7
  431. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +8 -8
  432. data/lib/rubocop/cop/style/if_with_semicolon.rb +60 -6
  433. data/lib/rubocop/cop/style/in_pattern_then.rb +6 -2
  434. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  435. data/lib/rubocop/cop/style/inverse_methods.rb +22 -18
  436. data/lib/rubocop/cop/style/invertible_unless_condition.rb +48 -6
  437. data/lib/rubocop/cop/style/ip_addresses.rb +2 -2
  438. data/lib/rubocop/cop/style/it_assignment.rb +93 -0
  439. data/lib/rubocop/cop/style/it_block_parameter.rb +121 -0
  440. data/lib/rubocop/cop/style/keyword_arguments_merging.rb +67 -0
  441. data/lib/rubocop/cop/style/keyword_parameters_order.rb +14 -8
  442. data/lib/rubocop/cop/style/lambda.rb +2 -1
  443. data/lib/rubocop/cop/style/lambda_call.rb +10 -4
  444. data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
  445. data/lib/rubocop/cop/style/magic_comment_format.rb +1 -1
  446. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +82 -50
  447. data/lib/rubocop/cop/style/map_into_array.rb +236 -0
  448. data/lib/rubocop/cop/style/map_to_hash.rb +29 -10
  449. data/lib/rubocop/cop/style/map_to_set.rb +4 -5
  450. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +52 -25
  451. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +21 -5
  452. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +30 -13
  453. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -4
  454. data/lib/rubocop/cop/style/method_def_parentheses.rb +2 -2
  455. data/lib/rubocop/cop/style/min_max_comparison.rb +13 -5
  456. data/lib/rubocop/cop/style/missing_else.rb +2 -4
  457. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +35 -5
  458. data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -2
  459. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -0
  460. data/lib/rubocop/cop/style/multiline_memoization.rb +2 -2
  461. data/lib/rubocop/cop/style/multiline_method_signature.rb +10 -9
  462. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +5 -3
  463. data/lib/rubocop/cop/style/multiline_when_then.rb +0 -4
  464. data/lib/rubocop/cop/style/multiple_comparison.rb +53 -60
  465. data/lib/rubocop/cop/style/mutable_constant.rb +7 -8
  466. data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -5
  467. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  468. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +2 -2
  469. data/lib/rubocop/cop/style/nested_ternary_operator.rb +5 -4
  470. data/lib/rubocop/cop/style/next.rb +45 -1
  471. data/lib/rubocop/cop/style/nil_comparison.rb +11 -7
  472. data/lib/rubocop/cop/style/not.rb +1 -1
  473. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
  474. data/lib/rubocop/cop/style/numeric_predicate.rb +12 -4
  475. data/lib/rubocop/cop/style/object_then.rb +16 -14
  476. data/lib/rubocop/cop/style/one_line_conditional.rb +48 -15
  477. data/lib/rubocop/cop/style/open_struct_use.rb +5 -5
  478. data/lib/rubocop/cop/style/operator_method_call.rb +27 -9
  479. data/lib/rubocop/cop/style/or_assignment.rb +3 -6
  480. data/lib/rubocop/cop/style/parallel_assignment.rb +47 -45
  481. data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -0
  482. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  483. data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
  484. data/lib/rubocop/cop/style/proc.rb +2 -2
  485. data/lib/rubocop/cop/style/quoted_symbols.rb +2 -4
  486. data/lib/rubocop/cop/style/raise_args.rb +19 -14
  487. data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
  488. data/lib/rubocop/cop/style/redundant_argument.rb +29 -3
  489. data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
  490. data/lib/rubocop/cop/style/redundant_assignment.rb +11 -3
  491. data/lib/rubocop/cop/style/redundant_begin.rb +41 -2
  492. data/lib/rubocop/cop/style/redundant_condition.rb +97 -25
  493. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +19 -7
  494. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +17 -14
  495. data/lib/rubocop/cop/style/redundant_each.rb +7 -4
  496. data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
  497. data/lib/rubocop/cop/style/redundant_fetch_block.rb +4 -12
  498. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
  499. data/lib/rubocop/cop/style/redundant_filter_chain.rb +5 -4
  500. data/lib/rubocop/cop/style/redundant_format.rb +283 -0
  501. data/lib/rubocop/cop/style/redundant_freeze.rb +4 -4
  502. data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
  503. data/lib/rubocop/cop/style/redundant_interpolation.rb +12 -3
  504. data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +46 -0
  505. data/lib/rubocop/cop/style/redundant_line_continuation.rb +72 -19
  506. data/lib/rubocop/cop/style/redundant_parentheses.rb +149 -49
  507. data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
  508. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +12 -1
  509. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
  510. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +16 -24
  511. data/lib/rubocop/cop/style/redundant_return.rb +9 -3
  512. data/lib/rubocop/cop/style/redundant_self.rb +32 -20
  513. data/lib/rubocop/cop/style/redundant_self_assignment.rb +20 -32
  514. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +4 -4
  515. data/lib/rubocop/cop/style/redundant_sort.rb +10 -9
  516. data/lib/rubocop/cop/style/redundant_sort_by.rb +19 -3
  517. data/lib/rubocop/cop/style/redundant_string_escape.rb +3 -3
  518. data/lib/rubocop/cop/style/regexp_literal.rb +1 -1
  519. data/lib/rubocop/cop/style/require_order.rb +2 -2
  520. data/lib/rubocop/cop/style/rescue_modifier.rb +18 -4
  521. data/lib/rubocop/cop/style/return_nil.rb +2 -2
  522. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +54 -12
  523. data/lib/rubocop/cop/style/safe_navigation.rb +163 -62
  524. data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
  525. data/lib/rubocop/cop/style/sample.rb +3 -4
  526. data/lib/rubocop/cop/style/select_by_regexp.rb +20 -13
  527. data/lib/rubocop/cop/style/self_assignment.rb +12 -18
  528. data/lib/rubocop/cop/style/semicolon.rb +30 -7
  529. data/lib/rubocop/cop/style/send.rb +4 -4
  530. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +105 -0
  531. data/lib/rubocop/cop/style/signal_exception.rb +2 -3
  532. data/lib/rubocop/cop/style/single_argument_dig.rb +16 -8
  533. data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
  534. data/lib/rubocop/cop/style/single_line_do_end_block.rb +18 -5
  535. data/lib/rubocop/cop/style/single_line_methods.rb +13 -11
  536. data/lib/rubocop/cop/style/slicing_with_range.rb +105 -10
  537. data/lib/rubocop/cop/style/sole_nested_conditional.rb +72 -87
  538. data/lib/rubocop/cop/style/special_global_vars.rb +2 -3
  539. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
  540. data/lib/rubocop/cop/style/string_chars.rb +1 -0
  541. data/lib/rubocop/cop/style/string_concatenation.rb +21 -17
  542. data/lib/rubocop/cop/style/string_literals.rb +1 -1
  543. data/lib/rubocop/cop/style/string_methods.rb +1 -1
  544. data/lib/rubocop/cop/style/strip.rb +7 -4
  545. data/lib/rubocop/cop/style/struct_inheritance.rb +9 -2
  546. data/lib/rubocop/cop/style/super_arguments.rb +221 -0
  547. data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
  548. data/lib/rubocop/cop/style/swap_values.rb +4 -15
  549. data/lib/rubocop/cop/style/symbol_array.rb +1 -1
  550. data/lib/rubocop/cop/style/symbol_proc.rb +78 -6
  551. data/lib/rubocop/cop/style/ternary_parentheses.rb +26 -5
  552. data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -1
  553. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +56 -2
  554. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
  555. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
  556. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
  557. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -4
  558. data/lib/rubocop/cop/style/trivial_accessors.rb +2 -2
  559. data/lib/rubocop/cop/style/unless_else.rb +10 -9
  560. data/lib/rubocop/cop/style/unpack_first.rb +11 -14
  561. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
  562. data/lib/rubocop/cop/style/while_until_do.rb +0 -2
  563. data/lib/rubocop/cop/style/while_until_modifier.rb +0 -2
  564. data/lib/rubocop/cop/style/yoda_condition.rb +8 -4
  565. data/lib/rubocop/cop/style/yoda_expression.rb +2 -1
  566. data/lib/rubocop/cop/style/zero_length_predicate.rb +32 -24
  567. data/lib/rubocop/cop/team.rb +28 -4
  568. data/lib/rubocop/cop/util.rb +19 -6
  569. data/lib/rubocop/cop/utils/format_string.rb +20 -5
  570. data/lib/rubocop/cop/variable_force/assignment.rb +24 -5
  571. data/lib/rubocop/cop/variable_force/branch.rb +1 -1
  572. data/lib/rubocop/cop/variable_force/scope.rb +1 -1
  573. data/lib/rubocop/cop/variable_force/variable.rb +14 -3
  574. data/lib/rubocop/cop/variable_force/variable_table.rb +5 -5
  575. data/lib/rubocop/cop/variable_force.rb +43 -20
  576. data/lib/rubocop/cops_documentation_generator.rb +135 -58
  577. data/lib/rubocop/core_ext/string.rb +2 -6
  578. data/lib/rubocop/directive_comment.rb +54 -18
  579. data/lib/rubocop/ext/regexp_node.rb +17 -35
  580. data/lib/rubocop/ext/regexp_parser.rb +4 -21
  581. data/lib/rubocop/file_finder.rb +9 -4
  582. data/lib/rubocop/formatter/clang_style_formatter.rb +3 -7
  583. data/lib/rubocop/formatter/disabled_config_formatter.rb +43 -14
  584. data/lib/rubocop/formatter/formatter_set.rb +8 -2
  585. data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
  586. data/lib/rubocop/formatter/html_formatter.rb +38 -15
  587. data/lib/rubocop/formatter/json_formatter.rb +0 -1
  588. data/lib/rubocop/formatter/junit_formatter.rb +70 -23
  589. data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
  590. data/lib/rubocop/formatter/offense_count_formatter.rb +13 -3
  591. data/lib/rubocop/formatter/pacman_formatter.rb +2 -1
  592. data/lib/rubocop/formatter/tap_formatter.rb +3 -7
  593. data/lib/rubocop/formatter.rb +1 -1
  594. data/lib/rubocop/lockfile.rb +58 -7
  595. data/lib/rubocop/lsp/diagnostic.rb +190 -0
  596. data/lib/rubocop/lsp/logger.rb +3 -3
  597. data/lib/rubocop/lsp/routes.rb +77 -40
  598. data/lib/rubocop/lsp/runtime.rb +20 -50
  599. data/lib/rubocop/lsp/server.rb +6 -4
  600. data/lib/rubocop/lsp/severity.rb +1 -1
  601. data/lib/rubocop/lsp/stdin_runner.rb +69 -0
  602. data/lib/rubocop/lsp.rb +36 -0
  603. data/lib/rubocop/magic_comment.rb +12 -4
  604. data/lib/rubocop/options.rb +43 -22
  605. data/lib/rubocop/path_util.rb +21 -10
  606. data/lib/rubocop/pending_cops_reporter.rb +56 -0
  607. data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
  608. data/lib/rubocop/plugin/load_error.rb +26 -0
  609. data/lib/rubocop/plugin/loader.rb +100 -0
  610. data/lib/rubocop/plugin/not_supported_error.rb +29 -0
  611. data/lib/rubocop/plugin.rb +46 -0
  612. data/lib/rubocop/rake_task.rb +5 -2
  613. data/lib/rubocop/remote_config.rb +5 -1
  614. data/lib/rubocop/result_cache.rb +29 -34
  615. data/lib/rubocop/rspec/cop_helper.rb +20 -2
  616. data/lib/rubocop/rspec/expect_offense.rb +31 -12
  617. data/lib/rubocop/rspec/shared_contexts.rb +112 -18
  618. data/lib/rubocop/rspec/support.rb +7 -2
  619. data/lib/rubocop/runner.rb +40 -13
  620. data/lib/rubocop/server/cache.rb +63 -11
  621. data/lib/rubocop/server/cli.rb +2 -2
  622. data/lib/rubocop/server/client_command/base.rb +10 -0
  623. data/lib/rubocop/server/client_command/exec.rb +3 -3
  624. data/lib/rubocop/server/client_command/start.rb +11 -1
  625. data/lib/rubocop/server/core.rb +5 -0
  626. data/lib/rubocop/server/server_command/exec.rb +0 -1
  627. data/lib/rubocop/target_finder.rb +93 -82
  628. data/lib/rubocop/target_ruby.rb +111 -81
  629. data/lib/rubocop/version.rb +67 -9
  630. data/lib/rubocop/yaml_duplication_checker.rb +20 -26
  631. data/lib/rubocop.rb +61 -3
  632. data/lib/ruby_lsp/rubocop/addon.rb +90 -0
  633. data/lib/ruby_lsp/rubocop/runtime_adapter.rb +99 -0
  634. metadata +103 -51
  635. data/lib/rubocop/cop/naming/predicate_name.rb +0 -134
  636. data/lib/rubocop/cop/utils/regexp_ranges.rb +0 -113
  637. data/lib/rubocop/rspec/host_environment_simulation_helper.rb +0 -28
  638. /data/lib/rubocop/formatter/{git_hub_actions_formatter.rb → github_actions_formatter.rb} +0 -0
data/config/default.yml CHANGED
@@ -82,6 +82,8 @@ AllCops:
82
82
  StyleGuideBaseURL: https://rubystyle.guide
83
83
  # Documentation URLs will be constructed using the base URL.
84
84
  DocumentationBaseURL: https://docs.rubocop.org/rubocop
85
+ # Documentation URLs will end with this extension.
86
+ DocumentationExtension: .html
85
87
  # Extra details are not displayed in offense messages by default. Change
86
88
  # behavior by overriding ExtraDetails, or by giving the
87
89
  # `-E/--extra-details` option.
@@ -144,6 +146,14 @@ AllCops:
144
146
  # Ruby version is still unresolved, RuboCop will use the oldest officially
145
147
  # supported Ruby version (currently Ruby 2.7).
146
148
  TargetRubyVersion: ~
149
+ # RuboCop choses the parser engine automatically but you can also specify it yourself.
150
+ # These options are available:
151
+ # - `default`
152
+ # - `parser_whitequark` ... https://github.com/whitequark/parser
153
+ # - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
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
147
157
  # Determines if a notification for extension libraries should be shown when
148
158
  # rubocop is run. Keys are the name of the extension, and values are an array
149
159
  # of gems in the Gemfile that the extension is suggested for, if not already
@@ -157,8 +167,14 @@ AllCops:
157
167
  rubocop-graphql: [graphql]
158
168
  rubocop-capybara: [capybara]
159
169
  rubocop-factory_bot: [factory_bot, factory_bot_rails]
170
+ rubocop-rspec_rails: [rspec-rails]
160
171
  # Enable/Disable checking the methods extended by Active Support.
161
172
  ActiveSupportExtensionsEnabled: false
173
+ # Future version of Ruby will freeze string literals by default.
174
+ # This allows to opt in early, for example when enabled through RUBYOPT.
175
+ # For now this will behave as if set to false but in future ruby versions
176
+ # (likely 4.0) it will be true by default.
177
+ StringLiteralsFrozenByDefault: ~
162
178
 
163
179
  #################### Bundler ###############################
164
180
 
@@ -255,6 +271,23 @@ Bundler/OrderedGems:
255
271
 
256
272
  #################### Gemspec ###############################
257
273
 
274
+ Gemspec/AddRuntimeDependency:
275
+ Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
276
+ StyleGuide: '#add_dependency_vs_add_runtime_dependency'
277
+ References:
278
+ - https://github.com/ruby/rubygems/issues/7799#issuecomment-2192720316
279
+ Enabled: pending
280
+ VersionAdded: '1.65'
281
+ Include:
282
+ - '**/*.gemspec'
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
+
258
291
  Gemspec/DependencyVersion:
259
292
  Description: 'Requires or forbids specifying gem dependency versions.'
260
293
  Enabled: false
@@ -318,7 +351,7 @@ Gemspec/RequireMFA:
318
351
  Severity: warning
319
352
  VersionAdded: '1.23'
320
353
  VersionChanged: '1.40'
321
- Reference:
354
+ References:
322
355
  - https://guides.rubygems.org/mfa-requirement-opt-in/
323
356
  Include:
324
357
  - '**/*.gemspec'
@@ -345,7 +378,7 @@ Gemspec/RubyVersionGlobalsUsage:
345
378
  #################### Layout ###########################
346
379
 
347
380
  Layout/AccessModifierIndentation:
348
- Description: Check indentation of private/protected visibility modifiers.
381
+ Description: Checks indentation of private/protected visibility modifiers.
349
382
  StyleGuide: '#indent-public-private-protected'
350
383
  Enabled: true
351
384
  VersionAdded: '0.49'
@@ -556,7 +589,9 @@ Layout/ElseAlignment:
556
589
  Layout/EmptyComment:
557
590
  Description: 'Checks empty comment.'
558
591
  Enabled: true
592
+ AutoCorrect: contextual
559
593
  VersionAdded: '0.53'
594
+ VersionChanged: '1.61'
560
595
  AllowBorderComment: true
561
596
  AllowMarginComment: true
562
597
 
@@ -577,7 +612,7 @@ Layout/EmptyLineAfterMultilineCondition:
577
612
  # This is disabled, because this style is not very common in practice.
578
613
  Enabled: false
579
614
  VersionAdded: '0.90'
580
- Reference:
615
+ References:
581
616
  - https://github.com/airbnb/ruby#multiline-if-newline
582
617
 
583
618
  Layout/EmptyLineBetweenDefs:
@@ -603,6 +638,12 @@ Layout/EmptyLines:
603
638
  Enabled: true
604
639
  VersionAdded: '0.49'
605
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
+
606
647
  Layout/EmptyLinesAroundAccessModifier:
607
648
  Description: "Keep blank lines around access modifiers."
608
649
  StyleGuide: '#empty-lines-around-access-modifier'
@@ -612,7 +653,7 @@ Layout/EmptyLinesAroundAccessModifier:
612
653
  SupportedStyles:
613
654
  - around
614
655
  - only_before
615
- Reference:
656
+ References:
616
657
  # A reference to `EnforcedStyle: only_before`.
617
658
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
618
659
 
@@ -836,6 +877,7 @@ Layout/FirstMethodArgumentLineBreak:
836
877
  Enabled: false
837
878
  VersionAdded: '0.49'
838
879
  AllowMultilineFinalElement: false
880
+ AllowedMethods: []
839
881
 
840
882
  Layout/FirstMethodParameterLineBreak:
841
883
  Description: >-
@@ -968,7 +1010,7 @@ Layout/IndentationConsistency:
968
1010
  SupportedStyles:
969
1011
  - normal
970
1012
  - indented_internal_methods
971
- Reference:
1013
+ References:
972
1014
  # A reference to `EnforcedStyle: indented_internal_methods`.
973
1015
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
974
1016
 
@@ -1011,9 +1053,11 @@ Layout/LeadingCommentSpace:
1011
1053
  VersionChanged: '0.73'
1012
1054
  AllowDoxygenCommentStyle: false
1013
1055
  AllowGemfileRubyComment: false
1056
+ AllowRBSInlineAnnotation: false
1057
+ AllowSteepAnnotation: false
1014
1058
 
1015
1059
  Layout/LeadingEmptyLines:
1016
- 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.
1017
1061
  Enabled: true
1018
1062
  VersionAdded: '0.57'
1019
1063
  VersionChanged: '0.77'
@@ -1058,12 +1102,13 @@ Layout/LineLength:
1058
1102
  StyleGuide: '#max-line-length'
1059
1103
  Enabled: true
1060
1104
  VersionAdded: '0.25'
1061
- VersionChanged: '1.4'
1105
+ VersionChanged: '1.69'
1062
1106
  Max: 120
1107
+ AllowHeredoc: true
1063
1108
  # To make it possible to copy or click on URIs in the code, we allow lines
1064
1109
  # containing a URI to be longer than Max.
1065
- AllowHeredoc: true
1066
1110
  AllowURI: true
1111
+ AllowQualifiedName: true
1067
1112
  URISchemes:
1068
1113
  - http
1069
1114
  - https
@@ -1074,6 +1119,8 @@ Layout/LineLength:
1074
1119
  # elements. Strings will be converted to Regexp objects. A line that matches
1075
1120
  # any regular expression listed in this option will be ignored by LineLength.
1076
1121
  AllowedPatterns: []
1122
+ # If SplitStrings is true, long strings will be split using continuations
1123
+ SplitStrings: false
1077
1124
 
1078
1125
  Layout/MultilineArrayBraceLayout:
1079
1126
  Description: >-
@@ -1100,7 +1147,7 @@ Layout/MultilineArrayLineBreaks:
1100
1147
  AllowMultilineFinalElement: false
1101
1148
 
1102
1149
  Layout/MultilineAssignmentLayout:
1103
- Description: 'Check for a newline after the assignment operator in multi-line assignments.'
1150
+ Description: 'Checks for a newline after the assignment operator in multi-line assignments.'
1104
1151
  StyleGuide: '#indent-conditional-assignment'
1105
1152
  Enabled: false
1106
1153
  VersionAdded: '0.49'
@@ -1351,6 +1398,10 @@ Layout/SpaceAroundOperators:
1351
1398
  SupportedStylesForExponentOperator:
1352
1399
  - space
1353
1400
  - no_space
1401
+ EnforcedStyleForRationalLiterals: no_space
1402
+ SupportedStylesForRationalLiterals:
1403
+ - space
1404
+ - no_space
1354
1405
 
1355
1406
  Layout/SpaceBeforeBlockBraces:
1356
1407
  Description: >-
@@ -1467,7 +1518,6 @@ Layout/SpaceInsideHashLiteralBraces:
1467
1518
  - space
1468
1519
  - no_space
1469
1520
 
1470
-
1471
1521
  Layout/SpaceInsideParens:
1472
1522
  Description: 'No spaces after ( or before ).'
1473
1523
  StyleGuide: '#spaces-braces'
@@ -1583,6 +1633,12 @@ Lint/AmbiguousRegexpLiteral:
1583
1633
  VersionAdded: '0.17'
1584
1634
  VersionChanged: '0.83'
1585
1635
 
1636
+ Lint/ArrayLiteralInRegexp:
1637
+ Description: 'Checks for an array literal interpolated inside a regexp.'
1638
+ Enabled: pending
1639
+ VersionAdded: '1.71'
1640
+ SafeAutoCorrect: false
1641
+
1586
1642
  Lint/AssignmentInCondition:
1587
1643
  Description: "Don't use assignment in conditions."
1588
1644
  StyleGuide: '#safe-assignment-in-condition'
@@ -1602,10 +1658,10 @@ Lint/BinaryOperatorWithIdenticalOperands:
1602
1658
  Enabled: true
1603
1659
  Safe: false
1604
1660
  VersionAdded: '0.89'
1605
- VersionChanged: '1.7'
1661
+ VersionChanged: '1.69'
1606
1662
 
1607
1663
  Lint/BooleanSymbol:
1608
- Description: 'Check for `:true` and `:false` symbols.'
1664
+ Description: 'Checks for `:true` and `:false` symbols.'
1609
1665
  Enabled: true
1610
1666
  SafeAutoCorrect: false
1611
1667
  VersionAdded: '0.50'
@@ -1632,8 +1688,13 @@ Lint/ConstantOverwrittenInRescue:
1632
1688
  Enabled: pending
1633
1689
  VersionAdded: '1.31'
1634
1690
 
1691
+ Lint/ConstantReassignment:
1692
+ Description: 'Checks for constant reassignments.'
1693
+ Enabled: pending
1694
+ VersionAdded: '1.70'
1695
+
1635
1696
  Lint/ConstantResolution:
1636
- Description: 'Check that constants are fully qualified with `::`.'
1697
+ Description: 'Checks that constants are fully qualified with `::`.'
1637
1698
  Enabled: false
1638
1699
  VersionAdded: '0.86'
1639
1700
  # Restrict this cop to only looking at certain names
@@ -1641,11 +1702,16 @@ Lint/ConstantResolution:
1641
1702
  # Restrict this cop from only looking at certain names
1642
1703
  Ignore: []
1643
1704
 
1705
+ Lint/CopDirectiveSyntax:
1706
+ Description: 'Checks that `# rubocop:` directives are strictly formatted.'
1707
+ Enabled: pending
1708
+ VersionAdded: '1.72'
1709
+
1644
1710
  Lint/Debugger:
1645
- Description: 'Check for debugger calls.'
1711
+ Description: 'Checks for debugger calls.'
1646
1712
  Enabled: true
1647
1713
  VersionAdded: '0.14'
1648
- VersionChanged: '1.46'
1714
+ VersionChanged: '1.63'
1649
1715
  DebuggerMethods:
1650
1716
  # Groups are available so that a specific group can be disabled in
1651
1717
  # a user's configuration, but are otherwise not significant.
@@ -1658,8 +1724,14 @@ Lint/Debugger:
1658
1724
  - Kernel.byebug
1659
1725
  - Kernel.remote_byebug
1660
1726
  Capybara:
1727
+ - page.save_and_open_page
1728
+ - page.save_and_open_screenshot
1729
+ - page.save_page
1730
+ - page.save_screenshot
1661
1731
  - save_and_open_page
1662
1732
  - save_and_open_screenshot
1733
+ - save_page
1734
+ - save_screenshot
1663
1735
  debug.rb:
1664
1736
  - binding.b
1665
1737
  - binding.break
@@ -1681,9 +1753,13 @@ Lint/Debugger:
1681
1753
  - jard
1682
1754
  WebConsole:
1683
1755
  - binding.console
1756
+ DebuggerRequires:
1757
+ debug.rb:
1758
+ - debug/open
1759
+ - debug/start
1684
1760
 
1685
1761
  Lint/DeprecatedClassMethods:
1686
- Description: 'Check for deprecated class method calls.'
1762
+ Description: 'Checks for deprecated class method calls.'
1687
1763
  Enabled: true
1688
1764
  VersionAdded: '0.19'
1689
1765
 
@@ -1744,6 +1820,7 @@ Lint/DuplicateBranch:
1744
1820
  VersionChanged: '1.7'
1745
1821
  IgnoreLiteralBranches: false
1746
1822
  IgnoreConstantBranches: false
1823
+ IgnoreDuplicateElseBranch: false
1747
1824
 
1748
1825
  Lint/DuplicateCaseCondition:
1749
1826
  Description: 'Do not repeat values in case conditionals.'
@@ -1756,13 +1833,13 @@ Lint/DuplicateElsifCondition:
1756
1833
  VersionAdded: '0.88'
1757
1834
 
1758
1835
  Lint/DuplicateHashKey:
1759
- Description: 'Check for duplicate keys in hash literals.'
1836
+ Description: 'Checks for duplicate keys in hash literals.'
1760
1837
  Enabled: true
1761
1838
  VersionAdded: '0.34'
1762
1839
  VersionChanged: '0.77'
1763
1840
 
1764
1841
  Lint/DuplicateMagicComment:
1765
- Description: 'Check for duplicated magic comments.'
1842
+ Description: 'Checks for duplicated magic comments.'
1766
1843
  Enabled: pending
1767
1844
  VersionAdded: '1.37'
1768
1845
 
@@ -1772,7 +1849,7 @@ Lint/DuplicateMatchPattern:
1772
1849
  VersionAdded: '1.50'
1773
1850
 
1774
1851
  Lint/DuplicateMethods:
1775
- Description: 'Check for duplicate method definitions.'
1852
+ Description: 'Checks for duplicate method definitions.'
1776
1853
  Enabled: true
1777
1854
  VersionAdded: '0.29'
1778
1855
 
@@ -1782,7 +1859,7 @@ Lint/DuplicateRegexpCharacterClassElement:
1782
1859
  VersionAdded: '1.1'
1783
1860
 
1784
1861
  Lint/DuplicateRequire:
1785
- Description: 'Check for duplicate `require`s and `require_relative`s.'
1862
+ Description: 'Checks for duplicate `require`s and `require_relative`s.'
1786
1863
  Enabled: true
1787
1864
  SafeAutoCorrect: false
1788
1865
  VersionAdded: '0.90'
@@ -1793,13 +1870,18 @@ Lint/DuplicateRescueException:
1793
1870
  Enabled: true
1794
1871
  VersionAdded: '0.89'
1795
1872
 
1873
+ Lint/DuplicateSetElement:
1874
+ Description: 'Checks for duplicate elements in Set.'
1875
+ Enabled: pending
1876
+ VersionAdded: '1.67'
1877
+
1796
1878
  Lint/EachWithObjectArgument:
1797
- Description: 'Check for immutable argument given to each_with_object.'
1879
+ Description: 'Checks for immutable argument given to each_with_object.'
1798
1880
  Enabled: true
1799
1881
  VersionAdded: '0.31'
1800
1882
 
1801
1883
  Lint/ElseLayout:
1802
- Description: 'Check for odd code arrangement in an else block.'
1884
+ Description: 'Checks for odd code arrangement in an else block.'
1803
1885
  Enabled: true
1804
1886
  VersionAdded: '0.17'
1805
1887
  VersionChanged: '1.2'
@@ -1821,16 +1903,17 @@ Lint/EmptyClass:
1821
1903
  Lint/EmptyConditionalBody:
1822
1904
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1823
1905
  Enabled: true
1824
- SafeAutoCorrect: false
1906
+ AutoCorrect: contextual
1825
1907
  AllowComments: true
1826
1908
  VersionAdded: '0.89'
1827
- VersionChanged: '1.34'
1909
+ VersionChanged: '1.73'
1828
1910
 
1829
1911
  Lint/EmptyEnsure:
1830
1912
  Description: 'Checks for empty ensure block.'
1831
1913
  Enabled: true
1914
+ AutoCorrect: contextual
1832
1915
  VersionAdded: '0.10'
1833
- VersionChanged: '0.48'
1916
+ VersionChanged: '1.61'
1834
1917
 
1835
1918
  Lint/EmptyExpression:
1836
1919
  Description: 'Checks for empty expressions.'
@@ -1852,8 +1935,9 @@ Lint/EmptyInPattern:
1852
1935
  Lint/EmptyInterpolation:
1853
1936
  Description: 'Checks for empty string interpolation.'
1854
1937
  Enabled: true
1938
+ AutoCorrect: contextual
1855
1939
  VersionAdded: '0.20'
1856
- VersionChanged: '0.45'
1940
+ VersionChanged: '1.76'
1857
1941
 
1858
1942
  Lint/EmptyWhen:
1859
1943
  Description: 'Checks for `when` branches with empty bodies.'
@@ -1905,6 +1989,11 @@ Lint/HashCompareByIdentity:
1905
1989
  Safe: false
1906
1990
  VersionAdded: '0.93'
1907
1991
 
1992
+ Lint/HashNewWithKeywordArgumentsAsDefault:
1993
+ Description: 'Checks for the deprecated use of keyword arguments for hash default in `Hash.new`.'
1994
+ Enabled: pending
1995
+ VersionAdded: '1.69'
1996
+
1908
1997
  Lint/HeredocMethodCallPosition:
1909
1998
  Description: >-
1910
1999
  Checks for the ordering of a method call where
@@ -1959,6 +2048,13 @@ Lint/InterpolationCheck:
1959
2048
  VersionAdded: '0.50'
1960
2049
  VersionChanged: '1.40'
1961
2050
 
2051
+ Lint/ItWithoutArgumentsInBlock:
2052
+ Description: 'Checks uses of `it` calls without arguments in block.'
2053
+ References:
2054
+ - 'https://bugs.ruby-lang.org/issues/18980'
2055
+ Enabled: pending
2056
+ VersionAdded: '1.59'
2057
+
1962
2058
  Lint/LambdaWithoutLiteralBlock:
1963
2059
  Description: 'Checks uses of lambda without a literal block.'
1964
2060
  Enabled: pending
@@ -1967,8 +2063,14 @@ Lint/LambdaWithoutLiteralBlock:
1967
2063
  Lint/LiteralAsCondition:
1968
2064
  Description: 'Checks of literals used in conditions.'
1969
2065
  Enabled: true
2066
+ AutoCorrect: contextual
1970
2067
  VersionAdded: '0.51'
1971
2068
 
2069
+ Lint/LiteralAssignmentInCondition:
2070
+ Description: 'Checks for literal assignments in the conditions.'
2071
+ Enabled: pending
2072
+ VersionAdded: '1.58'
2073
+
1972
2074
  Lint/LiteralInInterpolation:
1973
2075
  Description: 'Checks for literals used in interpolation.'
1974
2076
  Enabled: true
@@ -2084,6 +2186,11 @@ Lint/NumberedParameterAssignment:
2084
2186
  Enabled: pending
2085
2187
  VersionAdded: '1.9'
2086
2188
 
2189
+ Lint/NumericOperationWithConstantResult:
2190
+ Description: 'Checks for numeric operations with constant results.'
2191
+ Enabled: pending
2192
+ VersionAdded: '1.69'
2193
+
2087
2194
  Lint/OrAssignmentToConstant:
2088
2195
  Description: 'Checks unintended or-assignment to constant.'
2089
2196
  Enabled: pending
@@ -2170,14 +2277,14 @@ Lint/RedundantRegexpQuantifiers:
2170
2277
  Lint/RedundantRequireStatement:
2171
2278
  Description: 'Checks for unnecessary `require` statement.'
2172
2279
  Enabled: true
2173
- SafeAutoCorrect: false
2174
2280
  VersionAdded: '0.76'
2175
- VersionChanged: '1.57'
2281
+ VersionChanged: '1.73'
2176
2282
 
2177
2283
  Lint/RedundantSafeNavigation:
2178
2284
  Description: 'Checks for redundant safe navigation calls.'
2179
2285
  Enabled: true
2180
2286
  VersionAdded: '0.93'
2287
+ VersionChanged: '1.79'
2181
2288
  AllowedMethods:
2182
2289
  - instance_of?
2183
2290
  - kind_of?
@@ -2185,6 +2292,12 @@ Lint/RedundantSafeNavigation:
2185
2292
  - eql?
2186
2293
  - respond_to?
2187
2294
  - equal?
2295
+ InferNonNilReceiver: false
2296
+ AdditionalNilMethods:
2297
+ - present?
2298
+ - blank?
2299
+ - try
2300
+ - try!
2188
2301
  Safe: false
2189
2302
 
2190
2303
  Lint/RedundantSplatExpansion:
@@ -2201,6 +2314,11 @@ Lint/RedundantStringCoercion:
2201
2314
  VersionAdded: '0.19'
2202
2315
  VersionChanged: '0.77'
2203
2316
 
2317
+ Lint/RedundantTypeConversion:
2318
+ Description: 'Checks for redundantly converting a literal to the same type.'
2319
+ Enabled: pending
2320
+ VersionAdded: '1.72'
2321
+
2204
2322
  Lint/RedundantWithIndex:
2205
2323
  Description: 'Checks for redundant `with_index`.'
2206
2324
  Enabled: true
@@ -2274,9 +2392,9 @@ Lint/SafeNavigationChain:
2274
2392
 
2275
2393
  Lint/SafeNavigationConsistency:
2276
2394
  Description: >-
2277
- Check to make sure that if safe navigation is used for a method
2278
- call in an `&&` or `||` condition that safe navigation is used
2279
- for all method calls on that same object.
2395
+ Check to make sure that if safe navigation is used in an `&&` or `||` condition,
2396
+ consistent and appropriate safe navigation, without excess or deficiency,
2397
+ is used for all method calls on the same object.
2280
2398
  Enabled: true
2281
2399
  VersionAdded: '0.55'
2282
2400
  VersionChanged: '0.77'
@@ -2303,6 +2421,7 @@ Lint/SelfAssignment:
2303
2421
  Description: 'Checks for self-assignments.'
2304
2422
  Enabled: true
2305
2423
  VersionAdded: '0.89'
2424
+ AllowRBSInlineAnnotation: false
2306
2425
 
2307
2426
  Lint/SendWithMixinArgument:
2308
2427
  Description: 'Checks for `send` method when using mixin.'
@@ -2315,7 +2434,6 @@ Lint/ShadowedArgument:
2315
2434
  VersionAdded: '0.52'
2316
2435
  IgnoreImplicitReferences: false
2317
2436
 
2318
-
2319
2437
  Lint/ShadowedException:
2320
2438
  Description: >-
2321
2439
  Avoid rescuing a higher level exception
@@ -2327,8 +2445,15 @@ Lint/ShadowingOuterLocalVariable:
2327
2445
  Description: >-
2328
2446
  Do not use the same name as outer local variable
2329
2447
  for block arguments or block local variables.
2330
- Enabled: true
2448
+ Enabled: false
2331
2449
  VersionAdded: '0.9'
2450
+ VersionChanged: '1.76'
2451
+
2452
+ Lint/SharedMutableDefault:
2453
+ Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
2454
+ StyleGuide: '#no-mutable-defaults'
2455
+ Enabled: pending
2456
+ VersionAdded: '1.70'
2332
2457
 
2333
2458
  Lint/StructNewOverride:
2334
2459
  Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
@@ -2344,6 +2469,12 @@ Lint/SuppressedException:
2344
2469
  VersionAdded: '0.9'
2345
2470
  VersionChanged: '1.12'
2346
2471
 
2472
+ Lint/SuppressedExceptionInNumberConversion:
2473
+ Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
2474
+ Enabled: pending
2475
+ SafeAutoCorrect: false
2476
+ VersionAdded: '1.72'
2477
+
2347
2478
  Lint/SymbolConversion:
2348
2479
  Description: 'Checks for unnecessary symbol conversions.'
2349
2480
  Enabled: pending
@@ -2380,7 +2511,9 @@ Lint/TopLevelReturnWithArgument:
2380
2511
  Lint/TrailingCommaInAttributeDeclaration:
2381
2512
  Description: 'Checks for trailing commas in attribute declarations.'
2382
2513
  Enabled: true
2514
+ AutoCorrect: contextual
2383
2515
  VersionAdded: '0.90'
2516
+ VersionChanged: '1.61'
2384
2517
 
2385
2518
  Lint/TripleQuotes:
2386
2519
  Description: 'Checks for useless triple quote constructs.'
@@ -2393,6 +2526,11 @@ Lint/UnderscorePrefixedVariableName:
2393
2526
  VersionAdded: '0.21'
2394
2527
  AllowKeywordBlockArguments: false
2395
2528
 
2529
+ Lint/UnescapedBracketInRegexp:
2530
+ Description: 'Checks for unescaped literal `]` in Regexp.'
2531
+ Enabled: pending
2532
+ VersionAdded: '1.68'
2533
+
2396
2534
  Lint/UnexpectedBlockArity:
2397
2535
  Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2398
2536
  Enabled: pending
@@ -2440,8 +2578,9 @@ Lint/UnusedBlockArgument:
2440
2578
  Description: 'Checks for unused block arguments.'
2441
2579
  StyleGuide: '#underscore-unused-vars'
2442
2580
  Enabled: true
2581
+ AutoCorrect: contextual
2443
2582
  VersionAdded: '0.21'
2444
- VersionChanged: '0.22'
2583
+ VersionChanged: '1.61'
2445
2584
  IgnoreEmptyBlocks: true
2446
2585
  AllowUnusedKeywordArguments: false
2447
2586
 
@@ -2449,11 +2588,14 @@ Lint/UnusedMethodArgument:
2449
2588
  Description: 'Checks for unused method arguments.'
2450
2589
  StyleGuide: '#underscore-unused-vars'
2451
2590
  Enabled: true
2591
+ AutoCorrect: contextual
2452
2592
  VersionAdded: '0.21'
2453
- VersionChanged: '0.81'
2593
+ VersionChanged: '1.69'
2454
2594
  AllowUnusedKeywordArguments: false
2455
2595
  IgnoreEmptyMethods: true
2456
2596
  IgnoreNotImplementedMethods: true
2597
+ NotImplementedExceptions:
2598
+ - NotImplementedError
2457
2599
 
2458
2600
  Lint/UriEscapeUnescape:
2459
2601
  Description: >-
@@ -2474,8 +2616,9 @@ Lint/UriRegexp:
2474
2616
  Lint/UselessAccessModifier:
2475
2617
  Description: 'Checks for useless access modifiers.'
2476
2618
  Enabled: true
2619
+ AutoCorrect: contextual
2477
2620
  VersionAdded: '0.20'
2478
- VersionChanged: '0.83'
2621
+ VersionChanged: '1.61'
2479
2622
  ContextCreatingMethods: []
2480
2623
  MethodCreatingMethods: []
2481
2624
 
@@ -2483,9 +2626,26 @@ Lint/UselessAssignment:
2483
2626
  Description: 'Checks for useless assignment to a local variable.'
2484
2627
  StyleGuide: '#underscore-unused-vars'
2485
2628
  Enabled: true
2629
+ AutoCorrect: contextual
2486
2630
  VersionAdded: '0.11'
2487
- VersionChanged: '1.51'
2488
- SafeAutoCorrect: false
2631
+ VersionChanged: '1.66'
2632
+
2633
+ Lint/UselessConstantScoping:
2634
+ Description: 'Checks for useless constant scoping.'
2635
+ Enabled: pending
2636
+ VersionAdded: '1.72'
2637
+
2638
+ Lint/UselessDefaultValueArgument:
2639
+ Description: 'Checks for usage of `fetch` or `Array.new` with default value argument and block.'
2640
+ Enabled: pending
2641
+ VersionAdded: '1.76'
2642
+ Safe: false
2643
+ AllowedReceivers: []
2644
+
2645
+ Lint/UselessDefined:
2646
+ Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
2647
+ Enabled: pending
2648
+ VersionAdded: '1.69'
2489
2649
 
2490
2650
  Lint/UselessElseWithoutRescue:
2491
2651
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
@@ -2496,10 +2656,21 @@ Lint/UselessElseWithoutRescue:
2496
2656
  Lint/UselessMethodDefinition:
2497
2657
  Description: 'Checks for useless method definitions.'
2498
2658
  Enabled: true
2659
+ AutoCorrect: contextual
2499
2660
  VersionAdded: '0.90'
2500
- VersionChanged: '0.91'
2661
+ VersionChanged: '1.61'
2501
2662
  Safe: false
2502
2663
 
2664
+ Lint/UselessNumericOperation:
2665
+ Description: 'Checks for useless numeric operations.'
2666
+ Enabled: pending
2667
+ VersionAdded: '1.66'
2668
+
2669
+ Lint/UselessOr:
2670
+ Description: 'Checks for useless OR expressions.'
2671
+ Enabled: pending
2672
+ VersionAdded: '1.76'
2673
+
2503
2674
  Lint/UselessRescue:
2504
2675
  Description: 'Checks for useless `rescue`s.'
2505
2676
  Enabled: pending
@@ -2520,13 +2691,17 @@ Lint/UselessSetterCall:
2520
2691
  Lint/UselessTimes:
2521
2692
  Description: 'Checks for useless `Integer#times` calls.'
2522
2693
  Enabled: true
2523
- VersionAdded: '0.91'
2524
2694
  Safe: false
2695
+ AutoCorrect: contextual
2696
+ VersionAdded: '0.91'
2697
+ VersionChanged: '1.61'
2525
2698
 
2526
2699
  Lint/Void:
2527
2700
  Description: 'Possible use of operator/literal/variable in void context.'
2528
2701
  Enabled: true
2702
+ AutoCorrect: contextual
2529
2703
  VersionAdded: '0.9'
2704
+ VersionChanged: '1.61'
2530
2705
  CheckForMethodsWithNoSideEffects: false
2531
2706
 
2532
2707
  #################### Metrics ###############################
@@ -2535,8 +2710,8 @@ Metrics/AbcSize:
2535
2710
  Description: >-
2536
2711
  A calculated magnitude based on number of assignments,
2537
2712
  branches, and conditions.
2538
- Reference:
2539
- - http://c2.com/cgi/wiki?AbcMetric
2713
+ References:
2714
+ - https://wiki.c2.com/?AbcMetric
2540
2715
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
2541
2716
  Enabled: true
2542
2717
  VersionAdded: '0.27'
@@ -2569,8 +2744,9 @@ Metrics/BlockNesting:
2569
2744
  StyleGuide: '#three-is-the-number-thou-shalt-count'
2570
2745
  Enabled: true
2571
2746
  VersionAdded: '0.25'
2572
- VersionChanged: '0.47'
2747
+ VersionChanged: '1.65'
2573
2748
  CountBlocks: false
2749
+ CountModifierForms: false
2574
2750
  Max: 3
2575
2751
 
2576
2752
  Metrics/ClassLength:
@@ -2654,7 +2830,7 @@ Migration/DepartmentName:
2654
2830
  #################### Naming ##############################
2655
2831
 
2656
2832
  Naming/AccessorMethodName:
2657
- Description: Check the naming of accessor methods for get_/set_.
2833
+ Description: Checks the naming of accessor methods for get_/set_.
2658
2834
  StyleGuide: '#accessor_mutator_method_names'
2659
2835
  Enabled: true
2660
2836
  VersionAdded: '0.50'
@@ -2725,7 +2901,8 @@ Naming/FileName:
2725
2901
  VersionChanged: '1.23'
2726
2902
  # Camel case file names listed in `AllCops:Include` and all file names listed
2727
2903
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2728
- Exclude: []
2904
+ Exclude:
2905
+ - Rakefile.rb
2729
2906
  # When `true`, requires that each source file should define a class or module
2730
2907
  # with a name which matches the file name (converted to ... case).
2731
2908
  # It further expects it to be nested inside modules which match the names
@@ -2857,6 +3034,7 @@ Naming/MethodName:
2857
3034
  StyleGuide: '#snake-case-symbols-methods-vars'
2858
3035
  Enabled: true
2859
3036
  VersionAdded: '0.50'
3037
+ VersionChanged: '1.75'
2860
3038
  EnforcedStyle: snake_case
2861
3039
  SupportedStyles:
2862
3040
  - snake_case
@@ -2868,6 +3046,10 @@ Naming/MethodName:
2868
3046
  # - '\A\s*onSelectionCleared\s*'
2869
3047
  #
2870
3048
  AllowedPatterns: []
3049
+ ForbiddenIdentifiers:
3050
+ - __id__
3051
+ - __send__
3052
+ ForbiddenPatterns: []
2871
3053
 
2872
3054
  Naming/MethodParameterName:
2873
3055
  Description: >-
@@ -2899,22 +3081,42 @@ Naming/MethodParameterName:
2899
3081
  # Forbidden names that will register an offense
2900
3082
  ForbiddenNames: []
2901
3083
 
2902
- Naming/PredicateName:
2903
- Description: 'Check the names of predicate methods.'
3084
+ Naming/PredicateMethod:
3085
+ Description: 'Checks that predicate methods end with `?` and non-predicate methods do not.'
3086
+ Enabled: pending
3087
+ VersionAdded: '1.76'
3088
+ VersionChanged: '1.78'
3089
+ # In `aggressive` mode, the cop will register an offense for predicate methods that
3090
+ # may return a non-boolean value.
3091
+ # In `conservative` mode, the cop will *not* register an offense for predicate methods
3092
+ # that may return a non-boolean value.
3093
+ Mode: conservative
3094
+ AllowedMethods:
3095
+ - call
3096
+ AllowedPatterns: []
3097
+ AllowBangMethods: false
3098
+ # Methods that are known to not return a boolean value, despite ending in `?`.
3099
+ WaywardPredicates:
3100
+ - nonzero?
3101
+
3102
+ Naming/PredicatePrefix:
3103
+ Description: 'Predicate method names should not be prefixed and end with a `?`.'
2904
3104
  StyleGuide: '#bool-methods-qmark'
2905
3105
  Enabled: true
2906
3106
  VersionAdded: '0.50'
2907
- VersionChanged: '0.77'
3107
+ VersionChanged: '1.75'
2908
3108
  # Predicate name prefixes.
2909
3109
  NamePrefix:
2910
3110
  - is_
2911
3111
  - has_
2912
3112
  - have_
3113
+ - does_
2913
3114
  # Predicate name prefixes that should be removed.
2914
3115
  ForbiddenPrefixes:
2915
3116
  - is_
2916
3117
  - has_
2917
3118
  - have_
3119
+ - does_
2918
3120
  # Predicate names which, despite having a forbidden prefix, or no `?`,
2919
3121
  # should still be accepted
2920
3122
  AllowedMethods:
@@ -2923,6 +3125,8 @@ Naming/PredicateName:
2923
3125
  MethodDefinitionMacros:
2924
3126
  - define_method
2925
3127
  - define_singleton_method
3128
+ # Use Sorbet's T::Boolean return type to detect predicate methods.
3129
+ UseSorbetSigs: false
2926
3130
  # Exclude Rspec specs because there is a strong convention to write spec
2927
3131
  # helpers in the form of `have_something` or `be_something`.
2928
3132
  Exclude:
@@ -2940,13 +3144,15 @@ Naming/VariableName:
2940
3144
  StyleGuide: '#snake-case-symbols-methods-vars'
2941
3145
  Enabled: true
2942
3146
  VersionAdded: '0.50'
2943
- VersionChanged: '1.8'
3147
+ VersionChanged: '1.73'
2944
3148
  EnforcedStyle: snake_case
2945
3149
  SupportedStyles:
2946
3150
  - snake_case
2947
3151
  - camelCase
2948
3152
  AllowedIdentifiers: []
2949
3153
  AllowedPatterns: []
3154
+ ForbiddenIdentifiers: []
3155
+ ForbiddenPatterns: []
2950
3156
 
2951
3157
  Naming/VariableNumber:
2952
3158
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2962,6 +3168,8 @@ Naming/VariableNumber:
2962
3168
  CheckMethodNames: true
2963
3169
  CheckSymbols: true
2964
3170
  AllowedIdentifiers:
3171
+ - TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
3172
+ - TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
2965
3173
  - capture3 # Open3.capture3
2966
3174
  - iso8601 # Time#iso8601
2967
3175
  - rfc1123_date # CGI.rfc1123_date
@@ -2997,7 +3205,9 @@ Security/JSONLoad:
2997
3205
  Description: >-
2998
3206
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
2999
3207
  security issues. See reference for more information.
3000
- Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3208
+ References:
3209
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
3210
+ - 'https://bugs.ruby-lang.org/issues/19528'
3001
3211
  Enabled: true
3002
3212
  VersionAdded: '0.43'
3003
3213
  VersionChanged: '1.22'
@@ -3009,7 +3219,8 @@ Security/MarshalLoad:
3009
3219
  Description: >-
3010
3220
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
3011
3221
  security issues. See reference for more information.
3012
- Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3222
+ References:
3223
+ - 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
3013
3224
  Enabled: true
3014
3225
  VersionAdded: '0.47'
3015
3226
 
@@ -3024,7 +3235,8 @@ Security/YAMLLoad:
3024
3235
  Description: >-
3025
3236
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
3026
3237
  security issues. See reference for more information.
3027
- Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3238
+ References:
3239
+ - 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
3028
3240
  Enabled: true
3029
3241
  VersionAdded: '0.47'
3030
3242
  SafeAutoCorrect: false
@@ -3035,12 +3247,14 @@ Style/AccessModifierDeclarations:
3035
3247
  Description: 'Checks style of how access modifiers are used.'
3036
3248
  Enabled: true
3037
3249
  VersionAdded: '0.57'
3038
- VersionChanged: '0.81'
3250
+ VersionChanged: '1.70'
3039
3251
  EnforcedStyle: group
3040
3252
  SupportedStyles:
3041
3253
  - inline
3042
3254
  - group
3043
3255
  AllowModifiersOnSymbols: true
3256
+ AllowModifiersOnAttrs: true
3257
+ AllowModifiersOnAliasMethod: true
3044
3258
  SafeAutoCorrect: false
3045
3259
 
3046
3260
  Style/AccessorGrouping:
@@ -3065,6 +3279,12 @@ Style/Alias:
3065
3279
  - prefer_alias
3066
3280
  - prefer_alias_method
3067
3281
 
3282
+ Style/AmbiguousEndlessMethodDefinition:
3283
+ Description: 'Checks for endless methods inside operators of lower precedence.'
3284
+ StyleGuide: '#ambiguous-endless-method-defintions'
3285
+ Enabled: pending
3286
+ VersionAdded: '1.68'
3287
+
3068
3288
  Style/AndOr:
3069
3289
  Description: 'Use &&/|| instead of and/or.'
3070
3290
  StyleGuide: '#no-and-or-or'
@@ -3085,7 +3305,19 @@ Style/ArgumentsForwarding:
3085
3305
  Enabled: pending
3086
3306
  AllowOnlyRestArgument: true
3087
3307
  UseAnonymousForwarding: true
3308
+ RedundantRestArgumentNames:
3309
+ - args
3310
+ - arguments
3311
+ RedundantKeywordRestArgumentNames:
3312
+ - kwargs
3313
+ - options
3314
+ - opts
3315
+ RedundantBlockArgumentNames:
3316
+ - blk
3317
+ - block
3318
+ - proc
3088
3319
  VersionAdded: '1.1'
3320
+ VersionChanged: '1.58'
3089
3321
 
3090
3322
  Style/ArrayCoercion:
3091
3323
  Description: >-
@@ -3096,12 +3328,26 @@ Style/ArrayCoercion:
3096
3328
  Enabled: false
3097
3329
  VersionAdded: '0.88'
3098
3330
 
3331
+ Style/ArrayFirstLast:
3332
+ Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3333
+ References:
3334
+ - '#first-and-last'
3335
+ Enabled: false
3336
+ VersionAdded: '1.58'
3337
+ Safe: false
3338
+
3099
3339
  Style/ArrayIntersect:
3100
3340
  Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
3101
3341
  Enabled: 'pending'
3102
3342
  Safe: false
3103
3343
  VersionAdded: '1.40'
3104
3344
 
3345
+ Style/ArrayIntersectWithSingleElement:
3346
+ Description: 'Use `include?(element)` instead of `intersect?([element])`.'
3347
+ Enabled: 'pending'
3348
+ Safe: false
3349
+ VersionAdded: '1.81'
3350
+
3105
3351
  Style/ArrayJoin:
3106
3352
  Description: 'Use Array#join instead of Array#*.'
3107
3353
  StyleGuide: '#array-join'
@@ -3153,6 +3399,13 @@ Style/BisectedAttrAccessor:
3153
3399
  Enabled: true
3154
3400
  VersionAdded: '0.87'
3155
3401
 
3402
+ Style/BitwisePredicate:
3403
+ Description: 'Prefer bitwise predicate methods over direct comparison operations.'
3404
+ StyleGuide: '#bitwise-predicate-methods'
3405
+ Enabled: pending
3406
+ Safe: false
3407
+ VersionAdded: '1.68'
3408
+
3156
3409
  Style/BlockComments:
3157
3410
  Description: 'Do not use block comments.'
3158
3411
  StyleGuide: '#no-block-comments'
@@ -3323,6 +3576,7 @@ Style/ClassAndModuleChildren:
3323
3576
  SafeAutoCorrect: false
3324
3577
  Enabled: true
3325
3578
  VersionAdded: '0.19'
3579
+ VersionChanged: '1.74'
3326
3580
  #
3327
3581
  # Basically there are two different styles:
3328
3582
  #
@@ -3338,7 +3592,21 @@ Style/ClassAndModuleChildren:
3338
3592
  #
3339
3593
  # The compact style is only forced, for classes or modules with one child.
3340
3594
  EnforcedStyle: nested
3341
- SupportedStyles:
3595
+ SupportedStyles: &supported_styles
3596
+ - nested
3597
+ - compact
3598
+ # Configure classes separately, if desired. If not set, or set to `nil`,
3599
+ # the `EnforcedStyle` value will be used.
3600
+ EnforcedStyleForClasses: ~
3601
+ SupportedStylesForClasses:
3602
+ - ~
3603
+ - nested
3604
+ - compact
3605
+ # Configure modules separately, if desired. If not set, or set to `nil`,
3606
+ # the `EnforcedStyle` value will be used.
3607
+ EnforcedStyleForModules: ~
3608
+ SupportedStylesForModules:
3609
+ - ~
3342
3610
  - nested
3343
3611
  - compact
3344
3612
 
@@ -3424,6 +3692,13 @@ Style/CollectionMethods:
3424
3692
  - inject
3425
3693
  - reduce
3426
3694
 
3695
+ Style/CollectionQuerying:
3696
+ Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
3697
+ StyleGuide: '#collection-querying'
3698
+ Enabled: pending
3699
+ VersionAdded: '1.77'
3700
+ Safe: false
3701
+
3427
3702
  Style/ColonMethodCall:
3428
3703
  Description: 'Do not use :: for method call.'
3429
3704
  StyleGuide: '#double-colons'
@@ -3436,6 +3711,11 @@ Style/ColonMethodDefinition:
3436
3711
  Enabled: true
3437
3712
  VersionAdded: '0.52'
3438
3713
 
3714
+ Style/CombinableDefined:
3715
+ Description: 'Checks successive `defined?` calls that can be combined into a single call.'
3716
+ Enabled: pending
3717
+ VersionAdded: '1.68'
3718
+
3439
3719
  Style/CombinableLoops:
3440
3720
  Description: >-
3441
3721
  Checks for places where multiple consecutive loops over the same data
@@ -3486,6 +3766,14 @@ Style/CommentedKeyword:
3486
3766
  VersionAdded: '0.51'
3487
3767
  VersionChanged: '1.19'
3488
3768
 
3769
+ Style/ComparableBetween:
3770
+ Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
3771
+ Enabled: pending
3772
+ Safe: false
3773
+ VersionAdded: '1.74'
3774
+ VersionChanged: '1.75'
3775
+ StyleGuide: '#ranges-or-between'
3776
+
3489
3777
  Style/ComparableClamp:
3490
3778
  Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3491
3779
  Enabled: pending
@@ -3576,6 +3864,12 @@ Style/DefWithParentheses:
3576
3864
  VersionAdded: '0.9'
3577
3865
  VersionChanged: '0.12'
3578
3866
 
3867
+ Style/DigChain:
3868
+ Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
3869
+ Enabled: pending
3870
+ Safe: false
3871
+ VersionAdded: '1.69'
3872
+
3579
3873
  Style/Dir:
3580
3874
  Description: >-
3581
3875
  Use the `__dir__` method to retrieve the canonicalized
@@ -3619,6 +3913,7 @@ Style/DocumentationMethod:
3619
3913
  Description: 'Checks for missing documentation comment for public methods.'
3620
3914
  Enabled: false
3621
3915
  VersionAdded: '0.43'
3916
+ AllowedMethods: []
3622
3917
  Exclude:
3623
3918
  - 'spec/**/*'
3624
3919
  - 'test/**/*'
@@ -3667,8 +3962,9 @@ Style/EmptyCaseCondition:
3667
3962
  Style/EmptyElse:
3668
3963
  Description: 'Avoid empty else-clauses.'
3669
3964
  Enabled: true
3965
+ AutoCorrect: contextual
3670
3966
  VersionAdded: '0.28'
3671
- VersionChanged: '0.32'
3967
+ VersionChanged: '1.61'
3672
3968
  EnforcedStyle: both
3673
3969
  # empty - warn only on empty `else`
3674
3970
  # nil - warn on `else` with nil in it
@@ -3682,7 +3978,9 @@ Style/EmptyElse:
3682
3978
  Style/EmptyHeredoc:
3683
3979
  Description: 'Checks for using empty heredoc to reduce redundancy.'
3684
3980
  Enabled: pending
3981
+ AutoCorrect: contextual
3685
3982
  VersionAdded: '1.32'
3983
+ VersionChanged: '1.61'
3686
3984
 
3687
3985
  Style/EmptyLambdaParameter:
3688
3986
  Description: 'Omit parens for empty lambda parameters.'
@@ -3700,12 +3998,24 @@ Style/EmptyMethod:
3700
3998
  Description: 'Checks the formatting of empty method definitions.'
3701
3999
  StyleGuide: '#no-single-line-methods'
3702
4000
  Enabled: true
4001
+ AutoCorrect: contextual
3703
4002
  VersionAdded: '0.46'
4003
+ VersionChanged: '1.61'
3704
4004
  EnforcedStyle: compact
3705
4005
  SupportedStyles:
3706
4006
  - compact
3707
4007
  - expanded
3708
4008
 
4009
+ Style/EmptyStringInsideInterpolation:
4010
+ Description: 'Checks for empty strings being assigned inside string interpolation.'
4011
+ StyleGuide: '#empty-strings-in-interpolation'
4012
+ Enabled: pending
4013
+ EnforcedStyle: trailing_conditional
4014
+ SupportedStyles:
4015
+ - trailing_conditional
4016
+ - ternary
4017
+ VersionAdded: '1.76'
4018
+
3709
4019
  Style/Encoding:
3710
4020
  Description: 'Use UTF-8 as the source file encoding.'
3711
4021
  StyleGuide: '#utf-8'
@@ -3730,6 +4040,8 @@ Style/EndlessMethod:
3730
4040
  - allow_single_line
3731
4041
  - allow_always
3732
4042
  - disallow
4043
+ - require_single_line
4044
+ - require_always
3733
4045
 
3734
4046
  Style/EnvHome:
3735
4047
  Description: "Checks for consistent usage of `ENV['HOME']`."
@@ -3782,12 +4094,15 @@ Style/ExponentialNotation:
3782
4094
  Style/FetchEnvVar:
3783
4095
  Description: >-
3784
4096
  Suggests `ENV.fetch` for the replacement of `ENV[]`.
3785
- Reference:
4097
+ References:
3786
4098
  - https://rubystyle.guide/#hash-fetch-defaults
3787
4099
  Enabled: pending
3788
4100
  VersionAdded: '1.28'
3789
4101
  # Environment variables to be excluded from the inspection.
3790
4102
  AllowedVars: []
4103
+ # When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
4104
+ # When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
4105
+ DefaultToNil: true
3791
4106
 
3792
4107
  Style/FileEmpty:
3793
4108
  Description: >-
@@ -3796,12 +4111,24 @@ Style/FileEmpty:
3796
4111
  Safe: false
3797
4112
  VersionAdded: '1.48'
3798
4113
 
4114
+ Style/FileNull:
4115
+ Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
4116
+ Enabled: pending
4117
+ SafeAutoCorrect: false
4118
+ VersionAdded: '1.69'
4119
+
3799
4120
  Style/FileRead:
3800
4121
  Description: 'Favor `File.(bin)read` convenience methods.'
3801
4122
  StyleGuide: '#file-read'
3802
4123
  Enabled: pending
3803
4124
  VersionAdded: '1.24'
3804
4125
 
4126
+ Style/FileTouch:
4127
+ Description: 'Favor `FileUtils.touch` for touching files.'
4128
+ Enabled: pending
4129
+ VersionAdded: '1.69'
4130
+ SafeAutoCorrect: false
4131
+
3805
4132
  Style/FileWrite:
3806
4133
  Description: 'Favor `File.(bin)write` convenience methods.'
3807
4134
  StyleGuide: '#file-write'
@@ -3811,7 +4138,8 @@ Style/FileWrite:
3811
4138
  Style/FloatDivision:
3812
4139
  Description: 'For performing float division, coerce one side only.'
3813
4140
  StyleGuide: '#float-division'
3814
- Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
4141
+ References:
4142
+ - 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3815
4143
  Enabled: true
3816
4144
  VersionAdded: '0.72'
3817
4145
  VersionChanged: '1.9'
@@ -3862,8 +4190,14 @@ Style/FormatStringToken:
3862
4190
  # style token in a format string to be allowed when enforced style is not
3863
4191
  # `unannotated`.
3864
4192
  MaxUnannotatedPlaceholdersAllowed: 1
4193
+ # The mode the cop operates in. Two values are allowed:
4194
+ # * aggressive (default): all strings are considered
4195
+ # * conservative:
4196
+ # only register offenses for strings given to `printf`, `sprintf`,
4197
+ # format` and `%` methods. Other strings are not considered.
4198
+ Mode: aggressive
3865
4199
  VersionAdded: '0.49'
3866
- VersionChanged: '1.0'
4200
+ VersionChanged: '1.74'
3867
4201
  AllowedMethods: []
3868
4202
  AllowedPatterns: []
3869
4203
 
@@ -3888,6 +4222,9 @@ Style/FrozenStringLiteralComment:
3888
4222
  # exist in a file.
3889
4223
  - never
3890
4224
  SafeAutoCorrect: false
4225
+ Exclude:
4226
+ # Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
4227
+ - '**/*.arb'
3891
4228
 
3892
4229
  Style/GlobalStdStream:
3893
4230
  Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
@@ -3899,14 +4236,15 @@ Style/GlobalStdStream:
3899
4236
  Style/GlobalVars:
3900
4237
  Description: 'Do not introduce global variables.'
3901
4238
  StyleGuide: '#instance-vars'
3902
- Reference: 'https://www.zenspider.com/ruby/quickref.html'
4239
+ References:
4240
+ - 'https://www.zenspider.com/ruby/quickref.html'
3903
4241
  Enabled: true
3904
4242
  VersionAdded: '0.13'
3905
4243
  # Built-in global variables are allowed by default.
3906
4244
  AllowedVariables: []
3907
4245
 
3908
4246
  Style/GuardClause:
3909
- Description: 'Check for conditionals that can be replaced with guard clauses.'
4247
+ Description: 'Checks for conditionals that can be replaced with guard clauses.'
3910
4248
  StyleGuide: '#no-nested-conditionals'
3911
4249
  Enabled: true
3912
4250
  VersionAdded: '0.20'
@@ -3956,6 +4294,12 @@ Style/HashExcept:
3956
4294
  VersionAdded: '1.7'
3957
4295
  VersionChanged: '1.39'
3958
4296
 
4297
+ Style/HashFetchChain:
4298
+ Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
4299
+ Enabled: pending
4300
+ Safe: false
4301
+ VersionAdded: '1.75'
4302
+
3959
4303
  Style/HashLikeCase:
3960
4304
  Description: >-
3961
4305
  Checks for places where `case-when` represents a simple 1:1
@@ -3966,6 +4310,14 @@ Style/HashLikeCase:
3966
4310
  # to trigger this cop
3967
4311
  MinBranchesCount: 3
3968
4312
 
4313
+ Style/HashSlice:
4314
+ Description: >-
4315
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
4316
+ that can be replaced with `Hash#slice` method.
4317
+ Enabled: pending
4318
+ Safe: false
4319
+ VersionAdded: '1.71'
4320
+
3969
4321
  Style/HashSyntax:
3970
4322
  Description: >-
3971
4323
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -3973,7 +4325,7 @@ Style/HashSyntax:
3973
4325
  StyleGuide: '#hash-literals'
3974
4326
  Enabled: true
3975
4327
  VersionAdded: '0.9'
3976
- VersionChanged: '1.24'
4328
+ VersionChanged: '1.67'
3977
4329
  EnforcedStyle: ruby19
3978
4330
  SupportedStyles:
3979
4331
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -3985,7 +4337,7 @@ Style/HashSyntax:
3985
4337
  # enforces both ruby19 and no_mixed_keys styles
3986
4338
  - ruby19_no_mixed_keys
3987
4339
  # Force hashes that have a hash value omission
3988
- EnforcedShorthandSyntax: always
4340
+ EnforcedShorthandSyntax: either
3989
4341
  SupportedShorthandSyntax:
3990
4342
  # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3991
4343
  - always
@@ -3995,6 +4347,8 @@ Style/HashSyntax:
3995
4347
  - either
3996
4348
  # forces use of the 3.1 syntax only if all values can be omitted in the hash.
3997
4349
  - consistent
4350
+ # allow either (implicit or explicit) syntax but enforce consistency within a single hash
4351
+ - either_consistent
3998
4352
  # Force hashes that have a symbol value to use hash rockets
3999
4353
  UseHashRocketsWithSymbolValues: false
4000
4354
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -4151,6 +4505,31 @@ Style/IpAddresses:
4151
4505
  - '**/gems.rb'
4152
4506
  - '**/*.gemspec'
4153
4507
 
4508
+ Style/ItAssignment:
4509
+ Description: 'Checks for local variables and method parameters named `it`.'
4510
+ Enabled: pending
4511
+ VersionAdded: '1.70'
4512
+
4513
+ Style/ItBlockParameter:
4514
+ Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
4515
+ Enabled: pending
4516
+ EnforcedStyle: allow_single_line
4517
+ SupportedStyles:
4518
+ - allow_single_line
4519
+ - only_numbered_parameters
4520
+ - always
4521
+ - disallow
4522
+ VersionAdded: '1.75'
4523
+ VersionChanged: '1.76'
4524
+
4525
+ Style/KeywordArgumentsMerging:
4526
+ Description: >-
4527
+ When passing an existing hash as keyword arguments, provide additional arguments
4528
+ directly rather than using `merge`.
4529
+ StyleGuide: '#merging-keyword-arguments'
4530
+ Enabled: pending
4531
+ VersionAdded: '1.68'
4532
+
4154
4533
  Style/KeywordParametersOrder:
4155
4534
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
4156
4535
  StyleGuide: '#keyword-parameters-order'
@@ -4174,8 +4553,9 @@ Style/LambdaCall:
4174
4553
  Description: 'Use lambda.call(...) instead of lambda.(...).'
4175
4554
  StyleGuide: '#proc-call'
4176
4555
  Enabled: true
4556
+ AutoCorrect: contextual
4177
4557
  VersionAdded: '0.13'
4178
- VersionChanged: '0.14'
4558
+ VersionChanged: '<<next>>'
4179
4559
  EnforcedStyle: call
4180
4560
  SupportedStyles:
4181
4561
  - call
@@ -4215,6 +4595,14 @@ Style/MapCompactWithConditionalBlock:
4215
4595
  Enabled: pending
4216
4596
  VersionAdded: '1.30'
4217
4597
 
4598
+ Style/MapIntoArray:
4599
+ Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
4600
+ StyleGuide: '#functional-code'
4601
+ Enabled: pending
4602
+ VersionAdded: '1.63'
4603
+ VersionChanged: '1.67'
4604
+ Safe: false
4605
+
4218
4606
  Style/MapToHash:
4219
4607
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
4220
4608
  Enabled: pending
@@ -4523,7 +4911,7 @@ Style/Next:
4523
4911
  StyleGuide: '#no-nested-conditionals'
4524
4912
  Enabled: true
4525
4913
  VersionAdded: '0.22'
4526
- VersionChanged: '0.35'
4914
+ VersionChanged: '1.75'
4527
4915
  # With `always` all conditions at the end of an iteration needs to be
4528
4916
  # replaced by next - with `skip_modifier_ifs` the modifier if like this one
4529
4917
  # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
@@ -4531,6 +4919,7 @@ Style/Next:
4531
4919
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
4532
4920
  # needs to have to trigger this cop
4533
4921
  MinBodyLength: 3
4922
+ AllowConsecutiveConditionals: false
4534
4923
  SupportedStyles:
4535
4924
  - skip_modifier_ifs
4536
4925
  - always
@@ -4662,8 +5051,8 @@ Style/OpenStructUse:
4662
5051
  Description: >-
4663
5052
  Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4664
5053
  version compatibility, and potential security issues.
4665
- Reference:
4666
- - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
5054
+ References:
5055
+ - https://docs.ruby-lang.org/en/3.0/OpenStruct.html#class-OpenStruct-label-Caveats
4667
5056
 
4668
5057
  Enabled: pending
4669
5058
  Safe: false
@@ -4678,6 +5067,7 @@ Style/OperatorMethodCall:
4678
5067
 
4679
5068
  Style/OptionHash:
4680
5069
  Description: "Don't use option hashes when you can use keyword arguments."
5070
+ StyleGuide: '#keyword-arguments-vs-option-hashes'
4681
5071
  Enabled: false
4682
5072
  VersionAdded: '0.33'
4683
5073
  VersionChanged: '0.34'
@@ -4800,8 +5190,9 @@ Style/RaiseArgs:
4800
5190
  Description: 'Checks the arguments passed to raise/fail.'
4801
5191
  StyleGuide: '#exception-class-messages'
4802
5192
  Enabled: true
5193
+ Safe: false
4803
5194
  VersionAdded: '0.14'
4804
- VersionChanged: '1.2'
5195
+ VersionChanged: '1.61'
4805
5196
  EnforcedStyle: exploded
4806
5197
  SupportedStyles:
4807
5198
  - compact # raise Exception.new(msg)
@@ -4817,7 +5208,7 @@ Style/RandomWithOffset:
4817
5208
  VersionAdded: '0.52'
4818
5209
 
4819
5210
  Style/RedundantArgument:
4820
- Description: 'Check for a redundant argument passed to certain methods.'
5211
+ Description: 'Checks for a redundant argument passed to certain methods.'
4821
5212
  Enabled: pending
4822
5213
  Safe: false
4823
5214
  VersionAdded: '1.4'
@@ -4843,6 +5234,12 @@ Style/RedundantArrayConstructor:
4843
5234
  Enabled: pending
4844
5235
  VersionAdded: '1.52'
4845
5236
 
5237
+ Style/RedundantArrayFlatten:
5238
+ Description: 'Checks for redundant calls of `Array#flatten`.'
5239
+ Enabled: pending
5240
+ Safe: false
5241
+ VersionAdded: '1.76'
5242
+
4846
5243
  Style/RedundantAssignment:
4847
5244
  Description: 'Checks for redundant assignment before returning.'
4848
5245
  Enabled: true
@@ -4864,6 +5261,9 @@ Style/RedundantCondition:
4864
5261
  Description: 'Checks for unnecessary conditional expressions.'
4865
5262
  Enabled: true
4866
5263
  VersionAdded: '0.76'
5264
+ VersionChanged: '1.73'
5265
+ AllowedMethods:
5266
+ - nonzero?
4867
5267
 
4868
5268
  Style/RedundantConditional:
4869
5269
  Description: "Don't return true/false from a conditional."
@@ -4876,7 +5276,7 @@ Style/RedundantConstantBase:
4876
5276
  VersionAdded: '1.40'
4877
5277
 
4878
5278
  Style/RedundantCurrentDirectoryInPath:
4879
- Description: 'Checks for uses a redundant current directory in path.'
5279
+ Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
4880
5280
  Enabled: pending
4881
5281
  VersionAdded: '1.53'
4882
5282
 
@@ -4902,7 +5302,8 @@ Style/RedundantFetchBlock:
4902
5302
  Description: >-
4903
5303
  Use `fetch(key, value)` instead of `fetch(key) { value }`
4904
5304
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4905
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
5305
+ References:
5306
+ - 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4906
5307
  Enabled: true
4907
5308
  Safe: false
4908
5309
  # If enabled, this cop will autocorrect usages of
@@ -4928,6 +5329,13 @@ Style/RedundantFilterChain:
4928
5329
  VersionAdded: '1.52'
4929
5330
  VersionChanged: '1.57'
4930
5331
 
5332
+ Style/RedundantFormat:
5333
+ Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
5334
+ Enabled: pending
5335
+ SafeAutoCorrect: false
5336
+ VersionAdded: '1.72'
5337
+ VersionChanged: '1.72'
5338
+
4931
5339
  Style/RedundantFreeze:
4932
5340
  Description: "Checks usages of Object#freeze on immutable objects."
4933
5341
  Enabled: true
@@ -4942,10 +5350,11 @@ Style/RedundantHeredocDelimiterQuotes:
4942
5350
  Style/RedundantInitialize:
4943
5351
  Description: 'Checks for redundant `initialize` methods.'
4944
5352
  Enabled: pending
5353
+ AutoCorrect: contextual
4945
5354
  Safe: false
4946
5355
  AllowComments: true
4947
5356
  VersionAdded: '1.27'
4948
- VersionChanged: '1.28'
5357
+ VersionChanged: '1.61'
4949
5358
 
4950
5359
  Style/RedundantInterpolation:
4951
5360
  Description: 'Checks for strings that are just an interpolated expression.'
@@ -4954,8 +5363,13 @@ Style/RedundantInterpolation:
4954
5363
  VersionAdded: '0.76'
4955
5364
  VersionChanged: '1.30'
4956
5365
 
5366
+ Style/RedundantInterpolationUnfreeze:
5367
+ Description: 'Checks for redundant unfreezing of interpolated strings.'
5368
+ Enabled: pending
5369
+ VersionAdded: '1.66'
5370
+
4957
5371
  Style/RedundantLineContinuation:
4958
- Description: 'Check for redundant line continuation.'
5372
+ Description: 'Checks for redundant line continuation.'
4959
5373
  Enabled: pending
4960
5374
  VersionAdded: '1.49'
4961
5375
 
@@ -5095,6 +5509,7 @@ Style/ReturnNilInPredicateMethodDefinition:
5095
5509
  AllowedMethods: []
5096
5510
  AllowedPatterns: []
5097
5511
  VersionAdded: '1.53'
5512
+ VersionChanged: '1.67'
5098
5513
 
5099
5514
  Style/SafeNavigation:
5100
5515
  Description: >-
@@ -5105,7 +5520,7 @@ Style/SafeNavigation:
5105
5520
  be `nil` or truthy, but never `false`.
5106
5521
  Enabled: true
5107
5522
  VersionAdded: '0.43'
5108
- VersionChanged: '1.27'
5523
+ VersionChanged: '1.67'
5109
5524
  # Safe navigation may cause a statement to start returning `nil` in addition
5110
5525
  # to whatever it used to return.
5111
5526
  ConvertCodeThatCanStartToReturnNil: false
@@ -5119,11 +5534,19 @@ Style/SafeNavigation:
5119
5534
  # Maximum length of method chains for register an offense.
5120
5535
  MaxChainLength: 2
5121
5536
 
5537
+ Style/SafeNavigationChainLength:
5538
+ Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
5539
+ StyleGuide: '#safe-navigation'
5540
+ Enabled: pending
5541
+ VersionAdded: '1.68'
5542
+ Max: 2
5543
+
5122
5544
  Style/Sample:
5123
5545
  Description: >-
5124
5546
  Use `sample` instead of `shuffle.first`,
5125
5547
  `shuffle.last`, and `shuffle[Integer]`.
5126
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5548
+ References:
5549
+ - 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5127
5550
  Enabled: true
5128
5551
  VersionAdded: '0.30'
5129
5552
 
@@ -5157,6 +5580,13 @@ Style/Send:
5157
5580
  Enabled: false
5158
5581
  VersionAdded: '0.33'
5159
5582
 
5583
+ Style/SendWithLiteralMethodName:
5584
+ Description: 'Detects the use of the `public_send` method with a static method name argument.'
5585
+ Enabled: pending
5586
+ Safe: false
5587
+ AllowSend: true
5588
+ VersionAdded: '1.64'
5589
+
5160
5590
  Style/SignalException:
5161
5591
  Description: 'Checks for proper usage of fail and raise.'
5162
5592
  StyleGuide: '#prefer-raise-over-fail'
@@ -5190,6 +5620,7 @@ Style/SingleLineBlockParams:
5190
5620
 
5191
5621
  Style/SingleLineDoEndBlock:
5192
5622
  Description: 'Checks for single-line `do`...`end` blocks.'
5623
+ StyleGuide: '#single-line-do-end-block'
5193
5624
  Enabled: pending
5194
5625
  VersionAdded: '1.57'
5195
5626
 
@@ -5202,7 +5633,8 @@ Style/SingleLineMethods:
5202
5633
  AllowIfMethodIsEmpty: true
5203
5634
 
5204
5635
  Style/SlicingWithRange:
5205
- Description: 'Checks array slicing is done with endless ranges when suitable.'
5636
+ Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
5637
+ StyleGuide: '#slicing-with-ranges'
5206
5638
  Enabled: true
5207
5639
  VersionAdded: '0.83'
5208
5640
  Safe: false
@@ -5231,7 +5663,7 @@ Style/SpecialGlobalVars:
5231
5663
  - use_builtin_english_names
5232
5664
 
5233
5665
  Style/StabbyLambdaParentheses:
5234
- Description: 'Check for the usage of parentheses around stabby lambda arguments.'
5666
+ Description: 'Checks for the usage of parentheses around stabby lambda arguments.'
5235
5667
  StyleGuide: '#stabby-lambda-with-args'
5236
5668
  Enabled: true
5237
5669
  VersionAdded: '0.35'
@@ -5329,6 +5761,17 @@ Style/StructInheritance:
5329
5761
  VersionAdded: '0.29'
5330
5762
  VersionChanged: '1.20'
5331
5763
 
5764
+ Style/SuperArguments:
5765
+ Description: 'Call `super` without arguments and parentheses when the signature is identical.'
5766
+ Enabled: pending
5767
+ VersionAdded: '1.64'
5768
+
5769
+ Style/SuperWithArgsParentheses:
5770
+ Description: 'Use parentheses for `super` with arguments.'
5771
+ StyleGuide: '#super-with-args'
5772
+ Enabled: pending
5773
+ VersionAdded: '1.58'
5774
+
5332
5775
  Style/SwapValues:
5333
5776
  Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
5334
5777
  StyleGuide: '#values-swapping'
@@ -5358,7 +5801,7 @@ Style/SymbolProc:
5358
5801
  Enabled: true
5359
5802
  Safe: false
5360
5803
  VersionAdded: '0.26'
5361
- VersionChanged: '1.40'
5804
+ VersionChanged: '1.64'
5362
5805
  AllowMethodsWithArguments: false
5363
5806
  # A list of method names to be always allowed by the check.
5364
5807
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
@@ -5409,10 +5852,14 @@ Style/TrailingCommaInArguments:
5409
5852
  # parenthesized method calls where each argument is on its own line.
5410
5853
  # If `consistent_comma`, the cop requires a comma after the last argument,
5411
5854
  # for all parenthesized method calls with arguments.
5855
+ # If `diff_comma`, the cop requires a comma after the last argument, but only
5856
+ # when that argument is followed by an immediate newline, even if
5857
+ # there is an inline comment.
5412
5858
  EnforcedStyleForMultiline: no_comma
5413
5859
  SupportedStylesForMultiline:
5414
5860
  - comma
5415
5861
  - consistent_comma
5862
+ - diff_comma
5416
5863
  - no_comma
5417
5864
 
5418
5865
  Style/TrailingCommaInArrayLiteral:
@@ -5420,14 +5867,17 @@ Style/TrailingCommaInArrayLiteral:
5420
5867
  StyleGuide: '#no-trailing-array-commas'
5421
5868
  Enabled: true
5422
5869
  VersionAdded: '0.53'
5423
- # If `comma`, the cop requires a comma after the last item in an array,
5424
- # but only when each item is on its own line.
5425
- # If `consistent_comma`, the cop requires a comma after the last item of all
5426
- # non-empty, multiline array literals.
5870
+ # If `comma`, the cop requires a comma after the last item in an array, but only when each item is
5871
+ # on its own line.
5872
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
5873
+ # array literals.
5874
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
5875
+ # literals, but only when that last item immediately precedes a newline.
5427
5876
  EnforcedStyleForMultiline: no_comma
5428
5877
  SupportedStylesForMultiline:
5429
5878
  - comma
5430
5879
  - consistent_comma
5880
+ - diff_comma
5431
5881
  - no_comma
5432
5882
 
5433
5883
  Style/TrailingCommaInBlockArgs:
@@ -5439,14 +5889,17 @@ Style/TrailingCommaInBlockArgs:
5439
5889
  Style/TrailingCommaInHashLiteral:
5440
5890
  Description: 'Checks for trailing comma in hash literals.'
5441
5891
  Enabled: true
5442
- # If `comma`, the cop requires a comma after the last item in a hash,
5443
- # but only when each item is on its own line.
5444
- # If `consistent_comma`, the cop requires a comma after the last item of all
5445
- # non-empty, multiline hash literals.
5892
+ # If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
5893
+ # on its own line.
5894
+ # If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
5895
+ # hash literals.
5896
+ # If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
5897
+ # literals, but only when that last item immediately precedes a newline.
5446
5898
  EnforcedStyleForMultiline: no_comma
5447
5899
  SupportedStylesForMultiline:
5448
5900
  - comma
5449
5901
  - consistent_comma
5902
+ - diff_comma
5450
5903
  - no_comma
5451
5904
  VersionAdded: '0.53'
5452
5905
 
@@ -5592,7 +6045,8 @@ Style/YAMLFileRead:
5592
6045
 
5593
6046
  Style/YodaCondition:
5594
6047
  Description: 'Forbid or enforce yoda conditions.'
5595
- Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
6048
+ References:
6049
+ - 'https://en.wikipedia.org/wiki/Yoda_conditions'
5596
6050
  Enabled: true
5597
6051
  EnforcedStyle: forbid_for_all_comparison_operators
5598
6052
  SupportedStyles: