rubocop 1.30.1 → 1.64.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (613) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +8 -6
  4. data/assets/output.css.erb +159 -0
  5. data/assets/output.html.erb +1 -160
  6. data/config/default.yml +584 -73
  7. data/config/obsoletion.yml +30 -1
  8. data/exe/rubocop +15 -7
  9. data/lib/rubocop/arguments_env.rb +17 -0
  10. data/lib/rubocop/arguments_file.rb +17 -0
  11. data/lib/rubocop/cache_config.rb +29 -0
  12. data/lib/rubocop/cached_data.rb +11 -3
  13. data/lib/rubocop/cli/command/{auto_genenerate_config.rb → auto_generate_config.rb} +30 -9
  14. data/lib/rubocop/cli/command/execute_runner.rb +14 -9
  15. data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
  16. data/lib/rubocop/cli/command/lsp.rb +19 -0
  17. data/lib/rubocop/cli/command/show_docs_url.rb +2 -2
  18. data/lib/rubocop/cli/command/suggest_extensions.rb +61 -16
  19. data/lib/rubocop/cli.rb +70 -11
  20. data/lib/rubocop/comment_config.rb +60 -1
  21. data/lib/rubocop/config.rb +84 -28
  22. data/lib/rubocop/config_finder.rb +78 -0
  23. data/lib/rubocop/config_loader.rb +46 -68
  24. data/lib/rubocop/config_loader_resolver.rb +8 -8
  25. data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
  26. data/lib/rubocop/config_obsoletion/parameter_rule.rb +13 -1
  27. data/lib/rubocop/config_obsoletion.rb +15 -7
  28. data/lib/rubocop/config_validator.rb +16 -9
  29. data/lib/rubocop/cop/autocorrect_logic.rb +37 -14
  30. data/lib/rubocop/cop/badge.rb +9 -4
  31. data/lib/rubocop/cop/base.rb +181 -98
  32. data/lib/rubocop/cop/bundler/duplicated_gem.rb +2 -1
  33. data/lib/rubocop/cop/bundler/duplicated_group.rb +127 -0
  34. data/lib/rubocop/cop/bundler/gem_comment.rb +4 -4
  35. data/lib/rubocop/cop/bundler/gem_filename.rb +4 -4
  36. data/lib/rubocop/cop/bundler/gem_version.rb +5 -7
  37. data/lib/rubocop/cop/bundler/ordered_gems.rb +11 -3
  38. data/lib/rubocop/cop/commissioner.rb +19 -6
  39. data/lib/rubocop/cop/cop.rb +54 -34
  40. data/lib/rubocop/cop/corrector.rb +33 -13
  41. data/lib/rubocop/cop/correctors/alignment_corrector.rb +3 -3
  42. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +4 -8
  43. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +6 -14
  44. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +7 -4
  45. data/lib/rubocop/cop/correctors/line_break_corrector.rb +1 -1
  46. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +26 -10
  47. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +2 -7
  48. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +58 -0
  49. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -2
  50. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +1 -1
  51. data/lib/rubocop/cop/documentation.rb +16 -6
  52. data/lib/rubocop/cop/exclude_limit.rb +1 -1
  53. data/lib/rubocop/cop/gemspec/dependency_version.rb +22 -26
  54. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +33 -18
  55. data/lib/rubocop/cop/gemspec/development_dependencies.rb +107 -0
  56. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -1
  57. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +10 -2
  58. data/lib/rubocop/cop/gemspec/require_mfa.rb +21 -21
  59. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -1
  60. data/lib/rubocop/cop/generator/require_file_injector.rb +3 -3
  61. data/lib/rubocop/cop/generator.rb +6 -3
  62. data/lib/rubocop/cop/internal_affairs/cop_description.rb +38 -12
  63. data/lib/rubocop/cop/internal_affairs/create_empty_file.rb +37 -0
  64. data/lib/rubocop/cop/internal_affairs/example_description.rb +46 -24
  65. data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +111 -0
  66. data/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb +1 -1
  67. data/lib/rubocop/cop/internal_affairs/lambda_or_proc.rb +46 -0
  68. data/lib/rubocop/cop/internal_affairs/location_expression.rb +37 -0
  69. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -1
  70. data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +8 -6
  71. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
  72. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +53 -0
  73. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +128 -38
  74. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
  75. data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
  76. data/lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb +42 -0
  77. data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
  78. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +11 -3
  79. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
  80. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
  81. data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +11 -2
  82. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +66 -0
  83. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +62 -0
  84. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -0
  85. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +60 -0
  86. data/lib/rubocop/cop/internal_affairs.rb +11 -0
  87. data/lib/rubocop/cop/layout/argument_alignment.rb +1 -1
  88. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  89. data/lib/rubocop/cop/layout/block_alignment.rb +16 -12
  90. data/lib/rubocop/cop/layout/block_end_newline.rb +31 -9
  91. data/lib/rubocop/cop/layout/class_structure.rb +44 -27
  92. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +2 -3
  93. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +2 -6
  94. data/lib/rubocop/cop/layout/comment_indentation.rb +4 -2
  95. data/lib/rubocop/cop/layout/dot_position.rb +1 -5
  96. data/lib/rubocop/cop/layout/empty_comment.rb +6 -4
  97. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +42 -9
  98. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
  99. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +28 -5
  100. data/lib/rubocop/cop/layout/empty_lines.rb +3 -1
  101. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +7 -2
  102. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +25 -4
  103. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +2 -0
  104. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -0
  105. data/lib/rubocop/cop/layout/end_alignment.rb +23 -3
  106. data/lib/rubocop/cop/layout/end_of_line.rb +4 -4
  107. data/lib/rubocop/cop/layout/extra_spacing.rb +12 -9
  108. data/lib/rubocop/cop/layout/first_argument_indentation.rb +15 -4
  109. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +44 -20
  110. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +35 -8
  111. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +51 -12
  112. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +36 -1
  113. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +57 -8
  114. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +52 -19
  115. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +1 -1
  116. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +12 -6
  117. data/lib/rubocop/cop/layout/heredoc_indentation.rb +12 -12
  118. data/lib/rubocop/cop/layout/indentation_style.rb +8 -3
  119. data/lib/rubocop/cop/layout/indentation_width.rb +9 -5
  120. data/lib/rubocop/cop/layout/initial_indentation.rb +2 -2
  121. data/lib/rubocop/cop/layout/leading_comment_space.rb +2 -2
  122. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +144 -0
  123. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +140 -0
  124. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -0
  125. data/lib/rubocop/cop/layout/line_length.rb +8 -1
  126. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +31 -1
  127. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
  128. data/lib/rubocop/cop/layout/multiline_block_layout.rb +4 -2
  129. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +29 -1
  130. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +39 -2
  131. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +20 -5
  132. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +77 -0
  133. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -2
  134. data/lib/rubocop/cop/layout/redundant_line_break.rb +35 -13
  135. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +6 -6
  136. data/lib/rubocop/cop/layout/single_line_block_chain.rb +5 -0
  137. data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
  138. data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
  139. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +2 -2
  140. data/lib/rubocop/cop/layout/space_around_keyword.rb +3 -3
  141. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +2 -2
  142. data/lib/rubocop/cop/layout/space_around_operators.rb +54 -22
  143. data/lib/rubocop/cop/layout/space_before_block_braces.rb +22 -11
  144. data/lib/rubocop/cop/layout/space_before_first_arg.rb +2 -2
  145. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +2 -2
  146. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +22 -20
  147. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -0
  148. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +32 -12
  149. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +31 -4
  150. data/lib/rubocop/cop/layout/space_inside_parens.rb +3 -3
  151. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +34 -0
  152. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
  153. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +10 -6
  154. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +5 -4
  155. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +6 -1
  156. data/lib/rubocop/cop/layout/trailing_whitespace.rb +13 -6
  157. data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
  158. data/lib/rubocop/cop/legacy/corrector.rb +1 -1
  159. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +40 -8
  160. data/lib/rubocop/cop/lint/ambiguous_operator.rb +4 -0
  161. data/lib/rubocop/cop/lint/assignment_in_condition.rb +17 -7
  162. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +2 -2
  163. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +51 -0
  164. data/lib/rubocop/cop/lint/constant_resolution.rb +5 -1
  165. data/lib/rubocop/cop/lint/debugger.rb +69 -34
  166. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +66 -110
  167. data/lib/rubocop/cop/lint/deprecated_constants.rb +8 -1
  168. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +1 -1
  169. data/lib/rubocop/cop/lint/duplicate_branch.rb +0 -2
  170. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -1
  171. data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
  172. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +122 -0
  173. data/lib/rubocop/cop/lint/duplicate_methods.rb +49 -19
  174. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +55 -11
  175. data/lib/rubocop/cop/lint/duplicate_require.rb +1 -1
  176. data/lib/rubocop/cop/lint/else_layout.rb +3 -7
  177. data/lib/rubocop/cop/lint/empty_block.rb +4 -8
  178. data/lib/rubocop/cop/lint/empty_class.rb +3 -1
  179. data/lib/rubocop/cop/lint/empty_conditional_body.rb +110 -2
  180. data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
  181. data/lib/rubocop/cop/lint/erb_new_arguments.rb +15 -16
  182. data/lib/rubocop/cop/lint/float_comparison.rb +10 -0
  183. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +14 -7
  184. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
  185. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +16 -18
  186. data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
  187. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
  188. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -3
  189. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
  190. data/lib/rubocop/cop/lint/inherit_exception.rb +9 -0
  191. data/lib/rubocop/cop/lint/interpolation_check.rb +5 -4
  192. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +56 -0
  193. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
  194. data/lib/rubocop/cop/lint/literal_as_condition.rb +5 -0
  195. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +85 -0
  196. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +49 -3
  197. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +18 -3
  198. data/lib/rubocop/cop/lint/missing_super.rb +63 -5
  199. data/lib/rubocop/cop/lint/mixed_case_range.rb +116 -0
  200. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
  201. data/lib/rubocop/cop/lint/nested_method_definition.rb +53 -9
  202. data/lib/rubocop/cop/lint/next_without_accumulator.rb +11 -7
  203. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +165 -0
  204. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +15 -5
  205. data/lib/rubocop/cop/lint/number_conversion.rb +45 -13
  206. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -2
  207. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -0
  208. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +4 -6
  209. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +17 -2
  210. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +6 -1
  211. data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
  212. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  213. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +54 -14
  214. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +7 -7
  215. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +7 -0
  216. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
  217. data/lib/rubocop/cop/lint/redundant_require_statement.rb +57 -10
  218. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +85 -8
  219. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
  220. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +35 -15
  221. data/lib/rubocop/cop/lint/redundant_with_index.rb +18 -11
  222. data/lib/rubocop/cop/lint/redundant_with_object.rb +13 -12
  223. data/lib/rubocop/cop/lint/refinement_import_methods.rb +2 -1
  224. data/lib/rubocop/cop/lint/regexp_as_condition.rb +8 -2
  225. data/lib/rubocop/cop/lint/require_parentheses.rb +3 -1
  226. data/lib/rubocop/cop/lint/require_range_parentheses.rb +57 -0
  227. data/lib/rubocop/cop/lint/rescue_type.rb +2 -4
  228. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +50 -11
  229. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +1 -1
  230. data/lib/rubocop/cop/lint/script_permission.rb +3 -3
  231. data/lib/rubocop/cop/lint/self_assignment.rb +38 -0
  232. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +6 -6
  233. data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -0
  234. data/lib/rubocop/cop/lint/shadowed_exception.rb +21 -22
  235. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +35 -4
  236. data/lib/rubocop/cop/lint/struct_new_override.rb +14 -14
  237. data/lib/rubocop/cop/lint/suppressed_exception.rb +3 -3
  238. data/lib/rubocop/cop/lint/symbol_conversion.rb +8 -3
  239. data/lib/rubocop/cop/lint/syntax.rb +10 -3
  240. data/lib/rubocop/cop/lint/to_enum_arguments.rb +23 -6
  241. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +23 -9
  242. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +2 -2
  243. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +2 -2
  244. data/lib/rubocop/cop/lint/unreachable_code.rb +4 -2
  245. data/lib/rubocop/cop/lint/unreachable_loop.rb +20 -8
  246. data/lib/rubocop/cop/lint/unused_method_argument.rb +6 -1
  247. data/lib/rubocop/cop/lint/useless_access_modifier.rb +19 -14
  248. data/lib/rubocop/cop/lint/useless_assignment.rb +94 -10
  249. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +44 -0
  250. data/lib/rubocop/cop/lint/useless_method_definition.rb +12 -4
  251. data/lib/rubocop/cop/lint/useless_rescue.rb +89 -0
  252. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +15 -5
  253. data/lib/rubocop/cop/lint/useless_times.rb +3 -3
  254. data/lib/rubocop/cop/lint/void.rb +126 -25
  255. data/lib/rubocop/cop/metrics/abc_size.rb +7 -5
  256. data/lib/rubocop/cop/metrics/block_length.rb +17 -12
  257. data/lib/rubocop/cop/metrics/block_nesting.rb +2 -2
  258. data/lib/rubocop/cop/metrics/class_length.rb +17 -6
  259. data/lib/rubocop/cop/metrics/collection_literal_length.rb +76 -0
  260. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
  261. data/lib/rubocop/cop/metrics/method_length.rb +18 -12
  262. data/lib/rubocop/cop/metrics/module_length.rb +10 -5
  263. data/lib/rubocop/cop/metrics/parameter_lists.rb +27 -0
  264. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  265. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +4 -8
  266. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +43 -12
  267. data/lib/rubocop/cop/migration/department_name.rb +3 -3
  268. data/lib/rubocop/cop/mixin/alignment.rb +2 -2
  269. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +2 -2
  270. data/lib/rubocop/cop/mixin/allowed_methods.rb +23 -2
  271. data/lib/rubocop/cop/mixin/allowed_pattern.rb +17 -1
  272. data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
  273. data/lib/rubocop/cop/mixin/annotation_comment.rb +14 -7
  274. data/lib/rubocop/cop/mixin/check_line_breakable.rb +5 -1
  275. data/lib/rubocop/cop/mixin/code_length.rb +12 -1
  276. data/lib/rubocop/cop/mixin/comments_help.rb +37 -11
  277. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +21 -9
  278. data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
  279. data/lib/rubocop/cop/mixin/def_node.rb +3 -8
  280. data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
  281. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  282. data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -1
  283. data/lib/rubocop/cop/mixin/first_element_line_break.rb +11 -7
  284. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -0
  285. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +1 -1
  286. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +162 -12
  287. data/lib/rubocop/cop/mixin/hash_transform_method.rb +13 -9
  288. data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
  289. data/lib/rubocop/cop/mixin/line_length_help.rb +11 -2
  290. data/lib/rubocop/cop/mixin/method_complexity.rb +28 -22
  291. data/lib/rubocop/cop/mixin/min_branches_count.rb +40 -0
  292. data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +34 -12
  293. data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +5 -6
  294. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +4 -3
  295. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  296. data/lib/rubocop/cop/mixin/percent_array.rb +58 -1
  297. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  298. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +7 -9
  299. data/lib/rubocop/cop/mixin/range_help.rb +28 -7
  300. data/lib/rubocop/cop/mixin/require_library.rb +2 -0
  301. data/lib/rubocop/cop/mixin/rescue_node.rb +5 -3
  302. data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
  303. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
  304. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
  305. data/lib/rubocop/cop/mixin/statement_modifier.rb +18 -3
  306. data/lib/rubocop/cop/mixin/string_help.rb +4 -2
  307. data/lib/rubocop/cop/mixin/surrounding_space.rb +13 -11
  308. data/lib/rubocop/cop/mixin/trailing_comma.rb +3 -3
  309. data/lib/rubocop/cop/mixin/visibility_help.rb +40 -5
  310. data/lib/rubocop/cop/naming/ascii_identifiers.rb +1 -1
  311. data/lib/rubocop/cop/naming/block_forwarding.rb +39 -8
  312. data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
  313. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +3 -1
  314. data/lib/rubocop/cop/naming/constant_name.rb +4 -5
  315. data/lib/rubocop/cop/naming/file_name.rb +3 -3
  316. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
  317. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -1
  318. data/lib/rubocop/cop/naming/inclusive_language.rb +29 -8
  319. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +26 -11
  320. data/lib/rubocop/cop/naming/method_name.rb +3 -3
  321. data/lib/rubocop/cop/naming/predicate_name.rb +33 -4
  322. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +12 -4
  323. data/lib/rubocop/cop/naming/variable_name.rb +6 -1
  324. data/lib/rubocop/cop/registry.rb +74 -46
  325. data/lib/rubocop/cop/security/compound_hash.rb +4 -3
  326. data/lib/rubocop/cop/security/open.rb +2 -2
  327. data/lib/rubocop/cop/style/access_modifier_declarations.rb +142 -3
  328. data/lib/rubocop/cop/style/accessor_grouping.rb +50 -20
  329. data/lib/rubocop/cop/style/alias.rb +19 -9
  330. data/lib/rubocop/cop/style/arguments_forwarding.rb +414 -62
  331. data/lib/rubocop/cop/style/array_first_last.rb +64 -0
  332. data/lib/rubocop/cop/style/array_intersect.rb +119 -0
  333. data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
  334. data/lib/rubocop/cop/style/attr.rb +11 -1
  335. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
  336. data/lib/rubocop/cop/style/begin_block.rb +1 -2
  337. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +3 -3
  338. data/lib/rubocop/cop/style/block_comments.rb +3 -3
  339. data/lib/rubocop/cop/style/block_delimiters.rb +52 -15
  340. data/lib/rubocop/cop/style/case_equality.rb +40 -10
  341. data/lib/rubocop/cop/style/case_like_if.rb +25 -8
  342. data/lib/rubocop/cop/style/character_literal.rb +1 -1
  343. data/lib/rubocop/cop/style/class_and_module_children.rb +9 -16
  344. data/lib/rubocop/cop/style/class_check.rb +1 -0
  345. data/lib/rubocop/cop/style/class_equality_comparison.rb +79 -12
  346. data/lib/rubocop/cop/style/class_methods_definitions.rb +2 -1
  347. data/lib/rubocop/cop/style/class_vars.rb +3 -3
  348. data/lib/rubocop/cop/style/collection_compact.rb +44 -12
  349. data/lib/rubocop/cop/style/collection_methods.rb +4 -0
  350. data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
  351. data/lib/rubocop/cop/style/combinable_loops.rb +38 -8
  352. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  353. data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
  354. data/lib/rubocop/cop/style/commented_keyword.rb +7 -4
  355. data/lib/rubocop/cop/style/comparable_clamp.rb +125 -0
  356. data/lib/rubocop/cop/style/concat_array_literals.rb +95 -0
  357. data/lib/rubocop/cop/style/conditional_assignment.rb +16 -20
  358. data/lib/rubocop/cop/style/copyright.rb +32 -22
  359. data/lib/rubocop/cop/style/data_inheritance.rb +75 -0
  360. data/lib/rubocop/cop/style/date_time.rb +5 -4
  361. data/lib/rubocop/cop/style/dir.rb +1 -1
  362. data/lib/rubocop/cop/style/dir_empty.rb +54 -0
  363. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +2 -2
  364. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +3 -3
  365. data/lib/rubocop/cop/style/documentation.rb +22 -10
  366. data/lib/rubocop/cop/style/documentation_method.rb +30 -4
  367. data/lib/rubocop/cop/style/double_negation.rb +4 -2
  368. data/lib/rubocop/cop/style/each_for_simple_loop.rb +45 -10
  369. data/lib/rubocop/cop/style/each_with_object.rb +40 -9
  370. data/lib/rubocop/cop/style/empty_block_parameter.rb +2 -2
  371. data/lib/rubocop/cop/style/empty_case_condition.rb +6 -1
  372. data/lib/rubocop/cop/style/empty_else.rb +37 -0
  373. data/lib/rubocop/cop/style/empty_heredoc.rb +73 -0
  374. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +2 -2
  375. data/lib/rubocop/cop/style/empty_literal.rb +1 -1
  376. data/lib/rubocop/cop/style/empty_method.rb +17 -2
  377. data/lib/rubocop/cop/style/encoding.rb +1 -1
  378. data/lib/rubocop/cop/style/endless_method.rb +1 -1
  379. data/lib/rubocop/cop/style/eval_with_location.rb +14 -23
  380. data/lib/rubocop/cop/style/exact_regexp_match.rb +70 -0
  381. data/lib/rubocop/cop/style/explicit_block_argument.rb +8 -4
  382. data/lib/rubocop/cop/style/fetch_env_var.rb +10 -177
  383. data/lib/rubocop/cop/style/file_empty.rb +71 -0
  384. data/lib/rubocop/cop/style/file_read.rb +3 -3
  385. data/lib/rubocop/cop/style/file_write.rb +1 -1
  386. data/lib/rubocop/cop/style/for.rb +5 -1
  387. data/lib/rubocop/cop/style/format_string.rb +33 -12
  388. data/lib/rubocop/cop/style/format_string_token.rb +73 -23
  389. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +5 -3
  390. data/lib/rubocop/cop/style/guard_clause.rb +159 -42
  391. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +2 -1
  392. data/lib/rubocop/cop/style/hash_conversion.rb +10 -0
  393. data/lib/rubocop/cop/style/hash_each_methods.rb +131 -22
  394. data/lib/rubocop/cop/style/hash_except.rb +101 -9
  395. data/lib/rubocop/cop/style/hash_like_case.rb +3 -9
  396. data/lib/rubocop/cop/style/hash_syntax.rb +51 -5
  397. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  398. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  399. data/lib/rubocop/cop/style/identical_conditional_branches.rb +47 -3
  400. data/lib/rubocop/cop/style/if_inside_else.rb +6 -0
  401. data/lib/rubocop/cop/style/if_unless_modifier.rb +112 -16
  402. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +34 -5
  403. data/lib/rubocop/cop/style/if_with_semicolon.rb +6 -6
  404. data/lib/rubocop/cop/style/implicit_runtime_error.rb +2 -2
  405. data/lib/rubocop/cop/style/infinite_loop.rb +2 -5
  406. data/lib/rubocop/cop/style/inverse_methods.rb +21 -16
  407. data/lib/rubocop/cop/style/invertible_unless_condition.rb +160 -0
  408. data/lib/rubocop/cop/style/keyword_parameters_order.rb +1 -1
  409. data/lib/rubocop/cop/style/lambda.rb +3 -3
  410. data/lib/rubocop/cop/style/lambda_call.rb +5 -0
  411. data/lib/rubocop/cop/style/line_end_concatenation.rb +5 -2
  412. data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
  413. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +8 -10
  414. data/lib/rubocop/cop/style/map_into_array.rb +175 -0
  415. data/lib/rubocop/cop/style/map_to_hash.rb +21 -8
  416. data/lib/rubocop/cop/style/map_to_set.rb +64 -0
  417. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +63 -32
  418. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +5 -1
  419. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +50 -45
  420. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +41 -2
  421. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +4 -1
  422. data/lib/rubocop/cop/style/method_def_parentheses.rb +12 -5
  423. data/lib/rubocop/cop/style/min_max.rb +3 -3
  424. data/lib/rubocop/cop/style/min_max_comparison.rb +83 -0
  425. data/lib/rubocop/cop/style/missing_else.rb +13 -1
  426. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +2 -2
  427. data/lib/rubocop/cop/style/mixin_grouping.rb +5 -5
  428. data/lib/rubocop/cop/style/module_function.rb +30 -8
  429. data/lib/rubocop/cop/style/multiline_block_chain.rb +4 -2
  430. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -6
  431. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  432. data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +2 -4
  433. data/lib/rubocop/cop/style/multiline_memoization.rb +2 -2
  434. data/lib/rubocop/cop/style/multiline_method_signature.rb +18 -6
  435. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +22 -5
  436. data/lib/rubocop/cop/style/multiline_when_then.rb +1 -3
  437. data/lib/rubocop/cop/style/multiple_comparison.rb +14 -0
  438. data/lib/rubocop/cop/style/negated_if_else_condition.rb +17 -10
  439. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +10 -1
  440. data/lib/rubocop/cop/style/nested_ternary_operator.rb +18 -14
  441. data/lib/rubocop/cop/style/next.rb +4 -6
  442. data/lib/rubocop/cop/style/nil_comparison.rb +2 -0
  443. data/lib/rubocop/cop/style/nil_lambda.rb +4 -4
  444. data/lib/rubocop/cop/style/not.rb +1 -1
  445. data/lib/rubocop/cop/style/numbered_parameters_limit.rb +11 -3
  446. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
  447. data/lib/rubocop/cop/style/numeric_literals.rb +16 -1
  448. data/lib/rubocop/cop/style/numeric_predicate.rb +53 -11
  449. data/lib/rubocop/cop/style/object_then.rb +10 -3
  450. data/lib/rubocop/cop/style/one_line_conditional.rb +4 -7
  451. data/lib/rubocop/cop/style/open_struct_use.rb +1 -1
  452. data/lib/rubocop/cop/style/operator_method_call.rb +73 -0
  453. data/lib/rubocop/cop/style/parallel_assignment.rb +32 -24
  454. data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -0
  455. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +2 -3
  456. data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
  457. data/lib/rubocop/cop/style/perl_backrefs.rb +22 -1
  458. data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
  459. data/lib/rubocop/cop/style/proc.rb +4 -1
  460. data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
  461. data/lib/rubocop/cop/style/raise_args.rb +4 -1
  462. data/lib/rubocop/cop/style/redundant_argument.rb +37 -5
  463. data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
  464. data/lib/rubocop/cop/style/redundant_assignment.rb +10 -2
  465. data/lib/rubocop/cop/style/redundant_begin.rb +13 -2
  466. data/lib/rubocop/cop/style/redundant_condition.rb +41 -8
  467. data/lib/rubocop/cop/style/redundant_conditional.rb +2 -14
  468. data/lib/rubocop/cop/style/redundant_constant_base.rb +85 -0
  469. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +39 -0
  470. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +133 -0
  471. data/lib/rubocop/cop/style/redundant_each.rb +119 -0
  472. data/lib/rubocop/cop/style/redundant_exception.rb +32 -12
  473. data/lib/rubocop/cop/style/redundant_fetch_block.rb +10 -8
  474. data/lib/rubocop/cop/style/redundant_filter_chain.rb +118 -0
  475. data/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb +58 -0
  476. data/lib/rubocop/cop/style/redundant_initialize.rb +3 -1
  477. data/lib/rubocop/cop/style/redundant_interpolation.rb +2 -2
  478. data/lib/rubocop/cop/style/redundant_line_continuation.rb +199 -0
  479. data/lib/rubocop/cop/style/redundant_parentheses.rb +91 -44
  480. data/lib/rubocop/cop/style/redundant_percent_q.rb +2 -2
  481. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +100 -0
  482. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +9 -3
  483. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
  484. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +22 -4
  485. data/lib/rubocop/cop/style/redundant_return.rb +21 -3
  486. data/lib/rubocop/cop/style/redundant_self.rb +19 -2
  487. data/lib/rubocop/cop/style/redundant_self_assignment.rb +1 -1
  488. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +8 -1
  489. data/lib/rubocop/cop/style/redundant_sort.rb +33 -17
  490. data/lib/rubocop/cop/style/redundant_sort_by.rb +24 -8
  491. data/lib/rubocop/cop/style/redundant_string_escape.rb +185 -0
  492. data/lib/rubocop/cop/style/regexp_literal.rb +11 -2
  493. data/lib/rubocop/cop/style/require_order.rb +139 -0
  494. data/lib/rubocop/cop/style/rescue_modifier.rb +2 -4
  495. data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
  496. data/lib/rubocop/cop/style/return_nil.rb +6 -2
  497. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +95 -0
  498. data/lib/rubocop/cop/style/safe_navigation.rb +41 -10
  499. data/lib/rubocop/cop/style/sample.rb +3 -4
  500. data/lib/rubocop/cop/style/select_by_regexp.rb +30 -11
  501. data/lib/rubocop/cop/style/self_assignment.rb +3 -3
  502. data/lib/rubocop/cop/style/semicolon.rb +71 -8
  503. data/lib/rubocop/cop/style/send.rb +4 -4
  504. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +83 -0
  505. data/lib/rubocop/cop/style/signal_exception.rb +9 -7
  506. data/lib/rubocop/cop/style/single_argument_dig.rb +7 -3
  507. data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
  508. data/lib/rubocop/cop/style/single_line_do_end_block.rb +67 -0
  509. data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
  510. data/lib/rubocop/cop/style/slicing_with_range.rb +77 -11
  511. data/lib/rubocop/cop/style/sole_nested_conditional.rb +25 -12
  512. data/lib/rubocop/cop/style/special_global_vars.rb +4 -6
  513. data/lib/rubocop/cop/style/static_class.rb +32 -1
  514. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  515. data/lib/rubocop/cop/style/string_chars.rb +1 -0
  516. data/lib/rubocop/cop/style/string_hash_keys.rb +4 -1
  517. data/lib/rubocop/cop/style/string_literals.rb +1 -5
  518. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
  519. data/lib/rubocop/cop/style/strip.rb +7 -4
  520. data/lib/rubocop/cop/style/struct_inheritance.rb +3 -3
  521. data/lib/rubocop/cop/style/super_arguments.rb +137 -0
  522. data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
  523. data/lib/rubocop/cop/style/swap_values.rb +1 -1
  524. data/lib/rubocop/cop/style/symbol_array.rb +40 -19
  525. data/lib/rubocop/cop/style/symbol_proc.rb +110 -15
  526. data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -13
  527. data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
  528. data/lib/rubocop/cop/style/trailing_body_on_class.rb +1 -0
  529. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +4 -4
  530. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
  531. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -1
  532. data/lib/rubocop/cop/style/trivial_accessors.rb +4 -1
  533. data/lib/rubocop/cop/style/unless_logical_operators.rb +1 -0
  534. data/lib/rubocop/cop/style/unpack_first.rb +11 -14
  535. data/lib/rubocop/cop/style/word_array.rb +59 -5
  536. data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
  537. data/lib/rubocop/cop/style/yoda_condition.rb +17 -8
  538. data/lib/rubocop/cop/style/yoda_expression.rb +91 -0
  539. data/lib/rubocop/cop/style/zero_length_predicate.rb +40 -19
  540. data/lib/rubocop/cop/team.rb +66 -56
  541. data/lib/rubocop/cop/util.rb +46 -10
  542. data/lib/rubocop/cop/utils/regexp_ranges.rb +113 -0
  543. data/lib/rubocop/cop/variable_force/assignment.rb +45 -4
  544. data/lib/rubocop/cop/variable_force/scope.rb +3 -3
  545. data/lib/rubocop/cop/variable_force/variable.rb +5 -3
  546. data/lib/rubocop/cop/variable_force/variable_table.rb +6 -4
  547. data/lib/rubocop/cop/variable_force.rb +19 -30
  548. data/lib/rubocop/cops_documentation_generator.rb +60 -18
  549. data/lib/rubocop/directive_comment.rb +14 -12
  550. data/lib/rubocop/ext/comment.rb +18 -0
  551. data/lib/rubocop/ext/processed_source.rb +2 -0
  552. data/lib/rubocop/ext/range.rb +15 -0
  553. data/lib/rubocop/ext/regexp_node.rb +10 -5
  554. data/lib/rubocop/ext/regexp_parser.rb +5 -2
  555. data/lib/rubocop/feature_loader.rb +94 -0
  556. data/lib/rubocop/file_finder.rb +4 -7
  557. data/lib/rubocop/file_patterns.rb +43 -0
  558. data/lib/rubocop/formatter/clang_style_formatter.rb +4 -8
  559. data/lib/rubocop/formatter/disabled_config_formatter.rb +47 -15
  560. data/lib/rubocop/formatter/formatter_set.rb +27 -20
  561. data/lib/rubocop/formatter/{git_hub_actions_formatter.rb → github_actions_formatter.rb} +15 -2
  562. data/lib/rubocop/formatter/html_formatter.rb +38 -18
  563. data/lib/rubocop/formatter/json_formatter.rb +0 -1
  564. data/lib/rubocop/formatter/junit_formatter.rb +4 -1
  565. data/lib/rubocop/formatter/markdown_formatter.rb +1 -1
  566. data/lib/rubocop/formatter/offense_count_formatter.rb +21 -6
  567. data/lib/rubocop/formatter/simple_text_formatter.rb +7 -8
  568. data/lib/rubocop/formatter/tap_formatter.rb +4 -8
  569. data/lib/rubocop/formatter/worst_offenders_formatter.rb +6 -3
  570. data/lib/rubocop/formatter.rb +34 -0
  571. data/lib/rubocop/lockfile.rb +56 -7
  572. data/lib/rubocop/lsp/logger.rb +22 -0
  573. data/lib/rubocop/lsp/routes.rb +243 -0
  574. data/lib/rubocop/lsp/runtime.rb +99 -0
  575. data/lib/rubocop/lsp/server.rb +73 -0
  576. data/lib/rubocop/lsp/severity.rb +27 -0
  577. data/lib/rubocop/lsp.rb +36 -0
  578. data/lib/rubocop/magic_comment.rb +13 -11
  579. data/lib/rubocop/options.rb +101 -32
  580. data/lib/rubocop/path_util.rb +54 -22
  581. data/lib/rubocop/rake_task.rb +35 -10
  582. data/lib/rubocop/result_cache.rb +29 -24
  583. data/lib/rubocop/rspec/cop_helper.rb +32 -3
  584. data/lib/rubocop/rspec/expect_offense.rb +18 -8
  585. data/lib/rubocop/rspec/shared_contexts.rb +86 -33
  586. data/lib/rubocop/rspec/support.rb +19 -2
  587. data/lib/rubocop/runner.rb +91 -23
  588. data/lib/rubocop/server/cache.rb +155 -0
  589. data/lib/rubocop/server/cli.rb +147 -0
  590. data/lib/rubocop/server/client_command/base.rb +44 -0
  591. data/lib/rubocop/server/client_command/exec.rb +64 -0
  592. data/lib/rubocop/server/client_command/restart.rb +25 -0
  593. data/lib/rubocop/server/client_command/start.rb +48 -0
  594. data/lib/rubocop/server/client_command/status.rb +28 -0
  595. data/lib/rubocop/server/client_command/stop.rb +31 -0
  596. data/lib/rubocop/server/client_command.rb +26 -0
  597. data/lib/rubocop/server/core.rb +111 -0
  598. data/lib/rubocop/server/errors.rb +23 -0
  599. data/lib/rubocop/server/helper.rb +34 -0
  600. data/lib/rubocop/server/server_command/base.rb +50 -0
  601. data/lib/rubocop/server/server_command/exec.rb +33 -0
  602. data/lib/rubocop/server/server_command/stop.rb +24 -0
  603. data/lib/rubocop/server/server_command.rb +21 -0
  604. data/lib/rubocop/server/socket_reader.rb +69 -0
  605. data/lib/rubocop/server.rb +53 -0
  606. data/lib/rubocop/string_interpreter.rb +3 -3
  607. data/lib/rubocop/target_finder.rb +92 -82
  608. data/lib/rubocop/target_ruby.rb +86 -80
  609. data/lib/rubocop/version.rb +44 -12
  610. data/lib/rubocop.rb +73 -35
  611. metadata +145 -39
  612. data/lib/rubocop/cop/gemspec/date_assignment.rb +0 -49
  613. data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
data/config/default.yml CHANGED
@@ -30,6 +30,7 @@ AllCops:
30
30
  - '**/*.rbx'
31
31
  - '**/*.ru'
32
32
  - '**/*.ruby'
33
+ - '**/*.schema'
33
34
  - '**/*.spec'
34
35
  - '**/*.thor'
35
36
  - '**/*.watchr'
@@ -55,6 +56,7 @@ AllCops:
55
56
  - '**/Puppetfile'
56
57
  - '**/Rakefile'
57
58
  - '**/rakefile'
59
+ - '**/Schemafile'
58
60
  - '**/Snapfile'
59
61
  - '**/Steepfile'
60
62
  - '**/Thorfile'
@@ -140,8 +142,14 @@ AllCops:
140
142
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
141
143
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
142
144
  # Ruby version is still unresolved, RuboCop will use the oldest officially
143
- # supported Ruby version (currently Ruby 2.6).
145
+ # supported Ruby version (currently Ruby 2.7).
144
146
  TargetRubyVersion: ~
147
+ # You can specify the parser engine. There are two options available:
148
+ # - `parser_whitequark` ... https://github.com/whitequark/parser
149
+ # - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
150
+ # By default, `parser` is used. For the `TargetRubyVersion` value, `parser` can be specified for versions `2.0` and above.
151
+ # `parser_prism` can be specified for versions `3.3` and above. `parser_prism` is faster but still considered experimental.
152
+ ParserEngine: parser_whitequark
145
153
  # Determines if a notification for extension libraries should be shown when
146
154
  # rubocop is run. Keys are the name of the extension, and values are an array
147
155
  # of gems in the Gemfile that the extension is suggested for, if not already
@@ -153,13 +161,30 @@ AllCops:
153
161
  rubocop-sequel: [sequel]
154
162
  rubocop-rake: [rake]
155
163
  rubocop-graphql: [graphql]
164
+ rubocop-capybara: [capybara]
165
+ rubocop-factory_bot: [factory_bot, factory_bot_rails]
166
+ rubocop-rspec_rails: [rspec-rails]
167
+ # Enable/Disable checking the methods extended by Active Support.
168
+ ActiveSupportExtensionsEnabled: false
156
169
 
157
170
  #################### Bundler ###############################
158
171
 
159
172
  Bundler/DuplicatedGem:
160
173
  Description: 'Checks for duplicate gem entries in Gemfile.'
161
174
  Enabled: true
175
+ Severity: warning
162
176
  VersionAdded: '0.46'
177
+ VersionChanged: '1.40'
178
+ Include:
179
+ - '**/*.gemfile'
180
+ - '**/Gemfile'
181
+ - '**/gems.rb'
182
+
183
+ Bundler/DuplicatedGroup:
184
+ Description: 'Checks for duplicate group entries in Gemfile.'
185
+ Enabled: true
186
+ Severity: warning
187
+ VersionAdded: '1.56'
163
188
  Include:
164
189
  - '**/*.gemfile'
165
190
  - '**/Gemfile'
@@ -211,7 +236,9 @@ Bundler/InsecureProtocolSource:
211
236
  because HTTP requests are insecure. Please change your source to
212
237
  'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
213
238
  Enabled: true
239
+ Severity: warning
214
240
  VersionAdded: '0.50'
241
+ VersionChanged: '1.40'
215
242
  AllowHttpProtocol: true
216
243
  Include:
217
244
  - '**/*.gemfile'
@@ -235,13 +262,6 @@ Bundler/OrderedGems:
235
262
 
236
263
  #################### Gemspec ###############################
237
264
 
238
- Gemspec/DateAssignment:
239
- Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
240
- Enabled: pending
241
- VersionAdded: '1.10'
242
- Include:
243
- - '**/*.gemspec'
244
-
245
265
  Gemspec/DependencyVersion:
246
266
  Description: 'Requires or forbids specifying gem dependency versions.'
247
267
  Enabled: false
@@ -257,14 +277,33 @@ Gemspec/DependencyVersion:
257
277
  Gemspec/DeprecatedAttributeAssignment:
258
278
  Description: Checks that deprecated attribute assignments are not set in a gemspec file.
259
279
  Enabled: pending
280
+ Severity: warning
260
281
  VersionAdded: '1.30'
282
+ VersionChanged: '1.40'
283
+ Include:
284
+ - '**/*.gemspec'
285
+
286
+ Gemspec/DevelopmentDependencies:
287
+ Description: Checks that development dependencies are specified in Gemfile rather than gemspec.
288
+ Enabled: pending
289
+ VersionAdded: '1.44'
290
+ EnforcedStyle: Gemfile
291
+ SupportedStyles:
292
+ - Gemfile
293
+ - gems.rb
294
+ - gemspec
295
+ AllowedGems: []
261
296
  Include:
262
297
  - '**/*.gemspec'
298
+ - '**/Gemfile'
299
+ - '**/gems.rb'
263
300
 
264
301
  Gemspec/DuplicatedAssignment:
265
302
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
266
303
  Enabled: true
304
+ Severity: warning
267
305
  VersionAdded: '0.52'
306
+ VersionChanged: '1.40'
268
307
  Include:
269
308
  - '**/*.gemspec'
270
309
 
@@ -283,7 +322,9 @@ Gemspec/OrderedDependencies:
283
322
  Gemspec/RequireMFA:
284
323
  Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
285
324
  Enabled: pending
325
+ Severity: warning
286
326
  VersionAdded: '1.23'
327
+ VersionChanged: '1.40'
287
328
  Reference:
288
329
  - https://guides.rubygems.org/mfa-requirement-opt-in/
289
330
  Include:
@@ -292,8 +333,9 @@ Gemspec/RequireMFA:
292
333
  Gemspec/RequiredRubyVersion:
293
334
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
294
335
  Enabled: true
336
+ Severity: warning
295
337
  VersionAdded: '0.52'
296
- VersionChanged: '1.22'
338
+ VersionChanged: '1.40'
297
339
  Include:
298
340
  - '**/*.gemspec'
299
341
 
@@ -301,7 +343,9 @@ Gemspec/RubyVersionGlobalsUsage:
301
343
  Description: Checks usage of RUBY_VERSION in gemspec.
302
344
  StyleGuide: '#no-ruby-version-in-the-gemspec'
303
345
  Enabled: true
346
+ Severity: warning
304
347
  VersionAdded: '0.72'
348
+ VersionChanged: '1.40'
305
349
  Include:
306
350
  - '**/*.gemspec'
307
351
 
@@ -384,7 +428,7 @@ Layout/AssignmentIndentation:
384
428
  right-hand-side of a multi-line assignment.
385
429
  Enabled: true
386
430
  VersionAdded: '0.49'
387
- VersionChanged: '0.77'
431
+ VersionChanged: '1.45'
388
432
  # By default the indentation width from `Layout/IndentationWidth` is used,
389
433
  # but it can be overridden by setting this parameter.
390
434
  IndentationWidth: ~
@@ -442,7 +486,9 @@ Layout/ClassStructure:
442
486
  Description: 'Enforces a configured order of definitions within a class body.'
443
487
  StyleGuide: '#consistent-classes'
444
488
  Enabled: false
489
+ SafeAutoCorrect: false
445
490
  VersionAdded: '0.52'
491
+ VersionChanged: '1.53'
446
492
  Categories:
447
493
  module_inclusion:
448
494
  - include
@@ -517,7 +563,9 @@ Layout/ElseAlignment:
517
563
  Layout/EmptyComment:
518
564
  Description: 'Checks empty comment.'
519
565
  Enabled: true
566
+ AutoCorrect: contextual
520
567
  VersionAdded: '0.53'
568
+ VersionChanged: '1.61'
521
569
  AllowBorderComment: true
522
570
  AllowMarginComment: true
523
571
 
@@ -550,6 +598,8 @@ Layout/EmptyLineBetweenDefs:
550
598
  EmptyLineBetweenMethodDefs: true
551
599
  EmptyLineBetweenClassDefs: true
552
600
  EmptyLineBetweenModuleDefs: true
601
+ # `DefLikeMacros` takes the name of any macro that you want to treat like a def.
602
+ DefLikeMacros: []
553
603
  # `AllowAdjacentOneLineDefs` means that single line method definitions don't
554
604
  # need an empty line between them. `true` by default.
555
605
  AllowAdjacentOneLineDefs: true
@@ -753,6 +803,7 @@ Layout/FirstArrayElementLineBreak:
753
803
  multi-line array.
754
804
  Enabled: false
755
805
  VersionAdded: '0.49'
806
+ AllowMultilineFinalElement: false
756
807
 
757
808
  Layout/FirstHashElementIndentation:
758
809
  Description: 'Checks the indentation of the first key in a hash literal.'
@@ -785,6 +836,7 @@ Layout/FirstHashElementLineBreak:
785
836
  multi-line hash.
786
837
  Enabled: false
787
838
  VersionAdded: '0.49'
839
+ AllowMultilineFinalElement: false
788
840
 
789
841
  Layout/FirstMethodArgumentLineBreak:
790
842
  Description: >-
@@ -792,6 +844,7 @@ Layout/FirstMethodArgumentLineBreak:
792
844
  multi-line method call.
793
845
  Enabled: false
794
846
  VersionAdded: '0.49'
847
+ AllowMultilineFinalElement: false
795
848
 
796
849
  Layout/FirstMethodParameterLineBreak:
797
850
  Description: >-
@@ -799,6 +852,7 @@ Layout/FirstMethodParameterLineBreak:
799
852
  multi-line method parameter definition.
800
853
  Enabled: false
801
854
  VersionAdded: '0.49'
855
+ AllowMultilineFinalElement: false
802
856
 
803
857
  Layout/FirstParameterIndentation:
804
858
  Description: >-
@@ -951,7 +1005,6 @@ Layout/IndentationWidth:
951
1005
  # Number of spaces for each indentation level.
952
1006
  Width: 2
953
1007
  AllowedPatterns: []
954
- IgnoredPatterns: [] # deprecated
955
1008
 
956
1009
  Layout/InitialIndentation:
957
1010
  Description: >-
@@ -974,6 +1027,27 @@ Layout/LeadingEmptyLines:
974
1027
  VersionAdded: '0.57'
975
1028
  VersionChanged: '0.77'
976
1029
 
1030
+ Layout/LineContinuationLeadingSpace:
1031
+ Description: >-
1032
+ Use trailing spaces instead of leading spaces in strings
1033
+ broken over multiple lines (by a backslash).
1034
+ Enabled: pending
1035
+ VersionAdded: '1.31'
1036
+ VersionChanged: '1.45'
1037
+ EnforcedStyle: trailing
1038
+ SupportedStyles:
1039
+ - leading
1040
+ - trailing
1041
+
1042
+ Layout/LineContinuationSpacing:
1043
+ Description: 'Checks the spacing in front of backslash in line continuations.'
1044
+ Enabled: pending
1045
+ VersionAdded: '1.31'
1046
+ EnforcedStyle: space
1047
+ SupportedStyles:
1048
+ - space
1049
+ - no_space
1050
+
977
1051
  Layout/LineEndStringConcatenationIndentation:
978
1052
  Description: >-
979
1053
  Checks the indentation of the next line after a line that
@@ -1009,7 +1083,6 @@ Layout/LineLength:
1009
1083
  # elements. Strings will be converted to Regexp objects. A line that matches
1010
1084
  # any regular expression listed in this option will be ignored by LineLength.
1011
1085
  AllowedPatterns: []
1012
- IgnoredPatterns: [] # deprecated
1013
1086
 
1014
1087
  Layout/MultilineArrayBraceLayout:
1015
1088
  Description: >-
@@ -1033,6 +1106,7 @@ Layout/MultilineArrayLineBreaks:
1033
1106
  starts on a separate line.
1034
1107
  Enabled: false
1035
1108
  VersionAdded: '0.67'
1109
+ AllowMultilineFinalElement: false
1036
1110
 
1037
1111
  Layout/MultilineAssignmentLayout:
1038
1112
  Description: 'Check for a newline after the assignment operator in multi-line assignments.'
@@ -1083,6 +1157,7 @@ Layout/MultilineHashKeyLineBreaks:
1083
1157
  starts on a separate line.
1084
1158
  Enabled: false
1085
1159
  VersionAdded: '0.67'
1160
+ AllowMultilineFinalElement: false
1086
1161
 
1087
1162
  Layout/MultilineMethodArgumentLineBreaks:
1088
1163
  Description: >-
@@ -1090,6 +1165,7 @@ Layout/MultilineMethodArgumentLineBreaks:
1090
1165
  starts on a separate line.
1091
1166
  Enabled: false
1092
1167
  VersionAdded: '0.67'
1168
+ AllowMultilineFinalElement: false
1093
1169
 
1094
1170
  Layout/MultilineMethodCallBraceLayout:
1095
1171
  Description: >-
@@ -1138,6 +1214,14 @@ Layout/MultilineMethodDefinitionBraceLayout:
1138
1214
  - new_line
1139
1215
  - same_line
1140
1216
 
1217
+ Layout/MultilineMethodParameterLineBreaks:
1218
+ Description: >-
1219
+ Checks that each parameter in a multi-line method definition
1220
+ starts on a separate line.
1221
+ Enabled: false
1222
+ VersionAdded: '1.32'
1223
+ AllowMultilineFinalElement: false
1224
+
1141
1225
  Layout/MultilineOperationIndentation:
1142
1226
  Description: >-
1143
1227
  Checks indentation of binary operations that span more than
@@ -1276,6 +1360,10 @@ Layout/SpaceAroundOperators:
1276
1360
  SupportedStylesForExponentOperator:
1277
1361
  - space
1278
1362
  - no_space
1363
+ EnforcedStyleForRationalLiterals: no_space
1364
+ SupportedStylesForRationalLiterals:
1365
+ - space
1366
+ - no_space
1279
1367
 
1280
1368
  Layout/SpaceBeforeBlockBraces:
1281
1369
  Description: >-
@@ -1471,11 +1559,11 @@ Lint/AmbiguousBlockAssociation:
1471
1559
  Description: >-
1472
1560
  Checks for ambiguous block association with method when param passed without
1473
1561
  parentheses.
1474
- StyleGuide: '#syntax'
1475
1562
  Enabled: true
1476
1563
  VersionAdded: '0.48'
1477
1564
  VersionChanged: '1.13'
1478
- IgnoredMethods: []
1565
+ AllowedMethods: []
1566
+ AllowedPatterns: []
1479
1567
 
1480
1568
  Lint/AmbiguousOperator:
1481
1569
  Description: >-
@@ -1512,7 +1600,9 @@ Lint/AssignmentInCondition:
1512
1600
  Description: "Don't use assignment in conditions."
1513
1601
  StyleGuide: '#safe-assignment-in-condition'
1514
1602
  Enabled: true
1603
+ SafeAutoCorrect: false
1515
1604
  VersionAdded: '0.9'
1605
+ VersionChanged: '1.45'
1516
1606
  AllowSafeAssignment: true
1517
1607
 
1518
1608
  Lint/BigDecimalNew:
@@ -1550,6 +1640,11 @@ Lint/ConstantDefinitionInBlock:
1550
1640
  AllowedMethods:
1551
1641
  - enums
1552
1642
 
1643
+ Lint/ConstantOverwrittenInRescue:
1644
+ Description: 'Checks for overwriting an exception with an exception result by use `rescue =>`.'
1645
+ Enabled: pending
1646
+ VersionAdded: '1.31'
1647
+
1553
1648
  Lint/ConstantResolution:
1554
1649
  Description: 'Check that constants are fully qualified with `::`.'
1555
1650
  Enabled: false
@@ -1563,21 +1658,27 @@ Lint/Debugger:
1563
1658
  Description: 'Check for debugger calls.'
1564
1659
  Enabled: true
1565
1660
  VersionAdded: '0.14'
1566
- VersionChanged: '1.10'
1567
- DebuggerReceivers: [] # deprecated
1661
+ VersionChanged: '1.63'
1568
1662
  DebuggerMethods:
1569
1663
  # Groups are available so that a specific group can be disabled in
1570
1664
  # a user's configuration, but are otherwise not significant.
1571
1665
  Kernel:
1572
1666
  - binding.irb
1667
+ - Kernel.binding.irb
1573
1668
  Byebug:
1574
1669
  - byebug
1575
1670
  - remote_byebug
1576
1671
  - Kernel.byebug
1577
1672
  - Kernel.remote_byebug
1578
1673
  Capybara:
1674
+ - page.save_and_open_page
1675
+ - page.save_and_open_screenshot
1676
+ - page.save_page
1677
+ - page.save_screenshot
1579
1678
  - save_and_open_page
1580
1679
  - save_and_open_screenshot
1680
+ - save_page
1681
+ - save_screenshot
1581
1682
  debug.rb:
1582
1683
  - binding.b
1583
1684
  - binding.break
@@ -1587,7 +1688,11 @@ Lint/Debugger:
1587
1688
  - binding.pry
1588
1689
  - binding.remote_pry
1589
1690
  - binding.pry_remote
1691
+ - Kernel.binding.pry
1692
+ - Kernel.binding.remote_pry
1693
+ - Kernel.binding.pry_remote
1590
1694
  - Pry.rescue
1695
+ - pry
1591
1696
  Rails:
1592
1697
  - debugger
1593
1698
  - Kernel.debugger
@@ -1595,6 +1700,10 @@ Lint/Debugger:
1595
1700
  - jard
1596
1701
  WebConsole:
1597
1702
  - binding.console
1703
+ DebuggerRequires:
1704
+ debug.rb:
1705
+ - debug/open
1706
+ - debug/start
1598
1707
 
1599
1708
  Lint/DeprecatedClassMethods:
1600
1709
  Description: 'Check for deprecated class method calls.'
@@ -1605,7 +1714,7 @@ Lint/DeprecatedConstants:
1605
1714
  Description: 'Checks for deprecated constants.'
1606
1715
  Enabled: pending
1607
1716
  VersionAdded: '1.8'
1608
- VersionChanged: '1.22'
1717
+ VersionChanged: '1.40'
1609
1718
  # You can configure deprecated constants.
1610
1719
  # If there is an alternative method, you can set alternative value as `Alternative`.
1611
1720
  # And you can set the deprecated version as `DeprecatedVersion`.
@@ -1632,6 +1741,12 @@ Lint/DeprecatedConstants:
1632
1741
  'Random::DEFAULT':
1633
1742
  Alternative: 'Random.new'
1634
1743
  DeprecatedVersion: '3.0'
1744
+ 'Struct::Group':
1745
+ Alternative: 'Etc::Group'
1746
+ DeprecatedVersion: '3.0'
1747
+ 'Struct::Passwd':
1748
+ Alternative: 'Etc::Passwd'
1749
+ DeprecatedVersion: '3.0'
1635
1750
 
1636
1751
  Lint/DeprecatedOpenSSLConstant:
1637
1752
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
@@ -1669,6 +1784,16 @@ Lint/DuplicateHashKey:
1669
1784
  VersionAdded: '0.34'
1670
1785
  VersionChanged: '0.77'
1671
1786
 
1787
+ Lint/DuplicateMagicComment:
1788
+ Description: 'Check for duplicated magic comments.'
1789
+ Enabled: pending
1790
+ VersionAdded: '1.37'
1791
+
1792
+ Lint/DuplicateMatchPattern:
1793
+ Description: 'Do not repeat patterns in `in` keywords.'
1794
+ Enabled: pending
1795
+ VersionAdded: '1.50'
1796
+
1672
1797
  Lint/DuplicateMethods:
1673
1798
  Description: 'Check for duplicate method definitions.'
1674
1799
  Enabled: true
@@ -1719,14 +1844,18 @@ Lint/EmptyClass:
1719
1844
  Lint/EmptyConditionalBody:
1720
1845
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1721
1846
  Enabled: true
1847
+ AutoCorrect: contextual
1848
+ SafeAutoCorrect: false
1722
1849
  AllowComments: true
1723
1850
  VersionAdded: '0.89'
1851
+ VersionChanged: '1.61'
1724
1852
 
1725
1853
  Lint/EmptyEnsure:
1726
1854
  Description: 'Checks for empty ensure block.'
1727
1855
  Enabled: true
1856
+ AutoCorrect: contextual
1728
1857
  VersionAdded: '0.10'
1729
- VersionChanged: '0.48'
1858
+ VersionChanged: '1.61'
1730
1859
 
1731
1860
  Lint/EmptyExpression:
1732
1861
  Description: 'Checks for empty expressions.'
@@ -1748,8 +1877,9 @@ Lint/EmptyInPattern:
1748
1877
  Lint/EmptyInterpolation:
1749
1878
  Description: 'Checks for empty string interpolation.'
1750
1879
  Enabled: true
1880
+ AutoCorrect: contextual
1751
1881
  VersionAdded: '0.20'
1752
- VersionChanged: '0.45'
1882
+ VersionChanged: '1.61'
1753
1883
 
1754
1884
  Lint/EmptyWhen:
1755
1885
  Description: 'Checks for `when` branches with empty bodies.'
@@ -1849,11 +1979,17 @@ Lint/InheritException:
1849
1979
  - runtime_error
1850
1980
 
1851
1981
  Lint/InterpolationCheck:
1852
- Description: 'Raise warning for interpolation in single q strs.'
1982
+ Description: 'Checks for interpolation in a single quoted string.'
1853
1983
  Enabled: true
1854
- Safe: false
1984
+ SafeAutoCorrect: false
1855
1985
  VersionAdded: '0.50'
1856
- VersionChanged: '0.87'
1986
+ VersionChanged: '1.40'
1987
+
1988
+ Lint/ItWithoutArgumentsInBlock:
1989
+ Description: 'Checks uses of `it` calls without arguments in block.'
1990
+ Reference: 'https://bugs.ruby-lang.org/issues/18980'
1991
+ Enabled: pending
1992
+ VersionAdded: '1.59'
1857
1993
 
1858
1994
  Lint/LambdaWithoutLiteralBlock:
1859
1995
  Description: 'Checks uses of lambda without a literal block.'
@@ -1865,6 +2001,11 @@ Lint/LiteralAsCondition:
1865
2001
  Enabled: true
1866
2002
  VersionAdded: '0.51'
1867
2003
 
2004
+ Lint/LiteralAssignmentInCondition:
2005
+ Description: 'Checks for literal assignments in the conditions.'
2006
+ Enabled: pending
2007
+ VersionAdded: '1.58'
2008
+
1868
2009
  Lint/LiteralInInterpolation:
1869
2010
  Description: 'Checks for literals used in interpolation.'
1870
2011
  Enabled: true
@@ -1899,9 +2040,16 @@ Lint/MissingSuper:
1899
2040
  Checks for the presence of constructors and lifecycle callbacks
1900
2041
  without calls to `super`.
1901
2042
  Enabled: true
2043
+ AllowedParentClasses: []
1902
2044
  VersionAdded: '0.89'
1903
2045
  VersionChanged: '1.4'
1904
2046
 
2047
+ Lint/MixedCaseRange:
2048
+ Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
2049
+ Enabled: pending
2050
+ SafeAutoCorrect: false
2051
+ VersionAdded: '1.53'
2052
+
1905
2053
  Lint/MixedRegexpCaptureTypes:
1906
2054
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1907
2055
  Enabled: true
@@ -1917,6 +2065,8 @@ Lint/NestedMethodDefinition:
1917
2065
  Description: 'Do not use nested method definitions.'
1918
2066
  StyleGuide: '#no-nested-methods'
1919
2067
  Enabled: true
2068
+ AllowedMethods: []
2069
+ AllowedPatterns: []
1920
2070
  VersionAdded: '0.32'
1921
2071
 
1922
2072
  Lint/NestedPercentLiteral:
@@ -1936,6 +2086,13 @@ Lint/NoReturnInBeginEndBlocks:
1936
2086
  Enabled: pending
1937
2087
  VersionAdded: '1.2'
1938
2088
 
2089
+ Lint/NonAtomicFileOperation:
2090
+ Description: Checks for non-atomic file operations.
2091
+ StyleGuide: '#atomic-file-operations'
2092
+ Enabled: pending
2093
+ VersionAdded: '1.31'
2094
+ SafeAutoCorrect: false
2095
+
1939
2096
  Lint/NonDeterministicRequireOrder:
1940
2097
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1941
2098
  Enabled: true
@@ -1953,7 +2110,8 @@ Lint/NumberConversion:
1953
2110
  VersionAdded: '0.53'
1954
2111
  VersionChanged: '1.1'
1955
2112
  SafeAutoCorrect: false
1956
- IgnoredMethods: []
2113
+ AllowedMethods: []
2114
+ AllowedPatterns: []
1957
2115
  IgnoredClasses:
1958
2116
  - Time
1959
2117
  - DateTime
@@ -1972,7 +2130,9 @@ Lint/OrAssignmentToConstant:
1972
2130
  Lint/OrderedMagicComments:
1973
2131
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1974
2132
  Enabled: true
2133
+ SafeAutoCorrect: false
1975
2134
  VersionAdded: '0.53'
2135
+ VersionChanged: '1.37'
1976
2136
 
1977
2137
  Lint/OutOfRangeRegexpRef:
1978
2138
  Description: 'Checks for out of range reference for Regexp because it always returns nil.'
@@ -2039,10 +2199,17 @@ Lint/RedundantDirGlobSort:
2039
2199
  VersionChanged: '1.26'
2040
2200
  SafeAutoCorrect: false
2041
2201
 
2202
+ Lint/RedundantRegexpQuantifiers:
2203
+ Description: 'Checks for redundant quantifiers in Regexps.'
2204
+ Enabled: pending
2205
+ VersionAdded: '1.53'
2206
+
2042
2207
  Lint/RedundantRequireStatement:
2043
2208
  Description: 'Checks for unnecessary `require` statement.'
2044
2209
  Enabled: true
2210
+ SafeAutoCorrect: false
2045
2211
  VersionAdded: '0.76'
2212
+ VersionChanged: '1.57'
2046
2213
 
2047
2214
  Lint/RedundantSafeNavigation:
2048
2215
  Description: 'Checks for redundant safe navigation calls.'
@@ -2102,6 +2269,11 @@ Lint/RequireParentheses:
2102
2269
  Enabled: true
2103
2270
  VersionAdded: '0.18'
2104
2271
 
2272
+ Lint/RequireRangeParentheses:
2273
+ Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
2274
+ Enabled: pending
2275
+ VersionAdded: '1.32'
2276
+
2105
2277
  Lint/RequireRelativeSelfPath:
2106
2278
  Description: 'Checks for uses a file requiring itself with `require_relative`.'
2107
2279
  Enabled: pending
@@ -2238,11 +2410,16 @@ Lint/TopLevelReturnWithArgument:
2238
2410
  Description: 'Detects top level return statements with argument.'
2239
2411
  Enabled: true
2240
2412
  VersionAdded: '0.89'
2413
+ # These codes are `eval`-ed in method and their return values may be used.
2414
+ Exclude:
2415
+ - '**/*.jb'
2241
2416
 
2242
2417
  Lint/TrailingCommaInAttributeDeclaration:
2243
2418
  Description: 'Checks for trailing commas in attribute declarations.'
2244
2419
  Enabled: true
2420
+ AutoCorrect: contextual
2245
2421
  VersionAdded: '0.90'
2422
+ VersionChanged: '1.61'
2246
2423
 
2247
2424
  Lint/TripleQuotes:
2248
2425
  Description: 'Checks for useless triple quote constructs.'
@@ -2297,14 +2474,14 @@ Lint/UnreachableLoop:
2297
2474
  # RSpec uses `times` in its message expectations
2298
2475
  # eg. `exactly(2).times`
2299
2476
  - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2300
- IgnoredPatterns: [] # deprecated
2301
2477
 
2302
2478
  Lint/UnusedBlockArgument:
2303
2479
  Description: 'Checks for unused block arguments.'
2304
2480
  StyleGuide: '#underscore-unused-vars'
2305
2481
  Enabled: true
2482
+ AutoCorrect: contextual
2306
2483
  VersionAdded: '0.21'
2307
- VersionChanged: '0.22'
2484
+ VersionChanged: '1.61'
2308
2485
  IgnoreEmptyBlocks: true
2309
2486
  AllowUnusedKeywordArguments: false
2310
2487
 
@@ -2312,8 +2489,9 @@ Lint/UnusedMethodArgument:
2312
2489
  Description: 'Checks for unused method arguments.'
2313
2490
  StyleGuide: '#underscore-unused-vars'
2314
2491
  Enabled: true
2492
+ AutoCorrect: contextual
2315
2493
  VersionAdded: '0.21'
2316
- VersionChanged: '0.81'
2494
+ VersionChanged: '1.61'
2317
2495
  AllowUnusedKeywordArguments: false
2318
2496
  IgnoreEmptyMethods: true
2319
2497
  IgnoreNotImplementedMethods: true
@@ -2337,8 +2515,9 @@ Lint/UriRegexp:
2337
2515
  Lint/UselessAccessModifier:
2338
2516
  Description: 'Checks for useless access modifiers.'
2339
2517
  Enabled: true
2518
+ AutoCorrect: contextual
2340
2519
  VersionAdded: '0.20'
2341
- VersionChanged: '0.83'
2520
+ VersionChanged: '1.61'
2342
2521
  ContextCreatingMethods: []
2343
2522
  MethodCreatingMethods: []
2344
2523
 
@@ -2346,15 +2525,30 @@ Lint/UselessAssignment:
2346
2525
  Description: 'Checks for useless assignment to a local variable.'
2347
2526
  StyleGuide: '#underscore-unused-vars'
2348
2527
  Enabled: true
2528
+ AutoCorrect: contextual
2349
2529
  VersionAdded: '0.11'
2530
+ VersionChanged: '1.61'
2531
+ SafeAutoCorrect: false
2532
+
2533
+ Lint/UselessElseWithoutRescue:
2534
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2535
+ Enabled: true
2536
+ VersionAdded: '0.17'
2537
+ VersionChanged: '1.31'
2350
2538
 
2351
2539
  Lint/UselessMethodDefinition:
2352
2540
  Description: 'Checks for useless method definitions.'
2353
2541
  Enabled: true
2542
+ AutoCorrect: contextual
2354
2543
  VersionAdded: '0.90'
2355
- VersionChanged: '0.91'
2544
+ VersionChanged: '1.61'
2356
2545
  Safe: false
2357
2546
 
2547
+ Lint/UselessRescue:
2548
+ Description: 'Checks for useless `rescue`s.'
2549
+ Enabled: pending
2550
+ VersionAdded: '1.43'
2551
+
2358
2552
  Lint/UselessRuby2Keywords:
2359
2553
  Description: 'Finds unnecessary uses of `ruby2_keywords`.'
2360
2554
  Enabled: pending
@@ -2363,21 +2557,24 @@ Lint/UselessRuby2Keywords:
2363
2557
  Lint/UselessSetterCall:
2364
2558
  Description: 'Checks for useless setter call to a local variable.'
2365
2559
  Enabled: true
2366
- SafeAutoCorrect: false
2560
+ Safe: false
2367
2561
  VersionAdded: '0.13'
2368
2562
  VersionChanged: '1.2'
2369
- Safe: false
2370
2563
 
2371
2564
  Lint/UselessTimes:
2372
2565
  Description: 'Checks for useless `Integer#times` calls.'
2373
2566
  Enabled: true
2374
- VersionAdded: '0.91'
2375
2567
  Safe: false
2568
+ AutoCorrect: contextual
2569
+ VersionAdded: '0.91'
2570
+ VersionChanged: '1.61'
2376
2571
 
2377
2572
  Lint/Void:
2378
2573
  Description: 'Possible use of operator/literal/variable in void context.'
2379
2574
  Enabled: true
2575
+ AutoCorrect: contextual
2380
2576
  VersionAdded: '0.9'
2577
+ VersionChanged: '1.61'
2381
2578
  CheckForMethodsWithNoSideEffects: false
2382
2579
 
2383
2580
  #################### Metrics ###############################
@@ -2394,7 +2591,8 @@ Metrics/AbcSize:
2394
2591
  VersionChanged: '1.5'
2395
2592
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2396
2593
  # a Float.
2397
- IgnoredMethods: []
2594
+ AllowedMethods: []
2595
+ AllowedPatterns: []
2398
2596
  CountRepeatedAttributes: true
2399
2597
  Max: 17
2400
2598
 
@@ -2406,11 +2604,11 @@ Metrics/BlockLength:
2406
2604
  CountComments: false # count full line comments?
2407
2605
  Max: 25
2408
2606
  CountAsOne: []
2409
- ExcludedMethods: [] # deprecated, retained for backwards compatibility
2410
- IgnoredMethods:
2607
+ AllowedMethods:
2411
2608
  # By default, exclude the `#refine` method, as it tends to have larger
2412
2609
  # associated blocks.
2413
2610
  - refine
2611
+ AllowedPatterns: []
2414
2612
  Exclude:
2415
2613
  - '**/*.gemspec'
2416
2614
 
@@ -2432,6 +2630,12 @@ Metrics/ClassLength:
2432
2630
  Max: 100
2433
2631
  CountAsOne: []
2434
2632
 
2633
+ Metrics/CollectionLiteralLength:
2634
+ Description: 'Checks for `Array` or `Hash` literals with many entries.'
2635
+ Enabled: pending
2636
+ VersionAdded: '1.47'
2637
+ LengthThreshold: 250
2638
+
2435
2639
  # Avoid complex methods.
2436
2640
  Metrics/CyclomaticComplexity:
2437
2641
  Description: >-
@@ -2440,7 +2644,8 @@ Metrics/CyclomaticComplexity:
2440
2644
  Enabled: true
2441
2645
  VersionAdded: '0.25'
2442
2646
  VersionChanged: '0.81'
2443
- IgnoredMethods: []
2647
+ AllowedMethods: []
2648
+ AllowedPatterns: []
2444
2649
  Max: 7
2445
2650
 
2446
2651
  Metrics/MethodLength:
@@ -2452,8 +2657,8 @@ Metrics/MethodLength:
2452
2657
  CountComments: false # count full line comments?
2453
2658
  Max: 10
2454
2659
  CountAsOne: []
2455
- ExcludedMethods: [] # deprecated, retained for backwards compatibility
2456
- IgnoredMethods: []
2660
+ AllowedMethods: []
2661
+ AllowedPatterns: []
2457
2662
 
2458
2663
  Metrics/ModuleLength:
2459
2664
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2481,7 +2686,8 @@ Metrics/PerceivedComplexity:
2481
2686
  Enabled: true
2482
2687
  VersionAdded: '0.25'
2483
2688
  VersionChanged: '0.81'
2484
- IgnoredMethods: []
2689
+ AllowedMethods: []
2690
+ AllowedPatterns: []
2485
2691
  Max: 8
2486
2692
 
2487
2693
  ################## Migration #############################
@@ -2567,7 +2773,8 @@ Naming/FileName:
2567
2773
  VersionChanged: '1.23'
2568
2774
  # Camel case file names listed in `AllCops:Include` and all file names listed
2569
2775
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2570
- Exclude: []
2776
+ Exclude:
2777
+ - Rakefile.rb
2571
2778
  # When `true`, requires that each source file should define a class or module
2572
2779
  # with a name which matches the file name (converted to ... case).
2573
2780
  # It further expects it to be nested inside modules which match the names
@@ -2652,13 +2859,13 @@ Naming/HeredocDelimiterNaming:
2652
2859
  Enabled: true
2653
2860
  VersionAdded: '0.50'
2654
2861
  ForbiddenDelimiters:
2655
- - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2862
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/i'
2656
2863
 
2657
2864
  Naming/InclusiveLanguage:
2658
2865
  Description: 'Recommend the use of inclusive language instead of problematic terms.'
2659
2866
  Enabled: false
2660
2867
  VersionAdded: '1.18'
2661
- VersionChanged: '1.21'
2868
+ VersionChanged: '1.49'
2662
2869
  CheckIdentifiers: true
2663
2870
  CheckConstants: true
2664
2871
  CheckVariables: true
@@ -2710,7 +2917,6 @@ Naming/MethodName:
2710
2917
  # - '\A\s*onSelectionCleared\s*'
2711
2918
  #
2712
2919
  AllowedPatterns: []
2713
- IgnoredPatterns: [] # deprecated
2714
2920
 
2715
2921
  Naming/MethodParameterName:
2716
2922
  Description: >-
@@ -2724,10 +2930,13 @@ Naming/MethodParameterName:
2724
2930
  AllowNamesEndingInNumbers: true
2725
2931
  # Allowed names that will not register an offense
2726
2932
  AllowedNames:
2933
+ - as
2727
2934
  - at
2728
2935
  - by
2936
+ - cc
2729
2937
  - db
2730
2938
  - id
2939
+ - if
2731
2940
  - in
2732
2941
  - io
2733
2942
  - ip
@@ -2808,6 +3017,7 @@ Naming/VariableNumber:
2808
3017
  - rfc822 # Time#rfc822
2809
3018
  - rfc2822 # Time#rfc2822
2810
3019
  - rfc3339 # DateTime.rfc3339
3020
+ - x86_64 # Allowed by default as an underscore separated CPU architecture name
2811
3021
  AllowedPatterns: []
2812
3022
 
2813
3023
  #################### Security ##############################
@@ -2815,7 +3025,9 @@ Naming/VariableNumber:
2815
3025
  Security/CompoundHash:
2816
3026
  Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
2817
3027
  Enabled: pending
3028
+ Safe: false
2818
3029
  VersionAdded: '1.28'
3030
+ VersionChanged: '1.51'
2819
3031
 
2820
3032
  Security/Eval:
2821
3033
  Description: 'The use of eval represents a serious security risk.'
@@ -2878,6 +3090,8 @@ Style/AccessModifierDeclarations:
2878
3090
  - inline
2879
3091
  - group
2880
3092
  AllowModifiersOnSymbols: true
3093
+ AllowModifiersOnAttrs: true
3094
+ SafeAutoCorrect: false
2881
3095
 
2882
3096
  Style/AccessorGrouping:
2883
3097
  Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
@@ -2920,7 +3134,20 @@ Style/ArgumentsForwarding:
2920
3134
  StyleGuide: '#arguments-forwarding'
2921
3135
  Enabled: pending
2922
3136
  AllowOnlyRestArgument: true
3137
+ UseAnonymousForwarding: true
3138
+ RedundantRestArgumentNames:
3139
+ - args
3140
+ - arguments
3141
+ RedundantKeywordRestArgumentNames:
3142
+ - kwargs
3143
+ - options
3144
+ - opts
3145
+ RedundantBlockArgumentNames:
3146
+ - blk
3147
+ - block
3148
+ - proc
2923
3149
  VersionAdded: '1.1'
3150
+ VersionChanged: '1.58'
2924
3151
 
2925
3152
  Style/ArrayCoercion:
2926
3153
  Description: >-
@@ -2931,6 +3158,19 @@ Style/ArrayCoercion:
2931
3158
  Enabled: false
2932
3159
  VersionAdded: '0.88'
2933
3160
 
3161
+ Style/ArrayFirstLast:
3162
+ Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3163
+ Reference: '#first-and-last'
3164
+ Enabled: false
3165
+ VersionAdded: '1.58'
3166
+ Safe: false
3167
+
3168
+ Style/ArrayIntersect:
3169
+ Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
3170
+ Enabled: 'pending'
3171
+ Safe: false
3172
+ VersionAdded: '1.40'
3173
+
2934
3174
  Style/ArrayJoin:
2935
3175
  Description: 'Use Array#join instead of Array#*.'
2936
3176
  StyleGuide: '#array-join'
@@ -3012,7 +3252,7 @@ Style/BlockDelimiters:
3012
3252
  # This looks at the usage of a block's method to determine its type (e.g. is
3013
3253
  # the result of a `map` assigned to a variable or passed to another
3014
3254
  # method) but exceptions are permitted in the `ProceduralMethods`,
3015
- # `FunctionalMethods` and `IgnoredMethods` sections below.
3255
+ # `FunctionalMethods` and `AllowedMethods` sections below.
3016
3256
  - semantic
3017
3257
  # The `braces_for_chaining` style enforces braces around single line blocks
3018
3258
  # and do..end around multi-line blocks, except for multi-line blocks whose
@@ -3053,7 +3293,7 @@ Style/BlockDelimiters:
3053
3293
  - let!
3054
3294
  - subject
3055
3295
  - watch
3056
- IgnoredMethods:
3296
+ AllowedMethods:
3057
3297
  # Methods that can be either procedural or functional and cannot be
3058
3298
  # categorised from their usage alone, e.g.
3059
3299
  #
@@ -3070,6 +3310,7 @@ Style/BlockDelimiters:
3070
3310
  - lambda
3071
3311
  - proc
3072
3312
  - it
3313
+ AllowedPatterns: []
3073
3314
  # The AllowBracesOnProceduralOneLiners option is ignored unless the
3074
3315
  # EnforcedStyle is set to `semantic`. If so:
3075
3316
  #
@@ -3093,7 +3334,7 @@ Style/BlockDelimiters:
3093
3334
  # collection.each do |element| puts element end
3094
3335
  AllowBracesOnProceduralOneLiners: false
3095
3336
  # The BracesRequiredMethods overrides all other configurations except
3096
- # IgnoredMethods. It can be used to enforce that all blocks for specific
3337
+ # AllowedMethods. It can be used to enforce that all blocks for specific
3097
3338
  # methods use braces. For example, you can use this to enforce Sorbet
3098
3339
  # signatures use braces even when the rest of your codebase enforces
3099
3340
  # the `line_count_based` style.
@@ -3114,6 +3355,15 @@ Style/CaseEquality:
3114
3355
  # # good
3115
3356
  # String === "string"
3116
3357
  AllowOnConstant: false
3358
+ # If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
3359
+ # the case equality operator is `self.class`.
3360
+ #
3361
+ # # bad
3362
+ # some_class === object
3363
+ #
3364
+ # # good
3365
+ # self.class === object
3366
+ AllowOnSelfClass: false
3117
3367
 
3118
3368
  Style/CaseLikeIf:
3119
3369
  Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
@@ -3121,6 +3371,9 @@ Style/CaseLikeIf:
3121
3371
  Enabled: true
3122
3372
  Safe: false
3123
3373
  VersionAdded: '0.88'
3374
+ VersionChanged: '1.48'
3375
+ # `MinBranchesCount` defines the number of branches `if` needs to have to trigger this cop.
3376
+ MinBranchesCount: 3
3124
3377
 
3125
3378
  Style/CharacterLiteral:
3126
3379
  Description: 'Checks for uses of character literals.'
@@ -3133,7 +3386,7 @@ Style/ClassAndModuleChildren:
3133
3386
  StyleGuide: '#namespace-definition'
3134
3387
  # Moving from compact to nested children requires knowledge of whether the
3135
3388
  # outer parent is a module or a class. Moving from nested to compact requires
3136
- # verification that the outer parent is defined elsewhere. Rubocop does not
3389
+ # verification that the outer parent is defined elsewhere. RuboCop does not
3137
3390
  # have the knowledge to perform either operation safely and thus requires
3138
3391
  # manual oversight.
3139
3392
  SafeAutoCorrect: false
@@ -3172,11 +3425,14 @@ Style/ClassEqualityComparison:
3172
3425
  Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3173
3426
  StyleGuide: '#instance-of-vs-class-comparison'
3174
3427
  Enabled: true
3428
+ SafeAutoCorrect: false
3175
3429
  VersionAdded: '0.93'
3176
- IgnoredMethods:
3430
+ VersionChanged: '1.57'
3431
+ AllowedMethods:
3177
3432
  - ==
3178
3433
  - equal?
3179
3434
  - eql?
3435
+ AllowedPatterns: []
3180
3436
 
3181
3437
  Style/ClassMethods:
3182
3438
  Description: 'Use self when defining module/class methods.'
@@ -3207,6 +3463,7 @@ Style/CollectionCompact:
3207
3463
  Safe: false
3208
3464
  VersionAdded: '1.2'
3209
3465
  VersionChanged: '1.3'
3466
+ AllowedReceivers: []
3210
3467
 
3211
3468
  # Align with the style guide.
3212
3469
  Style/CollectionMethods:
@@ -3225,6 +3482,7 @@ Style/CollectionMethods:
3225
3482
  PreferredMethods:
3226
3483
  collect: 'map'
3227
3484
  collect!: 'map!'
3485
+ collect_concat: 'flat_map'
3228
3486
  inject: 'reduce'
3229
3487
  detect: 'find'
3230
3488
  find_all: 'select'
@@ -3297,6 +3555,17 @@ Style/CommentedKeyword:
3297
3555
  VersionAdded: '0.51'
3298
3556
  VersionChanged: '1.19'
3299
3557
 
3558
+ Style/ComparableClamp:
3559
+ Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3560
+ Enabled: pending
3561
+ VersionAdded: '1.44'
3562
+
3563
+ Style/ConcatArrayLiterals:
3564
+ Description: 'Enforces the use of `Array#push(item)` instead of `Array#concat([item])` to avoid redundant array literals.'
3565
+ Enabled: pending
3566
+ Safe: false
3567
+ VersionAdded: '1.41'
3568
+
3300
3569
  Style/ConditionalAssignment:
3301
3570
  Description: >-
3302
3571
  Use the return value of `if` and `case` statements for
@@ -3352,9 +3621,17 @@ Style/Copyright:
3352
3621
  Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
3353
3622
  AutocorrectNotice: ''
3354
3623
 
3624
+ Style/DataInheritance:
3625
+ Description: 'Checks for inheritance from Data.define.'
3626
+ StyleGuide: '#no-extend-data-define'
3627
+ Enabled: pending
3628
+ SafeAutoCorrect: false
3629
+ VersionAdded: '1.49'
3630
+ VersionChanged: '1.51'
3631
+
3355
3632
  Style/DateTime:
3356
3633
  Description: 'Use Time over DateTime.'
3357
- StyleGuide: '#date--time'
3634
+ StyleGuide: '#date-time'
3358
3635
  Enabled: false
3359
3636
  VersionAdded: '0.51'
3360
3637
  VersionChanged: '0.92'
@@ -3375,6 +3652,12 @@ Style/Dir:
3375
3652
  Enabled: true
3376
3653
  VersionAdded: '0.50'
3377
3654
 
3655
+ Style/DirEmpty:
3656
+ Description: >-
3657
+ Prefer to use `Dir.empty?('path/to/dir')` when checking if a directory is empty.
3658
+ Enabled: pending
3659
+ VersionAdded: '1.48'
3660
+
3378
3661
  Style/DisableCopsWithinSourceCodeDirective:
3379
3662
  Description: >-
3380
3663
  Forbids disabling/enabling cops within source code.
@@ -3405,6 +3688,7 @@ Style/DocumentationMethod:
3405
3688
  Description: 'Checks for missing documentation comment for public methods.'
3406
3689
  Enabled: false
3407
3690
  VersionAdded: '0.43'
3691
+ AllowedMethods: []
3408
3692
  Exclude:
3409
3693
  - 'spec/**/*'
3410
3694
  - 'test/**/*'
@@ -3453,8 +3737,9 @@ Style/EmptyCaseCondition:
3453
3737
  Style/EmptyElse:
3454
3738
  Description: 'Avoid empty else-clauses.'
3455
3739
  Enabled: true
3740
+ AutoCorrect: contextual
3456
3741
  VersionAdded: '0.28'
3457
- VersionChanged: '0.32'
3742
+ VersionChanged: '1.61'
3458
3743
  EnforcedStyle: both
3459
3744
  # empty - warn only on empty `else`
3460
3745
  # nil - warn on `else` with nil in it
@@ -3463,6 +3748,14 @@ Style/EmptyElse:
3463
3748
  - empty
3464
3749
  - nil
3465
3750
  - both
3751
+ AllowComments: false
3752
+
3753
+ Style/EmptyHeredoc:
3754
+ Description: 'Checks for using empty heredoc to reduce redundancy.'
3755
+ Enabled: pending
3756
+ AutoCorrect: contextual
3757
+ VersionAdded: '1.32'
3758
+ VersionChanged: '1.61'
3466
3759
 
3467
3760
  Style/EmptyLambdaParameter:
3468
3761
  Description: 'Omit parens for empty lambda parameters.'
@@ -3480,7 +3773,9 @@ Style/EmptyMethod:
3480
3773
  Description: 'Checks the formatting of empty method definitions.'
3481
3774
  StyleGuide: '#no-single-line-methods'
3482
3775
  Enabled: true
3776
+ AutoCorrect: contextual
3483
3777
  VersionAdded: '0.46'
3778
+ VersionChanged: '1.61'
3484
3779
  EnforcedStyle: compact
3485
3780
  SupportedStyles:
3486
3781
  - compact
@@ -3529,6 +3824,11 @@ Style/EvenOdd:
3529
3824
  VersionAdded: '0.12'
3530
3825
  VersionChanged: '0.29'
3531
3826
 
3827
+ Style/ExactRegexpMatch:
3828
+ Description: 'Checks for exact regexp match inside Regexp literals.'
3829
+ Enabled: pending
3830
+ VersionAdded: '1.51'
3831
+
3532
3832
  Style/ExpandPathArguments:
3533
3833
  Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3534
3834
  Enabled: true
@@ -3564,6 +3864,13 @@ Style/FetchEnvVar:
3564
3864
  # Environment variables to be excluded from the inspection.
3565
3865
  AllowedVars: []
3566
3866
 
3867
+ Style/FileEmpty:
3868
+ Description: >-
3869
+ Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
3870
+ Enabled: pending
3871
+ Safe: false
3872
+ VersionAdded: '1.48'
3873
+
3567
3874
  Style/FileRead:
3568
3875
  Description: 'Favor `File.(bin)read` convenience methods.'
3569
3876
  StyleGuide: '#file-read'
@@ -3632,7 +3939,8 @@ Style/FormatStringToken:
3632
3939
  MaxUnannotatedPlaceholdersAllowed: 1
3633
3940
  VersionAdded: '0.49'
3634
3941
  VersionChanged: '1.0'
3635
- IgnoredMethods: []
3942
+ AllowedMethods: []
3943
+ AllowedPatterns: []
3636
3944
 
3637
3945
  Style/FrozenStringLiteralComment:
3638
3946
  Description: >-
@@ -3677,7 +3985,7 @@ Style/GuardClause:
3677
3985
  StyleGuide: '#no-nested-conditionals'
3678
3986
  Enabled: true
3679
3987
  VersionAdded: '0.20'
3680
- VersionChanged: '1.28'
3988
+ VersionChanged: '1.31'
3681
3989
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3682
3990
  # needs to have to trigger this cop
3683
3991
  MinBodyLength: 1
@@ -3699,8 +4007,9 @@ Style/HashConversion:
3699
4007
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3700
4008
  StyleGuide: '#avoid-hash-constructor'
3701
4009
  Enabled: pending
4010
+ SafeAutoCorrect: false
3702
4011
  VersionAdded: '1.10'
3703
- VersionChanged: '1.11'
4012
+ VersionChanged: '1.55'
3704
4013
  AllowSplatArgument: true
3705
4014
 
3706
4015
  Style/HashEachMethods:
@@ -3710,14 +4019,17 @@ Style/HashEachMethods:
3710
4019
  Safe: false
3711
4020
  VersionAdded: '0.80'
3712
4021
  VersionChanged: '1.16'
3713
- AllowedReceivers: []
4022
+ AllowedReceivers:
4023
+ - Thread.current
3714
4024
 
3715
4025
  Style/HashExcept:
3716
4026
  Description: >-
3717
4027
  Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3718
4028
  that can be replaced with `Hash#except` method.
3719
4029
  Enabled: pending
4030
+ Safe: false
3720
4031
  VersionAdded: '1.7'
4032
+ VersionChanged: '1.39'
3721
4033
 
3722
4034
  Style/HashLikeCase:
3723
4035
  Description: >-
@@ -3756,6 +4068,10 @@ Style/HashSyntax:
3756
4068
  - never
3757
4069
  # accepts both shorthand and explicit use of hash literal value.
3758
4070
  - either
4071
+ # forces use of the 3.1 syntax only if all values can be omitted in the hash.
4072
+ - consistent
4073
+ # allow either (implicit or explicit) syntax but enforce consistency within a single hash
4074
+ - either_consistent
3759
4075
  # Force hashes that have a symbol value to use hash rockets
3760
4076
  UseHashRocketsWithSymbolValues: false
3761
4077
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3868,16 +4184,35 @@ Style/InverseMethods:
3868
4184
  :=~: :!~
3869
4185
  :<: :>=
3870
4186
  :>: :<=
3871
- # `ActiveSupport` defines some common inverse methods. They are listed below,
3872
- # and not enabled by default.
3873
- # :present?: :blank?,
3874
- # :include?: :exclude?
3875
4187
  # `InverseBlocks` are methods that are inverted by inverting the return
3876
4188
  # of the block that is passed to the method
3877
4189
  InverseBlocks:
3878
4190
  :select: :reject
3879
4191
  :select!: :reject!
3880
4192
 
4193
+ Style/InvertibleUnlessCondition:
4194
+ Description: 'Favor `if` with inverted condition over `unless`.'
4195
+ Enabled: false
4196
+ Safe: false
4197
+ VersionAdded: '1.44'
4198
+ VersionChanged: '1.50'
4199
+ # `InverseMethods` are methods that can be inverted in a `unless` condition.
4200
+ # The relationship of inverse methods needs to be defined in both directions.
4201
+ # Keys and values both need to be defined as symbols.
4202
+ InverseMethods:
4203
+ :!=: :==
4204
+ :>: :<=
4205
+ :<=: :>
4206
+ :<: :>=
4207
+ :>=: :<
4208
+ :!~: :=~
4209
+ :zero?: :nonzero?
4210
+ :nonzero?: :zero?
4211
+ :any?: :none?
4212
+ :none?: :any?
4213
+ :even?: :odd?
4214
+ :odd?: :even?
4215
+
3881
4216
  Style/IpAddresses:
3882
4217
  Description: "Don't include literal IP addresses in code."
3883
4218
  Enabled: false
@@ -3932,17 +4267,50 @@ Style/LineEndConcatenation:
3932
4267
  VersionAdded: '0.18'
3933
4268
  VersionChanged: '0.64'
3934
4269
 
4270
+ Style/MagicCommentFormat:
4271
+ Description: 'Use a consistent style for magic comments.'
4272
+ Enabled: pending
4273
+ VersionAdded: '1.35'
4274
+ EnforcedStyle: snake_case
4275
+ SupportedStyles:
4276
+ # `snake` will enforce the magic comment is written
4277
+ # in snake case (words separated by underscores).
4278
+ # Eg: froze_string_literal: true
4279
+ - snake_case
4280
+ # `kebab` will enforce the magic comment is written
4281
+ # in kebab case (words separated by hyphens).
4282
+ # Eg: froze-string-literal: true
4283
+ - kebab_case
4284
+ DirectiveCapitalization: lowercase
4285
+ ValueCapitalization: ~
4286
+ SupportedCapitalizations:
4287
+ - lowercase
4288
+ - uppercase
4289
+
3935
4290
  Style/MapCompactWithConditionalBlock:
3936
4291
  Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
3937
4292
  Enabled: pending
3938
4293
  VersionAdded: '1.30'
3939
4294
 
4295
+ Style/MapIntoArray:
4296
+ Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
4297
+ StyleGuide: '#functional-code'
4298
+ Enabled: pending
4299
+ VersionAdded: '1.63'
4300
+ Safe: false
4301
+
3940
4302
  Style/MapToHash:
3941
4303
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
3942
4304
  Enabled: pending
3943
4305
  VersionAdded: '1.24'
3944
4306
  Safe: false
3945
4307
 
4308
+ Style/MapToSet:
4309
+ Description: 'Prefer `to_set` with a block over `map.to_set`.'
4310
+ Enabled: pending
4311
+ Safe: false
4312
+ VersionAdded: '1.42'
4313
+
3946
4314
  Style/MethodCallWithArgsParentheses:
3947
4315
  Description: 'Use parentheses for method calls with arguments.'
3948
4316
  StyleGuide: '#method-invocation-parens'
@@ -3950,9 +4318,8 @@ Style/MethodCallWithArgsParentheses:
3950
4318
  VersionAdded: '0.47'
3951
4319
  VersionChanged: '1.7'
3952
4320
  IgnoreMacros: true
3953
- IgnoredMethods: []
4321
+ AllowedMethods: []
3954
4322
  AllowedPatterns: []
3955
- IgnoredPatterns: [] # deprecated
3956
4323
  IncludedMacros: []
3957
4324
  AllowParenthesesInMultilineCall: false
3958
4325
  AllowParenthesesInChaining: false
@@ -3967,7 +4334,8 @@ Style/MethodCallWithoutArgsParentheses:
3967
4334
  Description: 'Do not use parentheses for method calls with no arguments.'
3968
4335
  StyleGuide: '#method-invocation-parens'
3969
4336
  Enabled: true
3970
- IgnoredMethods: []
4337
+ AllowedMethods: []
4338
+ AllowedPatterns: []
3971
4339
  VersionAdded: '0.47'
3972
4340
  VersionChanged: '0.55'
3973
4341
 
@@ -3998,6 +4366,12 @@ Style/MinMax:
3998
4366
  Enabled: true
3999
4367
  VersionAdded: '0.50'
4000
4368
 
4369
+ Style/MinMaxComparison:
4370
+ Description: 'Enforces the use of `max` or `min` instead of comparison for greater or less.'
4371
+ Enabled: pending
4372
+ Safe: false
4373
+ VersionAdded: '1.42'
4374
+
4001
4375
  Style/MissingElse:
4002
4376
  Description: >-
4003
4377
  Require if/case expressions to have an else branches.
@@ -4121,6 +4495,7 @@ Style/MultipleComparison:
4121
4495
  VersionAdded: '0.49'
4122
4496
  VersionChanged: '1.1'
4123
4497
  AllowMethodComparison: true
4498
+ ComparisonsThreshold: 2
4124
4499
 
4125
4500
  Style/MutableConstant:
4126
4501
  Description: 'Do not assign mutable objects to constants.'
@@ -4319,17 +4694,17 @@ Style/NumericLiterals:
4319
4694
  Strict: false
4320
4695
  # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4321
4696
  AllowedNumbers: []
4697
+ AllowedPatterns: []
4322
4698
 
4323
4699
  Style/NumericPredicate:
4324
4700
  Description: >-
4325
4701
  Checks for the use of predicate- or comparison methods for
4326
4702
  numeric comparisons.
4327
4703
  StyleGuide: '#predicate-methods'
4328
- Safe: false
4329
4704
  # This will change to a new method call which isn't guaranteed to be on the
4330
4705
  # object. Switching these methods has to be done with knowledge of the types
4331
4706
  # of the variables which rubocop doesn't have.
4332
- SafeAutoCorrect: false
4707
+ Safe: false
4333
4708
  Enabled: true
4334
4709
  VersionAdded: '0.42'
4335
4710
  VersionChanged: '0.59'
@@ -4337,7 +4712,8 @@ Style/NumericPredicate:
4337
4712
  SupportedStyles:
4338
4713
  - predicate
4339
4714
  - comparison
4340
- IgnoredMethods: []
4715
+ AllowedMethods: []
4716
+ AllowedPatterns: []
4341
4717
  # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
4342
4718
  # false positives.
4343
4719
  Exclude:
@@ -4374,10 +4750,19 @@ Style/OpenStructUse:
4374
4750
  - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4375
4751
 
4376
4752
  Enabled: pending
4753
+ Safe: false
4377
4754
  VersionAdded: '1.23'
4755
+ VersionChanged: '1.51'
4756
+
4757
+ Style/OperatorMethodCall:
4758
+ Description: 'Checks for redundant dot before operator method call.'
4759
+ StyleGuide: '#operator-method-call'
4760
+ Enabled: pending
4761
+ VersionAdded: '1.37'
4378
4762
 
4379
4763
  Style/OptionHash:
4380
4764
  Description: "Don't use option hashes when you can use keyword arguments."
4765
+ StyleGuide: '#keyword-arguments-vs-option-hashes'
4381
4766
  Enabled: false
4382
4767
  VersionAdded: '0.33'
4383
4768
  VersionChanged: '0.34'
@@ -4500,8 +4885,9 @@ Style/RaiseArgs:
4500
4885
  Description: 'Checks the arguments passed to raise/fail.'
4501
4886
  StyleGuide: '#exception-class-messages'
4502
4887
  Enabled: true
4888
+ Safe: false
4503
4889
  VersionAdded: '0.14'
4504
- VersionChanged: '1.2'
4890
+ VersionChanged: '1.61'
4505
4891
  EnforcedStyle: exploded
4506
4892
  SupportedStyles:
4507
4893
  - compact # raise Exception.new(msg)
@@ -4521,10 +4907,16 @@ Style/RedundantArgument:
4521
4907
  Enabled: pending
4522
4908
  Safe: false
4523
4909
  VersionAdded: '1.4'
4524
- VersionChanged: '1.7'
4910
+ VersionChanged: '1.55'
4525
4911
  Methods:
4526
4912
  # Array#join
4527
4913
  join: ''
4914
+ # Array#sum
4915
+ sum: 0
4916
+ # Kernel.#exit
4917
+ exit: true
4918
+ # Kernel.#exit!
4919
+ exit!: false
4528
4920
  # String#split
4529
4921
  split: ' '
4530
4922
  # String#chomp
@@ -4532,6 +4924,11 @@ Style/RedundantArgument:
4532
4924
  # String#chomp!
4533
4925
  chomp!: "\n"
4534
4926
 
4927
+ Style/RedundantArrayConstructor:
4928
+ Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
4929
+ Enabled: pending
4930
+ VersionAdded: '1.52'
4931
+
4535
4932
  Style/RedundantAssignment:
4536
4933
  Description: 'Checks for redundant assignment before returning.'
4537
4934
  Enabled: true
@@ -4559,6 +4956,27 @@ Style/RedundantConditional:
4559
4956
  Enabled: true
4560
4957
  VersionAdded: '0.50'
4561
4958
 
4959
+ Style/RedundantConstantBase:
4960
+ Description: Avoid redundant `::` prefix on constant.
4961
+ Enabled: pending
4962
+ VersionAdded: '1.40'
4963
+
4964
+ Style/RedundantCurrentDirectoryInPath:
4965
+ Description: 'Checks for uses a redundant current directory in path.'
4966
+ Enabled: pending
4967
+ VersionAdded: '1.53'
4968
+
4969
+ Style/RedundantDoubleSplatHashBraces:
4970
+ Description: 'Checks for redundant uses of double splat hash braces.'
4971
+ Enabled: pending
4972
+ VersionAdded: '1.41'
4973
+
4974
+ Style/RedundantEach:
4975
+ Description: 'Checks for redundant `each`.'
4976
+ Enabled: pending
4977
+ Safe: false
4978
+ VersionAdded: '1.38'
4979
+
4562
4980
  Style/RedundantException:
4563
4981
  Description: "Checks for an obsolete RuntimeException argument in raise/fail."
4564
4982
  StyleGuide: '#no-explicit-runtimeerror'
@@ -4570,7 +4988,7 @@ Style/RedundantFetchBlock:
4570
4988
  Description: >-
4571
4989
  Use `fetch(key, value)` instead of `fetch(key) { value }`
4572
4990
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4573
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4991
+ Reference: 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4574
4992
  Enabled: true
4575
4993
  Safe: false
4576
4994
  # If enabled, this cop will autocorrect usages of
@@ -4587,19 +5005,34 @@ Style/RedundantFileExtensionInRequire:
4587
5005
  Enabled: true
4588
5006
  VersionAdded: '0.88'
4589
5007
 
5008
+ Style/RedundantFilterChain:
5009
+ Description: >-
5010
+ Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
5011
+ `select`/`filter`/`find_all` and change them to use predicate method instead.
5012
+ Enabled: pending
5013
+ SafeAutoCorrect: false
5014
+ VersionAdded: '1.52'
5015
+ VersionChanged: '1.57'
5016
+
4590
5017
  Style/RedundantFreeze:
4591
5018
  Description: "Checks usages of Object#freeze on immutable objects."
4592
5019
  Enabled: true
4593
5020
  VersionAdded: '0.34'
4594
5021
  VersionChanged: '0.66'
4595
5022
 
5023
+ Style/RedundantHeredocDelimiterQuotes:
5024
+ Description: 'Checks for redundant heredoc delimiter quotes.'
5025
+ Enabled: pending
5026
+ VersionAdded: '1.45'
5027
+
4596
5028
  Style/RedundantInitialize:
4597
5029
  Description: 'Checks for redundant `initialize` methods.'
4598
5030
  Enabled: pending
5031
+ AutoCorrect: contextual
4599
5032
  Safe: false
4600
5033
  AllowComments: true
4601
5034
  VersionAdded: '1.27'
4602
- VersionChanged: '1.28'
5035
+ VersionChanged: '1.61'
4603
5036
 
4604
5037
  Style/RedundantInterpolation:
4605
5038
  Description: 'Checks for strings that are just an interpolated expression.'
@@ -4608,6 +5041,11 @@ Style/RedundantInterpolation:
4608
5041
  VersionAdded: '0.76'
4609
5042
  VersionChanged: '1.30'
4610
5043
 
5044
+ Style/RedundantLineContinuation:
5045
+ Description: 'Check for redundant line continuation.'
5046
+ Enabled: pending
5047
+ VersionAdded: '1.49'
5048
+
4611
5049
  Style/RedundantParentheses:
4612
5050
  Description: "Checks for parentheses that seem not to serve any purpose."
4613
5051
  Enabled: true
@@ -4619,11 +5057,21 @@ Style/RedundantPercentQ:
4619
5057
  Enabled: true
4620
5058
  VersionAdded: '0.76'
4621
5059
 
5060
+ Style/RedundantRegexpArgument:
5061
+ Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
5062
+ Enabled: pending
5063
+ VersionAdded: '1.53'
5064
+
4622
5065
  Style/RedundantRegexpCharacterClass:
4623
5066
  Description: 'Checks for unnecessary single-element Regexp character classes.'
4624
5067
  Enabled: true
4625
5068
  VersionAdded: '0.85'
4626
5069
 
5070
+ Style/RedundantRegexpConstructor:
5071
+ Description: 'Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.'
5072
+ Enabled: pending
5073
+ VersionAdded: '1.52'
5074
+
4627
5075
  Style/RedundantRegexpEscape:
4628
5076
  Description: 'Checks for redundant escapes in Regexps.'
4629
5077
  Enabled: true
@@ -4670,6 +5118,11 @@ Style/RedundantSortBy:
4670
5118
  Enabled: true
4671
5119
  VersionAdded: '0.36'
4672
5120
 
5121
+ Style/RedundantStringEscape:
5122
+ Description: 'Checks for redundant escapes in string literals.'
5123
+ Enabled: pending
5124
+ VersionAdded: '1.37'
5125
+
4673
5126
  Style/RegexpLiteral:
4674
5127
  Description: 'Use / or %r around regular expressions.'
4675
5128
  StyleGuide: '#percent-r'
@@ -4688,6 +5141,12 @@ Style/RegexpLiteral:
4688
5141
  # are found in the regexp string.
4689
5142
  AllowInnerSlashes: false
4690
5143
 
5144
+ Style/RequireOrder:
5145
+ Description: Sort `require` and `require_relative` in alphabetical order.
5146
+ Enabled: false
5147
+ SafeAutoCorrect: false
5148
+ VersionAdded: '1.40'
5149
+
4691
5150
  Style/RescueModifier:
4692
5151
  Description: 'Avoid using rescue in its modifier form.'
4693
5152
  StyleGuide: '#no-rescue-modifiers'
@@ -4715,6 +5174,15 @@ Style/ReturnNil:
4715
5174
  - return_nil
4716
5175
  VersionAdded: '0.50'
4717
5176
 
5177
+ Style/ReturnNilInPredicateMethodDefinition:
5178
+ Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
5179
+ StyleGuide: '#bool-methods-qmark'
5180
+ Enabled: pending
5181
+ SafeAutoCorrect: false
5182
+ AllowedMethods: []
5183
+ AllowedPatterns: []
5184
+ VersionAdded: '1.53'
5185
+
4718
5186
  Style/SafeNavigation:
4719
5187
  Description: >-
4720
5188
  Transforms usages of a method call safeguarded by
@@ -4742,7 +5210,7 @@ Style/Sample:
4742
5210
  Description: >-
4743
5211
  Use `sample` instead of `shuffle.first`,
4744
5212
  `shuffle.last`, and `shuffle[Integer]`.
4745
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5213
+ Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
4746
5214
  Enabled: true
4747
5215
  VersionAdded: '0.30'
4748
5216
 
@@ -4776,6 +5244,13 @@ Style/Send:
4776
5244
  Enabled: false
4777
5245
  VersionAdded: '0.33'
4778
5246
 
5247
+ Style/SendWithLiteralMethodName:
5248
+ Description: 'Detects the use of the `public_send` method with a static method name argument.'
5249
+ Enabled: pending
5250
+ Safe: false
5251
+ AllowSend: true
5252
+ VersionAdded: '1.64'
5253
+
4779
5254
  Style/SignalException:
4780
5255
  Description: 'Checks for proper usage of fail and raise.'
4781
5256
  StyleGuide: '#prefer-raise-over-fail'
@@ -4807,6 +5282,12 @@ Style/SingleLineBlockParams:
4807
5282
  - acc
4808
5283
  - elem
4809
5284
 
5285
+ Style/SingleLineDoEndBlock:
5286
+ Description: 'Checks for single-line `do`...`end` blocks.'
5287
+ StyleGuide: '#single-line-do-end-block'
5288
+ Enabled: pending
5289
+ VersionAdded: '1.57'
5290
+
4810
5291
  Style/SingleLineMethods:
4811
5292
  Description: 'Avoid single-line methods.'
4812
5293
  StyleGuide: '#no-single-line-methods'
@@ -4816,7 +5297,8 @@ Style/SingleLineMethods:
4816
5297
  AllowIfMethodIsEmpty: true
4817
5298
 
4818
5299
  Style/SlicingWithRange:
4819
- Description: 'Checks array slicing is done with endless ranges when suitable.'
5300
+ Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
5301
+ StyleGuide: '#slicing-with-ranges'
4820
5302
  Enabled: true
4821
5303
  VersionAdded: '0.83'
4822
5304
  Safe: false
@@ -4943,6 +5425,17 @@ Style/StructInheritance:
4943
5425
  VersionAdded: '0.29'
4944
5426
  VersionChanged: '1.20'
4945
5427
 
5428
+ Style/SuperArguments:
5429
+ Description: 'Call `super` without arguments and parentheses when the signature is identical.'
5430
+ Enabled: pending
5431
+ VersionAdded: '1.64'
5432
+
5433
+ Style/SuperWithArgsParentheses:
5434
+ Description: 'Use parentheses for `super` with arguments.'
5435
+ StyleGuide: '#super-with-args'
5436
+ Enabled: pending
5437
+ VersionAdded: '1.58'
5438
+
4946
5439
  Style/SwapValues:
4947
5440
  Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
4948
5441
  StyleGuide: '#values-swapping'
@@ -4972,13 +5465,13 @@ Style/SymbolProc:
4972
5465
  Enabled: true
4973
5466
  Safe: false
4974
5467
  VersionAdded: '0.26'
4975
- VersionChanged: '1.28'
5468
+ VersionChanged: '1.64'
4976
5469
  AllowMethodsWithArguments: false
4977
- # A list of method names to be ignored by the check.
5470
+ # A list of method names to be always allowed by the check.
4978
5471
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4979
- IgnoredMethods:
4980
- - respond_to
5472
+ AllowedMethods:
4981
5473
  - define_method
5474
+ AllowedPatterns: []
4982
5475
  AllowComments: false
4983
5476
 
4984
5477
  Style/TernaryParentheses:
@@ -5199,6 +5692,11 @@ Style/WordArray:
5199
5692
  # The regular expression `WordRegex` decides what is considered a word.
5200
5693
  WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
5201
5694
 
5695
+ Style/YAMLFileRead:
5696
+ Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
5697
+ Enabled: pending
5698
+ VersionAdded: '1.53'
5699
+
5202
5700
  Style/YodaCondition:
5203
5701
  Description: 'Forbid or enforce yoda conditions.'
5204
5702
  Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
@@ -5217,6 +5715,19 @@ Style/YodaCondition:
5217
5715
  VersionAdded: '0.49'
5218
5716
  VersionChanged: '0.75'
5219
5717
 
5718
+ Style/YodaExpression:
5719
+ Description: 'Forbid the use of yoda expressions.'
5720
+ Enabled: false
5721
+ Safe: false
5722
+ VersionAdded: '1.42'
5723
+ VersionChanged: '1.43'
5724
+ SupportedOperators:
5725
+ - '*'
5726
+ - '+'
5727
+ - '&'
5728
+ - '|'
5729
+ - '^'
5730
+
5220
5731
  Style/ZeroLengthPredicate:
5221
5732
  Description: 'Use #empty? when testing for objects of length 0.'
5222
5733
  Enabled: true