rubocop 1.24.1 → 1.64.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (742) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +11 -8
  4. data/assets/output.css.erb +159 -0
  5. data/assets/output.html.erb +1 -160
  6. data/config/default.yml +707 -100
  7. data/config/obsoletion.yml +40 -2
  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} +47 -11
  14. data/lib/rubocop/cli/command/execute_runner.rb +15 -10
  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_cops.rb +1 -1
  18. data/lib/rubocop/cli/command/show_docs_url.rb +2 -2
  19. data/lib/rubocop/cli/command/suggest_extensions.rb +62 -17
  20. data/lib/rubocop/cli.rb +72 -12
  21. data/lib/rubocop/comment_config.rb +60 -1
  22. data/lib/rubocop/config.rb +84 -28
  23. data/lib/rubocop/config_finder.rb +78 -0
  24. data/lib/rubocop/config_loader.rb +48 -69
  25. data/lib/rubocop/config_loader_resolver.rb +8 -8
  26. data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
  27. data/lib/rubocop/config_obsoletion/extracted_cop.rb +3 -1
  28. data/lib/rubocop/config_obsoletion/parameter_rule.rb +13 -1
  29. data/lib/rubocop/config_obsoletion.rb +15 -7
  30. data/lib/rubocop/config_validator.rb +34 -10
  31. data/lib/rubocop/cop/autocorrect_logic.rb +44 -15
  32. data/lib/rubocop/cop/badge.rb +15 -4
  33. data/lib/rubocop/cop/base.rb +181 -98
  34. data/lib/rubocop/cop/bundler/duplicated_gem.rb +4 -7
  35. data/lib/rubocop/cop/bundler/duplicated_group.rb +127 -0
  36. data/lib/rubocop/cop/bundler/gem_comment.rb +5 -5
  37. data/lib/rubocop/cop/bundler/gem_filename.rb +5 -5
  38. data/lib/rubocop/cop/bundler/gem_version.rb +5 -7
  39. data/lib/rubocop/cop/bundler/ordered_gems.rb +11 -3
  40. data/lib/rubocop/cop/commissioner.rb +19 -6
  41. data/lib/rubocop/cop/cop.rb +54 -34
  42. data/lib/rubocop/cop/corrector.rb +33 -13
  43. data/lib/rubocop/cop/correctors/alignment_corrector.rb +4 -4
  44. data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -1
  45. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +5 -9
  46. data/lib/rubocop/cop/correctors/empty_line_corrector.rb +1 -1
  47. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +10 -16
  48. data/lib/rubocop/cop/correctors/if_then_corrector.rb +1 -1
  49. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +8 -5
  50. data/lib/rubocop/cop/correctors/line_break_corrector.rb +8 -2
  51. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +26 -10
  52. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +3 -8
  53. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +59 -1
  54. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +3 -3
  55. data/lib/rubocop/cop/correctors/punctuation_corrector.rb +1 -1
  56. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -1
  57. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +1 -1
  58. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +2 -2
  59. data/lib/rubocop/cop/documentation.rb +16 -6
  60. data/lib/rubocop/cop/exclude_limit.rb +1 -1
  61. data/lib/rubocop/cop/force.rb +12 -0
  62. data/lib/rubocop/cop/gemspec/dependency_version.rb +152 -0
  63. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +92 -0
  64. data/lib/rubocop/cop/gemspec/development_dependencies.rb +107 -0
  65. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +5 -12
  66. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +10 -2
  67. data/lib/rubocop/cop/gemspec/require_mfa.rb +25 -24
  68. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +15 -4
  69. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +1 -1
  70. data/lib/rubocop/cop/generator/require_file_injector.rb +3 -3
  71. data/lib/rubocop/cop/generator.rb +12 -13
  72. data/lib/rubocop/cop/internal_affairs/cop_description.rb +122 -0
  73. data/lib/rubocop/cop/internal_affairs/create_empty_file.rb +37 -0
  74. data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +1 -1
  75. data/lib/rubocop/cop/internal_affairs/example_description.rb +46 -24
  76. data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +111 -0
  77. data/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb +1 -1
  78. data/lib/rubocop/cop/internal_affairs/lambda_or_proc.rb +46 -0
  79. data/lib/rubocop/cop/internal_affairs/location_expression.rb +37 -0
  80. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +4 -2
  81. data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +82 -0
  82. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
  83. data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +53 -0
  84. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +128 -38
  85. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
  86. data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
  87. data/lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb +42 -0
  88. data/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb +46 -0
  89. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +1 -1
  90. data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
  91. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +12 -4
  92. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
  93. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
  94. data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +11 -2
  95. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +66 -0
  96. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +62 -0
  97. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -0
  98. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +60 -0
  99. data/lib/rubocop/cop/internal_affairs.rb +14 -0
  100. data/lib/rubocop/cop/layout/argument_alignment.rb +57 -9
  101. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  102. data/lib/rubocop/cop/layout/assignment_indentation.rb +1 -1
  103. data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -1
  104. data/lib/rubocop/cop/layout/block_alignment.rb +17 -13
  105. data/lib/rubocop/cop/layout/block_end_newline.rb +32 -10
  106. data/lib/rubocop/cop/layout/case_indentation.rb +17 -1
  107. data/lib/rubocop/cop/layout/class_structure.rb +44 -27
  108. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +2 -3
  109. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +3 -7
  110. data/lib/rubocop/cop/layout/comment_indentation.rb +6 -4
  111. data/lib/rubocop/cop/layout/condition_position.rb +1 -1
  112. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  113. data/lib/rubocop/cop/layout/dot_position.rb +2 -6
  114. data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
  115. data/lib/rubocop/cop/layout/empty_comment.rb +7 -5
  116. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +42 -9
  117. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
  118. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
  119. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +29 -6
  120. data/lib/rubocop/cop/layout/empty_lines.rb +4 -2
  121. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +7 -2
  122. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
  123. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +25 -4
  124. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
  125. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +7 -5
  126. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +10 -10
  127. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +8 -2
  128. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
  129. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +10 -10
  130. data/lib/rubocop/cop/layout/end_alignment.rb +24 -4
  131. data/lib/rubocop/cop/layout/end_of_line.rb +5 -5
  132. data/lib/rubocop/cop/layout/extra_spacing.rb +13 -10
  133. data/lib/rubocop/cop/layout/first_argument_indentation.rb +43 -32
  134. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +45 -21
  135. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +36 -9
  136. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +52 -13
  137. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +37 -2
  138. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +58 -9
  139. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +53 -20
  140. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
  141. data/lib/rubocop/cop/layout/hash_alignment.rb +8 -1
  142. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +13 -7
  143. data/lib/rubocop/cop/layout/heredoc_indentation.rb +13 -13
  144. data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
  145. data/lib/rubocop/cop/layout/indentation_style.rb +9 -4
  146. data/lib/rubocop/cop/layout/indentation_width.rb +20 -14
  147. data/lib/rubocop/cop/layout/initial_indentation.rb +3 -3
  148. data/lib/rubocop/cop/layout/leading_comment_space.rb +3 -3
  149. data/lib/rubocop/cop/layout/leading_empty_lines.rb +1 -1
  150. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +144 -0
  151. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +140 -0
  152. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +4 -2
  153. data/lib/rubocop/cop/layout/line_length.rb +13 -6
  154. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
  155. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +32 -2
  156. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +2 -2
  157. data/lib/rubocop/cop/layout/multiline_block_layout.rb +5 -3
  158. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +1 -1
  159. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +30 -2
  160. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +40 -3
  161. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
  162. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +40 -8
  163. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
  164. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +77 -0
  165. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +9 -10
  166. data/lib/rubocop/cop/layout/redundant_line_break.rb +39 -18
  167. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +8 -8
  168. data/lib/rubocop/cop/layout/single_line_block_chain.rb +6 -1
  169. data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
  170. data/lib/rubocop/cop/layout/space_after_not.rb +2 -2
  171. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +3 -3
  172. data/lib/rubocop/cop/layout/space_around_keyword.rb +3 -3
  173. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +2 -2
  174. data/lib/rubocop/cop/layout/space_around_operators.rb +54 -22
  175. data/lib/rubocop/cop/layout/space_before_block_braces.rb +24 -13
  176. data/lib/rubocop/cop/layout/space_before_brackets.rb +7 -0
  177. data/lib/rubocop/cop/layout/space_before_comment.rb +1 -1
  178. data/lib/rubocop/cop/layout/space_before_first_arg.rb +2 -2
  179. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +3 -3
  180. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +32 -30
  181. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -0
  182. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +35 -15
  183. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +31 -4
  184. data/lib/rubocop/cop/layout/space_inside_parens.rb +3 -3
  185. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +34 -0
  186. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
  187. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +11 -7
  188. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +7 -7
  189. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +15 -10
  190. data/lib/rubocop/cop/layout/trailing_whitespace.rb +15 -8
  191. data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
  192. data/lib/rubocop/cop/legacy/corrector.rb +1 -1
  193. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -1
  194. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +41 -8
  195. data/lib/rubocop/cop/lint/ambiguous_operator.rb +11 -7
  196. data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +1 -1
  197. data/lib/rubocop/cop/lint/ambiguous_range.rb +5 -5
  198. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +6 -2
  199. data/lib/rubocop/cop/lint/assignment_in_condition.rb +18 -8
  200. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +3 -3
  201. data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
  202. data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
  203. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +51 -0
  204. data/lib/rubocop/cop/lint/constant_resolution.rb +5 -1
  205. data/lib/rubocop/cop/lint/debugger.rb +70 -35
  206. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +67 -111
  207. data/lib/rubocop/cop/lint/deprecated_constants.rb +9 -2
  208. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +1 -1
  209. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +1 -1
  210. data/lib/rubocop/cop/lint/duplicate_branch.rb +1 -3
  211. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
  212. data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +1 -1
  213. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +3 -2
  214. data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
  215. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +122 -0
  216. data/lib/rubocop/cop/lint/duplicate_methods.rb +50 -20
  217. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +56 -12
  218. data/lib/rubocop/cop/lint/duplicate_require.rb +11 -2
  219. data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +1 -1
  220. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  221. data/lib/rubocop/cop/lint/else_layout.rb +6 -10
  222. data/lib/rubocop/cop/lint/empty_block.rb +5 -9
  223. data/lib/rubocop/cop/lint/empty_class.rb +4 -2
  224. data/lib/rubocop/cop/lint/empty_conditional_body.rb +114 -4
  225. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  226. data/lib/rubocop/cop/lint/empty_expression.rb +1 -1
  227. data/lib/rubocop/cop/lint/empty_file.rb +1 -1
  228. data/lib/rubocop/cop/lint/empty_in_pattern.rb +4 -2
  229. data/lib/rubocop/cop/lint/empty_interpolation.rb +2 -2
  230. data/lib/rubocop/cop/lint/empty_when.rb +4 -2
  231. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  232. data/lib/rubocop/cop/lint/erb_new_arguments.rb +37 -31
  233. data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
  234. data/lib/rubocop/cop/lint/float_comparison.rb +11 -1
  235. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  236. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +14 -7
  237. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
  238. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +17 -19
  239. data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
  240. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +2 -2
  241. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +20 -10
  242. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +2 -2
  243. data/lib/rubocop/cop/lint/inherit_exception.rb +28 -28
  244. data/lib/rubocop/cop/lint/interpolation_check.rb +6 -5
  245. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +56 -0
  246. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +11 -4
  247. data/lib/rubocop/cop/lint/literal_as_condition.rb +6 -1
  248. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +85 -0
  249. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +50 -4
  250. data/lib/rubocop/cop/lint/loop.rb +2 -2
  251. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +19 -4
  252. data/lib/rubocop/cop/lint/missing_super.rb +64 -6
  253. data/lib/rubocop/cop/lint/mixed_case_range.rb +116 -0
  254. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
  255. data/lib/rubocop/cop/lint/nested_method_definition.rb +54 -10
  256. data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
  257. data/lib/rubocop/cop/lint/next_without_accumulator.rb +11 -7
  258. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +165 -0
  259. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +20 -10
  260. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
  261. data/lib/rubocop/cop/lint/number_conversion.rb +46 -14
  262. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +3 -3
  263. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +4 -3
  264. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +4 -6
  265. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +17 -2
  266. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +10 -4
  267. data/lib/rubocop/cop/lint/percent_string_array.rb +2 -2
  268. data/lib/rubocop/cop/lint/percent_symbol_array.rb +2 -2
  269. data/lib/rubocop/cop/lint/raise_exception.rb +2 -2
  270. data/lib/rubocop/cop/lint/rand_one.rb +1 -1
  271. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +55 -15
  272. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +8 -8
  273. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +12 -0
  274. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
  275. data/lib/rubocop/cop/lint/redundant_require_statement.rb +57 -7
  276. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +88 -11
  277. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +2 -2
  278. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +35 -15
  279. data/lib/rubocop/cop/lint/redundant_with_index.rb +19 -12
  280. data/lib/rubocop/cop/lint/redundant_with_object.rb +14 -13
  281. data/lib/rubocop/cop/lint/refinement_import_methods.rb +52 -0
  282. data/lib/rubocop/cop/lint/regexp_as_condition.rb +9 -3
  283. data/lib/rubocop/cop/lint/require_parentheses.rb +4 -2
  284. data/lib/rubocop/cop/lint/require_range_parentheses.rb +57 -0
  285. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  286. data/lib/rubocop/cop/lint/rescue_type.rb +2 -4
  287. data/lib/rubocop/cop/lint/return_in_void_context.rb +6 -18
  288. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +54 -12
  289. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +2 -2
  290. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  291. data/lib/rubocop/cop/lint/script_permission.rb +4 -4
  292. data/lib/rubocop/cop/lint/self_assignment.rb +39 -1
  293. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +6 -6
  294. data/lib/rubocop/cop/lint/shadowed_argument.rb +2 -1
  295. data/lib/rubocop/cop/lint/shadowed_exception.rb +22 -23
  296. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +42 -1
  297. data/lib/rubocop/cop/lint/struct_new_override.rb +15 -15
  298. data/lib/rubocop/cop/lint/suppressed_exception.rb +4 -4
  299. data/lib/rubocop/cop/lint/symbol_conversion.rb +12 -6
  300. data/lib/rubocop/cop/lint/syntax.rb +12 -6
  301. data/lib/rubocop/cop/lint/to_enum_arguments.rb +24 -7
  302. data/lib/rubocop/cop/lint/to_json.rb +1 -1
  303. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +24 -10
  304. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +3 -3
  305. data/lib/rubocop/cop/lint/triple_quotes.rb +1 -1
  306. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -1
  307. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +1 -1
  308. data/lib/rubocop/cop/lint/unified_integer.rb +3 -1
  309. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +2 -2
  310. data/lib/rubocop/cop/lint/unreachable_code.rb +5 -3
  311. data/lib/rubocop/cop/lint/unreachable_loop.rb +23 -11
  312. data/lib/rubocop/cop/lint/unused_block_argument.rb +1 -1
  313. data/lib/rubocop/cop/lint/unused_method_argument.rb +8 -3
  314. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
  315. data/lib/rubocop/cop/lint/uri_regexp.rb +1 -1
  316. data/lib/rubocop/cop/lint/useless_access_modifier.rb +20 -15
  317. data/lib/rubocop/cop/lint/useless_assignment.rb +95 -11
  318. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +2 -3
  319. data/lib/rubocop/cop/lint/useless_method_definition.rb +13 -5
  320. data/lib/rubocop/cop/lint/useless_rescue.rb +89 -0
  321. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +16 -6
  322. data/lib/rubocop/cop/lint/useless_setter_call.rb +2 -2
  323. data/lib/rubocop/cop/lint/useless_times.rb +17 -13
  324. data/lib/rubocop/cop/lint/void.rb +126 -25
  325. data/lib/rubocop/cop/metrics/abc_size.rb +8 -6
  326. data/lib/rubocop/cop/metrics/block_length.rb +18 -13
  327. data/lib/rubocop/cop/metrics/block_nesting.rb +3 -3
  328. data/lib/rubocop/cop/metrics/class_length.rb +17 -6
  329. data/lib/rubocop/cop/metrics/collection_literal_length.rb +76 -0
  330. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +2 -2
  331. data/lib/rubocop/cop/metrics/method_length.rb +19 -13
  332. data/lib/rubocop/cop/metrics/module_length.rb +10 -5
  333. data/lib/rubocop/cop/metrics/parameter_lists.rb +28 -1
  334. data/lib/rubocop/cop/metrics/perceived_complexity.rb +2 -2
  335. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +6 -11
  336. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +62 -12
  337. data/lib/rubocop/cop/migration/department_name.rb +3 -3
  338. data/lib/rubocop/cop/mixin/alignment.rb +2 -2
  339. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +2 -2
  340. data/lib/rubocop/cop/mixin/allowed_methods.rb +23 -2
  341. data/lib/rubocop/cop/mixin/allowed_pattern.rb +56 -0
  342. data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
  343. data/lib/rubocop/cop/mixin/annotation_comment.rb +14 -7
  344. data/lib/rubocop/cop/mixin/check_line_breakable.rb +5 -1
  345. data/lib/rubocop/cop/mixin/code_length.rb +12 -1
  346. data/lib/rubocop/cop/mixin/comments_help.rb +51 -3
  347. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +21 -9
  348. data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
  349. data/lib/rubocop/cop/mixin/def_node.rb +3 -8
  350. data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
  351. data/lib/rubocop/cop/mixin/duplication.rb +1 -1
  352. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  353. data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -1
  354. data/lib/rubocop/cop/mixin/first_element_line_break.rb +11 -7
  355. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -0
  356. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +1 -1
  357. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +189 -9
  358. data/lib/rubocop/cop/mixin/hash_transform_method.rb +13 -9
  359. data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
  360. data/lib/rubocop/cop/mixin/line_length_help.rb +28 -8
  361. data/lib/rubocop/cop/mixin/method_complexity.rb +28 -22
  362. data/lib/rubocop/cop/mixin/min_branches_count.rb +40 -0
  363. data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +34 -12
  364. data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +5 -6
  365. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +7 -5
  366. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  367. data/lib/rubocop/cop/mixin/percent_array.rb +58 -1
  368. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  369. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +7 -9
  370. data/lib/rubocop/cop/mixin/preferred_delimiters.rb +2 -2
  371. data/lib/rubocop/cop/mixin/range_help.rb +28 -7
  372. data/lib/rubocop/cop/mixin/require_library.rb +2 -0
  373. data/lib/rubocop/cop/mixin/rescue_node.rb +5 -3
  374. data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
  375. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
  376. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
  377. data/lib/rubocop/cop/mixin/statement_modifier.rb +19 -4
  378. data/lib/rubocop/cop/mixin/string_help.rb +5 -3
  379. data/lib/rubocop/cop/mixin/surrounding_space.rb +17 -13
  380. data/lib/rubocop/cop/mixin/trailing_comma.rb +4 -4
  381. data/lib/rubocop/cop/mixin/visibility_help.rb +40 -5
  382. data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -2
  383. data/lib/rubocop/cop/naming/ascii_identifiers.rb +2 -2
  384. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  385. data/lib/rubocop/cop/naming/block_forwarding.rb +61 -16
  386. data/lib/rubocop/cop/naming/block_parameter_name.rb +2 -2
  387. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +4 -2
  388. data/lib/rubocop/cop/naming/constant_name.rb +5 -6
  389. data/lib/rubocop/cop/naming/file_name.rb +5 -5
  390. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +2 -2
  391. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +4 -2
  392. data/lib/rubocop/cop/naming/inclusive_language.rb +32 -10
  393. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +27 -12
  394. data/lib/rubocop/cop/naming/method_name.rb +9 -9
  395. data/lib/rubocop/cop/naming/method_parameter_name.rb +2 -2
  396. data/lib/rubocop/cop/naming/predicate_name.rb +31 -2
  397. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +13 -5
  398. data/lib/rubocop/cop/naming/variable_name.rb +15 -1
  399. data/lib/rubocop/cop/naming/variable_number.rb +28 -18
  400. data/lib/rubocop/cop/offense.rb +1 -1
  401. data/lib/rubocop/cop/registry.rb +74 -46
  402. data/lib/rubocop/cop/security/compound_hash.rb +106 -0
  403. data/lib/rubocop/cop/security/eval.rb +1 -1
  404. data/lib/rubocop/cop/security/json_load.rb +1 -1
  405. data/lib/rubocop/cop/security/marshal_load.rb +1 -1
  406. data/lib/rubocop/cop/security/open.rb +3 -3
  407. data/lib/rubocop/cop/security/yaml_load.rb +11 -5
  408. data/lib/rubocop/cop/style/access_modifier_declarations.rb +142 -3
  409. data/lib/rubocop/cop/style/accessor_grouping.rb +53 -23
  410. data/lib/rubocop/cop/style/alias.rb +23 -13
  411. data/lib/rubocop/cop/style/and_or.rb +12 -12
  412. data/lib/rubocop/cop/style/arguments_forwarding.rb +414 -62
  413. data/lib/rubocop/cop/style/array_coercion.rb +1 -1
  414. data/lib/rubocop/cop/style/array_first_last.rb +64 -0
  415. data/lib/rubocop/cop/style/array_intersect.rb +119 -0
  416. data/lib/rubocop/cop/style/array_join.rb +1 -1
  417. data/lib/rubocop/cop/style/ascii_comments.rb +2 -2
  418. data/lib/rubocop/cop/style/attr.rb +12 -2
  419. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +22 -15
  420. data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
  421. data/lib/rubocop/cop/style/begin_block.rb +1 -2
  422. data/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb +1 -1
  423. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +4 -4
  424. data/lib/rubocop/cop/style/block_comments.rb +4 -4
  425. data/lib/rubocop/cop/style/block_delimiters.rb +57 -15
  426. data/lib/rubocop/cop/style/case_equality.rb +41 -11
  427. data/lib/rubocop/cop/style/case_like_if.rb +27 -10
  428. data/lib/rubocop/cop/style/character_literal.rb +2 -2
  429. data/lib/rubocop/cop/style/class_and_module_children.rb +10 -17
  430. data/lib/rubocop/cop/style/class_check.rb +2 -1
  431. data/lib/rubocop/cop/style/class_equality_comparison.rb +80 -13
  432. data/lib/rubocop/cop/style/class_methods.rb +1 -1
  433. data/lib/rubocop/cop/style/class_methods_definitions.rb +3 -2
  434. data/lib/rubocop/cop/style/class_vars.rb +4 -4
  435. data/lib/rubocop/cop/style/collection_compact.rb +48 -16
  436. data/lib/rubocop/cop/style/collection_methods.rb +5 -1
  437. data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
  438. data/lib/rubocop/cop/style/colon_method_definition.rb +1 -1
  439. data/lib/rubocop/cop/style/combinable_loops.rb +39 -9
  440. data/lib/rubocop/cop/style/command_literal.rb +2 -2
  441. data/lib/rubocop/cop/style/comment_annotation.rb +2 -2
  442. data/lib/rubocop/cop/style/commented_keyword.rb +10 -7
  443. data/lib/rubocop/cop/style/comparable_clamp.rb +125 -0
  444. data/lib/rubocop/cop/style/concat_array_literals.rb +95 -0
  445. data/lib/rubocop/cop/style/conditional_assignment.rb +17 -21
  446. data/lib/rubocop/cop/style/constant_visibility.rb +1 -1
  447. data/lib/rubocop/cop/style/copyright.rb +37 -24
  448. data/lib/rubocop/cop/style/data_inheritance.rb +75 -0
  449. data/lib/rubocop/cop/style/date_time.rb +7 -6
  450. data/lib/rubocop/cop/style/def_with_parentheses.rb +17 -12
  451. data/lib/rubocop/cop/style/dir.rb +4 -1
  452. data/lib/rubocop/cop/style/dir_empty.rb +54 -0
  453. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +2 -2
  454. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +3 -3
  455. data/lib/rubocop/cop/style/documentation.rb +47 -35
  456. data/lib/rubocop/cop/style/documentation_method.rb +31 -5
  457. data/lib/rubocop/cop/style/double_negation.rb +62 -3
  458. data/lib/rubocop/cop/style/each_for_simple_loop.rb +46 -11
  459. data/lib/rubocop/cop/style/each_with_object.rb +41 -10
  460. data/lib/rubocop/cop/style/empty_block_parameter.rb +3 -3
  461. data/lib/rubocop/cop/style/empty_case_condition.rb +9 -5
  462. data/lib/rubocop/cop/style/empty_else.rb +40 -3
  463. data/lib/rubocop/cop/style/empty_heredoc.rb +73 -0
  464. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +3 -3
  465. data/lib/rubocop/cop/style/empty_literal.rb +3 -3
  466. data/lib/rubocop/cop/style/empty_method.rb +18 -3
  467. data/lib/rubocop/cop/style/encoding.rb +2 -2
  468. data/lib/rubocop/cop/style/end_block.rb +1 -1
  469. data/lib/rubocop/cop/style/endless_method.rb +2 -2
  470. data/lib/rubocop/cop/style/env_home.rb +56 -0
  471. data/lib/rubocop/cop/style/eval_with_location.rb +15 -24
  472. data/lib/rubocop/cop/style/even_odd.rb +1 -1
  473. data/lib/rubocop/cop/style/exact_regexp_match.rb +70 -0
  474. data/lib/rubocop/cop/style/expand_path_arguments.rb +1 -1
  475. data/lib/rubocop/cop/style/explicit_block_argument.rb +9 -5
  476. data/lib/rubocop/cop/style/exponential_notation.rb +1 -1
  477. data/lib/rubocop/cop/style/fetch_env_var.rb +132 -0
  478. data/lib/rubocop/cop/style/file_empty.rb +71 -0
  479. data/lib/rubocop/cop/style/file_read.rb +3 -3
  480. data/lib/rubocop/cop/style/file_write.rb +13 -1
  481. data/lib/rubocop/cop/style/float_division.rb +1 -1
  482. data/lib/rubocop/cop/style/for.rb +10 -2
  483. data/lib/rubocop/cop/style/format_string.rb +34 -13
  484. data/lib/rubocop/cop/style/format_string_token.rb +73 -23
  485. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +10 -5
  486. data/lib/rubocop/cop/style/global_std_stream.rb +1 -1
  487. data/lib/rubocop/cop/style/global_vars.rb +1 -1
  488. data/lib/rubocop/cop/style/guard_clause.rb +187 -25
  489. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +2 -1
  490. data/lib/rubocop/cop/style/hash_conversion.rb +11 -1
  491. data/lib/rubocop/cop/style/hash_each_methods.rb +132 -23
  492. data/lib/rubocop/cop/style/hash_except.rb +102 -10
  493. data/lib/rubocop/cop/style/hash_like_case.rb +4 -10
  494. data/lib/rubocop/cop/style/hash_syntax.rb +66 -6
  495. data/lib/rubocop/cop/style/hash_transform_keys.rb +7 -2
  496. data/lib/rubocop/cop/style/hash_transform_values.rb +5 -2
  497. data/lib/rubocop/cop/style/identical_conditional_branches.rb +51 -7
  498. data/lib/rubocop/cop/style/if_inside_else.rb +6 -0
  499. data/lib/rubocop/cop/style/if_unless_modifier.rb +117 -20
  500. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +37 -8
  501. data/lib/rubocop/cop/style/if_with_semicolon.rb +6 -6
  502. data/lib/rubocop/cop/style/implicit_runtime_error.rb +3 -3
  503. data/lib/rubocop/cop/style/in_pattern_then.rb +1 -1
  504. data/lib/rubocop/cop/style/infinite_loop.rb +2 -5
  505. data/lib/rubocop/cop/style/inline_comment.rb +1 -1
  506. data/lib/rubocop/cop/style/inverse_methods.rb +23 -18
  507. data/lib/rubocop/cop/style/invertible_unless_condition.rb +160 -0
  508. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  509. data/lib/rubocop/cop/style/keyword_parameters_order.rb +2 -2
  510. data/lib/rubocop/cop/style/lambda.rb +4 -4
  511. data/lib/rubocop/cop/style/lambda_call.rb +18 -21
  512. data/lib/rubocop/cop/style/line_end_concatenation.rb +6 -3
  513. data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
  514. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +134 -0
  515. data/lib/rubocop/cop/style/map_into_array.rb +175 -0
  516. data/lib/rubocop/cop/style/map_to_hash.rb +23 -10
  517. data/lib/rubocop/cop/style/map_to_set.rb +64 -0
  518. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +68 -30
  519. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +6 -2
  520. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +54 -49
  521. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +42 -3
  522. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +5 -2
  523. data/lib/rubocop/cop/style/method_def_parentheses.rb +13 -6
  524. data/lib/rubocop/cop/style/min_max.rb +4 -4
  525. data/lib/rubocop/cop/style/min_max_comparison.rb +83 -0
  526. data/lib/rubocop/cop/style/missing_else.rb +37 -25
  527. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +3 -3
  528. data/lib/rubocop/cop/style/mixin_grouping.rb +7 -7
  529. data/lib/rubocop/cop/style/mixin_usage.rb +1 -1
  530. data/lib/rubocop/cop/style/module_function.rb +30 -8
  531. data/lib/rubocop/cop/style/multiline_block_chain.rb +5 -3
  532. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -6
  533. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  534. data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +3 -5
  535. data/lib/rubocop/cop/style/multiline_memoization.rb +3 -3
  536. data/lib/rubocop/cop/style/multiline_method_signature.rb +19 -7
  537. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +54 -11
  538. data/lib/rubocop/cop/style/multiline_when_then.rb +2 -4
  539. data/lib/rubocop/cop/style/multiple_comparison.rb +15 -1
  540. data/lib/rubocop/cop/style/mutable_constant.rb +1 -1
  541. data/lib/rubocop/cop/style/negated_if_else_condition.rb +18 -11
  542. data/lib/rubocop/cop/style/nested_file_dirname.rb +66 -0
  543. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  544. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +11 -2
  545. data/lib/rubocop/cop/style/nested_ternary_operator.rb +19 -15
  546. data/lib/rubocop/cop/style/next.rb +5 -7
  547. data/lib/rubocop/cop/style/nil_comparison.rb +3 -1
  548. data/lib/rubocop/cop/style/nil_lambda.rb +5 -5
  549. data/lib/rubocop/cop/style/non_nil_check.rb +1 -1
  550. data/lib/rubocop/cop/style/not.rb +2 -2
  551. data/lib/rubocop/cop/style/numbered_parameters.rb +1 -1
  552. data/lib/rubocop/cop/style/numbered_parameters_limit.rb +12 -4
  553. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +2 -2
  554. data/lib/rubocop/cop/style/numeric_literals.rb +16 -1
  555. data/lib/rubocop/cop/style/numeric_predicate.rb +63 -13
  556. data/lib/rubocop/cop/style/object_then.rb +76 -0
  557. data/lib/rubocop/cop/style/one_line_conditional.rb +5 -8
  558. data/lib/rubocop/cop/style/open_struct_use.rb +2 -2
  559. data/lib/rubocop/cop/style/operator_method_call.rb +73 -0
  560. data/lib/rubocop/cop/style/option_hash.rb +1 -1
  561. data/lib/rubocop/cop/style/optional_arguments.rb +2 -2
  562. data/lib/rubocop/cop/style/optional_boolean_parameter.rb +5 -4
  563. data/lib/rubocop/cop/style/or_assignment.rb +1 -1
  564. data/lib/rubocop/cop/style/parallel_assignment.rb +32 -24
  565. data/lib/rubocop/cop/style/parentheses_around_condition.rb +9 -1
  566. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +3 -4
  567. data/lib/rubocop/cop/style/percent_q_literals.rb +2 -2
  568. data/lib/rubocop/cop/style/perl_backrefs.rb +23 -2
  569. data/lib/rubocop/cop/style/preferred_hash_methods.rb +2 -2
  570. data/lib/rubocop/cop/style/proc.rb +5 -2
  571. data/lib/rubocop/cop/style/quoted_symbols.rb +2 -2
  572. data/lib/rubocop/cop/style/raise_args.rb +14 -5
  573. data/lib/rubocop/cop/style/random_with_offset.rb +1 -1
  574. data/lib/rubocop/cop/style/redundant_argument.rb +38 -6
  575. data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
  576. data/lib/rubocop/cop/style/redundant_assignment.rb +11 -3
  577. data/lib/rubocop/cop/style/redundant_begin.rb +32 -14
  578. data/lib/rubocop/cop/style/redundant_capital_w.rb +2 -3
  579. data/lib/rubocop/cop/style/redundant_condition.rb +148 -14
  580. data/lib/rubocop/cop/style/redundant_conditional.rb +3 -15
  581. data/lib/rubocop/cop/style/redundant_constant_base.rb +85 -0
  582. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +39 -0
  583. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +133 -0
  584. data/lib/rubocop/cop/style/redundant_each.rb +119 -0
  585. data/lib/rubocop/cop/style/redundant_exception.rb +33 -13
  586. data/lib/rubocop/cop/style/redundant_fetch_block.rb +10 -8
  587. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
  588. data/lib/rubocop/cop/style/redundant_filter_chain.rb +118 -0
  589. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  590. data/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb +58 -0
  591. data/lib/rubocop/cop/style/redundant_initialize.rb +156 -0
  592. data/lib/rubocop/cop/style/redundant_interpolation.rb +24 -3
  593. data/lib/rubocop/cop/style/redundant_line_continuation.rb +200 -0
  594. data/lib/rubocop/cop/style/redundant_parentheses.rb +92 -45
  595. data/lib/rubocop/cop/style/redundant_percent_q.rb +3 -3
  596. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +100 -0
  597. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +15 -4
  598. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
  599. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +24 -6
  600. data/lib/rubocop/cop/style/redundant_return.rb +22 -4
  601. data/lib/rubocop/cop/style/redundant_self.rb +20 -3
  602. data/lib/rubocop/cop/style/redundant_self_assignment.rb +3 -4
  603. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +9 -2
  604. data/lib/rubocop/cop/style/redundant_sort.rb +34 -18
  605. data/lib/rubocop/cop/style/redundant_sort_by.rb +25 -9
  606. data/lib/rubocop/cop/style/redundant_string_escape.rb +185 -0
  607. data/lib/rubocop/cop/style/regexp_literal.rb +11 -2
  608. data/lib/rubocop/cop/style/require_order.rb +139 -0
  609. data/lib/rubocop/cop/style/rescue_modifier.rb +2 -4
  610. data/lib/rubocop/cop/style/rescue_standard_error.rb +15 -15
  611. data/lib/rubocop/cop/style/return_nil.rb +6 -2
  612. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +95 -0
  613. data/lib/rubocop/cop/style/safe_navigation.rb +58 -19
  614. data/lib/rubocop/cop/style/sample.rb +9 -8
  615. data/lib/rubocop/cop/style/select_by_regexp.rb +37 -13
  616. data/lib/rubocop/cop/style/self_assignment.rb +4 -4
  617. data/lib/rubocop/cop/style/semicolon.rb +72 -9
  618. data/lib/rubocop/cop/style/send.rb +5 -5
  619. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +90 -0
  620. data/lib/rubocop/cop/style/signal_exception.rb +10 -8
  621. data/lib/rubocop/cop/style/single_argument_dig.rb +11 -2
  622. data/lib/rubocop/cop/style/single_line_block_params.rb +2 -2
  623. data/lib/rubocop/cop/style/single_line_do_end_block.rb +67 -0
  624. data/lib/rubocop/cop/style/single_line_methods.rb +3 -3
  625. data/lib/rubocop/cop/style/slicing_with_range.rb +77 -11
  626. data/lib/rubocop/cop/style/sole_nested_conditional.rb +103 -33
  627. data/lib/rubocop/cop/style/special_global_vars.rb +66 -10
  628. data/lib/rubocop/cop/style/static_class.rb +33 -2
  629. data/lib/rubocop/cop/style/stderr_puts.rb +2 -2
  630. data/lib/rubocop/cop/style/string_chars.rb +2 -1
  631. data/lib/rubocop/cop/style/string_concatenation.rb +13 -8
  632. data/lib/rubocop/cop/style/string_hash_keys.rb +5 -2
  633. data/lib/rubocop/cop/style/string_literals.rb +1 -5
  634. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
  635. data/lib/rubocop/cop/style/string_methods.rb +1 -1
  636. data/lib/rubocop/cop/style/strip.rb +8 -5
  637. data/lib/rubocop/cop/style/struct_inheritance.rb +5 -5
  638. data/lib/rubocop/cop/style/super_arguments.rb +156 -0
  639. data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
  640. data/lib/rubocop/cop/style/swap_values.rb +4 -2
  641. data/lib/rubocop/cop/style/symbol_array.rb +46 -21
  642. data/lib/rubocop/cop/style/symbol_literal.rb +1 -1
  643. data/lib/rubocop/cop/style/symbol_proc.rb +135 -16
  644. data/lib/rubocop/cop/style/ternary_parentheses.rb +19 -18
  645. data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
  646. data/lib/rubocop/cop/style/trailing_body_on_class.rb +2 -1
  647. data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +1 -1
  648. data/lib/rubocop/cop/style/trailing_body_on_module.rb +1 -1
  649. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +5 -5
  650. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +2 -2
  651. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +2 -2
  652. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +2 -2
  653. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +2 -5
  654. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +2 -2
  655. data/lib/rubocop/cop/style/trivial_accessors.rb +12 -10
  656. data/lib/rubocop/cop/style/unless_else.rb +5 -1
  657. data/lib/rubocop/cop/style/unless_logical_operators.rb +2 -1
  658. data/lib/rubocop/cop/style/unpack_first.rb +15 -15
  659. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
  660. data/lib/rubocop/cop/style/when_then.rb +1 -1
  661. data/lib/rubocop/cop/style/word_array.rb +60 -6
  662. data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
  663. data/lib/rubocop/cop/style/yoda_condition.rb +18 -9
  664. data/lib/rubocop/cop/style/yoda_expression.rb +91 -0
  665. data/lib/rubocop/cop/style/zero_length_predicate.rb +41 -20
  666. data/lib/rubocop/cop/team.rb +70 -58
  667. data/lib/rubocop/cop/util.rb +45 -9
  668. data/lib/rubocop/cop/utils/regexp_ranges.rb +113 -0
  669. data/lib/rubocop/cop/variable_force/assignment.rb +45 -4
  670. data/lib/rubocop/cop/variable_force/branch.rb +1 -1
  671. data/lib/rubocop/cop/variable_force/scope.rb +3 -3
  672. data/lib/rubocop/cop/variable_force/variable.rb +5 -3
  673. data/lib/rubocop/cop/variable_force/variable_table.rb +6 -4
  674. data/lib/rubocop/cop/variable_force.rb +20 -35
  675. data/lib/rubocop/cops_documentation_generator.rb +81 -22
  676. data/lib/rubocop/directive_comment.rb +14 -12
  677. data/lib/rubocop/ext/comment.rb +18 -0
  678. data/lib/rubocop/ext/processed_source.rb +2 -0
  679. data/lib/rubocop/ext/range.rb +15 -0
  680. data/lib/rubocop/ext/regexp_node.rb +10 -5
  681. data/lib/rubocop/ext/regexp_parser.rb +5 -2
  682. data/lib/rubocop/feature_loader.rb +94 -0
  683. data/lib/rubocop/file_finder.rb +4 -7
  684. data/lib/rubocop/file_patterns.rb +43 -0
  685. data/lib/rubocop/formatter/clang_style_formatter.rb +4 -8
  686. data/lib/rubocop/formatter/disabled_config_formatter.rb +66 -17
  687. data/lib/rubocop/formatter/formatter_set.rb +27 -19
  688. data/lib/rubocop/formatter/{git_hub_actions_formatter.rb → github_actions_formatter.rb} +15 -2
  689. data/lib/rubocop/formatter/html_formatter.rb +39 -26
  690. data/lib/rubocop/formatter/json_formatter.rb +0 -1
  691. data/lib/rubocop/formatter/junit_formatter.rb +4 -1
  692. data/lib/rubocop/formatter/markdown_formatter.rb +78 -0
  693. data/lib/rubocop/formatter/offense_count_formatter.rb +25 -6
  694. data/lib/rubocop/formatter/simple_text_formatter.rb +9 -8
  695. data/lib/rubocop/formatter/tap_formatter.rb +4 -8
  696. data/lib/rubocop/formatter/worst_offenders_formatter.rb +6 -4
  697. data/lib/rubocop/formatter.rb +34 -0
  698. data/lib/rubocop/lockfile.rb +56 -7
  699. data/lib/rubocop/lsp/logger.rb +22 -0
  700. data/lib/rubocop/lsp/routes.rb +243 -0
  701. data/lib/rubocop/lsp/runtime.rb +99 -0
  702. data/lib/rubocop/lsp/server.rb +73 -0
  703. data/lib/rubocop/lsp/severity.rb +27 -0
  704. data/lib/rubocop/lsp.rb +36 -0
  705. data/lib/rubocop/magic_comment.rb +43 -15
  706. data/lib/rubocop/options.rb +183 -59
  707. data/lib/rubocop/path_util.rb +54 -22
  708. data/lib/rubocop/rake_task.rb +35 -10
  709. data/lib/rubocop/result_cache.rb +31 -17
  710. data/lib/rubocop/rspec/cop_helper.rb +33 -4
  711. data/lib/rubocop/rspec/expect_offense.rb +21 -11
  712. data/lib/rubocop/rspec/parallel_formatter.rb +1 -1
  713. data/lib/rubocop/rspec/shared_contexts.rb +100 -23
  714. data/lib/rubocop/rspec/support.rb +19 -2
  715. data/lib/rubocop/runner.rb +125 -31
  716. data/lib/rubocop/server/cache.rb +155 -0
  717. data/lib/rubocop/server/cli.rb +147 -0
  718. data/lib/rubocop/server/client_command/base.rb +44 -0
  719. data/lib/rubocop/server/client_command/exec.rb +64 -0
  720. data/lib/rubocop/server/client_command/restart.rb +25 -0
  721. data/lib/rubocop/server/client_command/start.rb +48 -0
  722. data/lib/rubocop/server/client_command/status.rb +28 -0
  723. data/lib/rubocop/server/client_command/stop.rb +31 -0
  724. data/lib/rubocop/server/client_command.rb +26 -0
  725. data/lib/rubocop/server/core.rb +111 -0
  726. data/lib/rubocop/server/errors.rb +23 -0
  727. data/lib/rubocop/server/helper.rb +34 -0
  728. data/lib/rubocop/server/server_command/base.rb +50 -0
  729. data/lib/rubocop/server/server_command/exec.rb +33 -0
  730. data/lib/rubocop/server/server_command/stop.rb +24 -0
  731. data/lib/rubocop/server/server_command.rb +21 -0
  732. data/lib/rubocop/server/socket_reader.rb +69 -0
  733. data/lib/rubocop/server.rb +53 -0
  734. data/lib/rubocop/string_interpreter.rb +7 -7
  735. data/lib/rubocop/target_finder.rb +92 -82
  736. data/lib/rubocop/target_ruby.rb +92 -78
  737. data/lib/rubocop/version.rb +44 -12
  738. data/lib/rubocop.rb +83 -35
  739. metadata +170 -45
  740. data/lib/rubocop/cop/gemspec/date_assignment.rb +0 -49
  741. data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
  742. data/lib/rubocop/cop/mixin/ignored_pattern.rb +0 -29
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.5).
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,17 +262,48 @@ 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.'
265
+ Gemspec/DependencyVersion:
266
+ Description: 'Requires or forbids specifying gem dependency versions.'
267
+ Enabled: false
268
+ VersionAdded: '1.29'
269
+ EnforcedStyle: 'required'
270
+ SupportedStyles:
271
+ - 'required'
272
+ - 'forbidden'
273
+ Include:
274
+ - '**/*.gemspec'
275
+ AllowedGems: []
276
+
277
+ Gemspec/DeprecatedAttributeAssignment:
278
+ Description: Checks that deprecated attribute assignments are not set in a gemspec file.
240
279
  Enabled: pending
241
- VersionAdded: '1.10'
280
+ Severity: warning
281
+ VersionAdded: '1.30'
282
+ VersionChanged: '1.40'
242
283
  Include:
243
284
  - '**/*.gemspec'
244
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: []
296
+ Include:
297
+ - '**/*.gemspec'
298
+ - '**/Gemfile'
299
+ - '**/gems.rb'
300
+
245
301
  Gemspec/DuplicatedAssignment:
246
302
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
247
303
  Enabled: true
304
+ Severity: warning
248
305
  VersionAdded: '0.52'
306
+ VersionChanged: '1.40'
249
307
  Include:
250
308
  - '**/*.gemspec'
251
309
 
@@ -262,9 +320,11 @@ Gemspec/OrderedDependencies:
262
320
  - '**/*.gemspec'
263
321
 
264
322
  Gemspec/RequireMFA:
265
- Description: 'Checks that the gemspec has metadata to require MFA from RubyGems.'
323
+ Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
266
324
  Enabled: pending
325
+ Severity: warning
267
326
  VersionAdded: '1.23'
327
+ VersionChanged: '1.40'
268
328
  Reference:
269
329
  - https://guides.rubygems.org/mfa-requirement-opt-in/
270
330
  Include:
@@ -273,8 +333,9 @@ Gemspec/RequireMFA:
273
333
  Gemspec/RequiredRubyVersion:
274
334
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
275
335
  Enabled: true
336
+ Severity: warning
276
337
  VersionAdded: '0.52'
277
- VersionChanged: '1.22'
338
+ VersionChanged: '1.40'
278
339
  Include:
279
340
  - '**/*.gemspec'
280
341
 
@@ -282,7 +343,9 @@ Gemspec/RubyVersionGlobalsUsage:
282
343
  Description: Checks usage of RUBY_VERSION in gemspec.
283
344
  StyleGuide: '#no-ruby-version-in-the-gemspec'
284
345
  Enabled: true
346
+ Severity: warning
285
347
  VersionAdded: '0.72'
348
+ VersionChanged: '1.40'
286
349
  Include:
287
350
  - '**/*.gemspec'
288
351
 
@@ -365,7 +428,7 @@ Layout/AssignmentIndentation:
365
428
  right-hand-side of a multi-line assignment.
366
429
  Enabled: true
367
430
  VersionAdded: '0.49'
368
- VersionChanged: '0.77'
431
+ VersionChanged: '1.45'
369
432
  # By default the indentation width from `Layout/IndentationWidth` is used,
370
433
  # but it can be overridden by setting this parameter.
371
434
  IndentationWidth: ~
@@ -423,20 +486,22 @@ Layout/ClassStructure:
423
486
  Description: 'Enforces a configured order of definitions within a class body.'
424
487
  StyleGuide: '#consistent-classes'
425
488
  Enabled: false
489
+ SafeAutoCorrect: false
426
490
  VersionAdded: '0.52'
491
+ VersionChanged: '1.53'
427
492
  Categories:
428
493
  module_inclusion:
429
494
  - include
430
495
  - prepend
431
496
  - extend
432
497
  ExpectedOrder:
433
- - module_inclusion
434
- - constants
435
- - public_class_methods
436
- - initializer
437
- - public_methods
438
- - protected_methods
439
- - private_methods
498
+ - module_inclusion
499
+ - constants
500
+ - public_class_methods
501
+ - initializer
502
+ - public_methods
503
+ - protected_methods
504
+ - private_methods
440
505
 
441
506
  Layout/ClosingHeredocIndentation:
442
507
  Description: 'Checks the indentation of here document closings.'
@@ -498,7 +563,9 @@ Layout/ElseAlignment:
498
563
  Layout/EmptyComment:
499
564
  Description: 'Checks empty comment.'
500
565
  Enabled: true
566
+ AutoCorrect: contextual
501
567
  VersionAdded: '0.53'
568
+ VersionChanged: '1.61'
502
569
  AllowBorderComment: true
503
570
  AllowMarginComment: true
504
571
 
@@ -531,6 +598,8 @@ Layout/EmptyLineBetweenDefs:
531
598
  EmptyLineBetweenMethodDefs: true
532
599
  EmptyLineBetweenClassDefs: true
533
600
  EmptyLineBetweenModuleDefs: true
601
+ # `DefLikeMacros` takes the name of any macro that you want to treat like a def.
602
+ DefLikeMacros: []
534
603
  # `AllowAdjacentOneLineDefs` means that single line method definitions don't
535
604
  # need an empty line between them. `true` by default.
536
605
  AllowAdjacentOneLineDefs: true
@@ -734,6 +803,7 @@ Layout/FirstArrayElementLineBreak:
734
803
  multi-line array.
735
804
  Enabled: false
736
805
  VersionAdded: '0.49'
806
+ AllowMultilineFinalElement: false
737
807
 
738
808
  Layout/FirstHashElementIndentation:
739
809
  Description: 'Checks the indentation of the first key in a hash literal.'
@@ -766,6 +836,7 @@ Layout/FirstHashElementLineBreak:
766
836
  multi-line hash.
767
837
  Enabled: false
768
838
  VersionAdded: '0.49'
839
+ AllowMultilineFinalElement: false
769
840
 
770
841
  Layout/FirstMethodArgumentLineBreak:
771
842
  Description: >-
@@ -773,6 +844,7 @@ Layout/FirstMethodArgumentLineBreak:
773
844
  multi-line method call.
774
845
  Enabled: false
775
846
  VersionAdded: '0.49'
847
+ AllowMultilineFinalElement: false
776
848
 
777
849
  Layout/FirstMethodParameterLineBreak:
778
850
  Description: >-
@@ -780,6 +852,7 @@ Layout/FirstMethodParameterLineBreak:
780
852
  multi-line method parameter definition.
781
853
  Enabled: false
782
854
  VersionAdded: '0.49'
855
+ AllowMultilineFinalElement: false
783
856
 
784
857
  Layout/FirstParameterIndentation:
785
858
  Description: >-
@@ -883,7 +956,7 @@ Layout/HeredocArgumentClosingParenthesis:
883
956
  VersionAdded: '0.68'
884
957
 
885
958
  Layout/HeredocIndentation:
886
- Description: 'This cop checks the indentation of the here document bodies.'
959
+ Description: 'Checks the indentation of the here document bodies.'
887
960
  StyleGuide: '#squiggly-heredocs'
888
961
  Enabled: true
889
962
  VersionAdded: '0.49'
@@ -916,7 +989,7 @@ Layout/IndentationStyle:
916
989
  VersionChanged: '0.82'
917
990
  # By default the indentation width from `Layout/IndentationWidth` is used,
918
991
  # but it can be overridden by setting this parameter.
919
- # It is used during auto-correction to determine how many spaces should
992
+ # It is used during autocorrection to determine how many spaces should
920
993
  # replace each tab.
921
994
  IndentationWidth: ~
922
995
  EnforcedStyle: spaces
@@ -931,7 +1004,7 @@ Layout/IndentationWidth:
931
1004
  VersionAdded: '0.49'
932
1005
  # Number of spaces for each indentation level.
933
1006
  Width: 2
934
- IgnoredPatterns: []
1007
+ AllowedPatterns: []
935
1008
 
936
1009
  Layout/InitialIndentation:
937
1010
  Description: >-
@@ -954,6 +1027,27 @@ Layout/LeadingEmptyLines:
954
1027
  VersionAdded: '0.57'
955
1028
  VersionChanged: '0.77'
956
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
+
957
1051
  Layout/LineEndStringConcatenationIndentation:
958
1052
  Description: >-
959
1053
  Checks the indentation of the next line after a line that
@@ -985,10 +1079,10 @@ Layout/LineLength:
985
1079
  # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
986
1080
  # directives like '# rubocop: enable ...' when calculating a line's length.
987
1081
  IgnoreCopDirectives: true
988
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1082
+ # The AllowedPatterns option is a list of !ruby/regexp and/or string
989
1083
  # elements. Strings will be converted to Regexp objects. A line that matches
990
1084
  # any regular expression listed in this option will be ignored by LineLength.
991
- IgnoredPatterns: []
1085
+ AllowedPatterns: []
992
1086
 
993
1087
  Layout/MultilineArrayBraceLayout:
994
1088
  Description: >-
@@ -1012,6 +1106,7 @@ Layout/MultilineArrayLineBreaks:
1012
1106
  starts on a separate line.
1013
1107
  Enabled: false
1014
1108
  VersionAdded: '0.67'
1109
+ AllowMultilineFinalElement: false
1015
1110
 
1016
1111
  Layout/MultilineAssignmentLayout:
1017
1112
  Description: 'Check for a newline after the assignment operator in multi-line assignments.'
@@ -1062,6 +1157,7 @@ Layout/MultilineHashKeyLineBreaks:
1062
1157
  starts on a separate line.
1063
1158
  Enabled: false
1064
1159
  VersionAdded: '0.67'
1160
+ AllowMultilineFinalElement: false
1065
1161
 
1066
1162
  Layout/MultilineMethodArgumentLineBreaks:
1067
1163
  Description: >-
@@ -1069,6 +1165,7 @@ Layout/MultilineMethodArgumentLineBreaks:
1069
1165
  starts on a separate line.
1070
1166
  Enabled: false
1071
1167
  VersionAdded: '0.67'
1168
+ AllowMultilineFinalElement: false
1072
1169
 
1073
1170
  Layout/MultilineMethodCallBraceLayout:
1074
1171
  Description: >-
@@ -1117,6 +1214,14 @@ Layout/MultilineMethodDefinitionBraceLayout:
1117
1214
  - new_line
1118
1215
  - same_line
1119
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
+
1120
1225
  Layout/MultilineOperationIndentation:
1121
1226
  Description: >-
1122
1227
  Checks indentation of binary operations that span more than
@@ -1255,6 +1360,10 @@ Layout/SpaceAroundOperators:
1255
1360
  SupportedStylesForExponentOperator:
1256
1361
  - space
1257
1362
  - no_space
1363
+ EnforcedStyleForRationalLiterals: no_space
1364
+ SupportedStylesForRationalLiterals:
1365
+ - space
1366
+ - no_space
1258
1367
 
1259
1368
  Layout/SpaceBeforeBlockBraces:
1260
1369
  Description: >-
@@ -1450,11 +1559,11 @@ Lint/AmbiguousBlockAssociation:
1450
1559
  Description: >-
1451
1560
  Checks for ambiguous block association with method when param passed without
1452
1561
  parentheses.
1453
- StyleGuide: '#syntax'
1454
1562
  Enabled: true
1455
1563
  VersionAdded: '0.48'
1456
1564
  VersionChanged: '1.13'
1457
- IgnoredMethods: []
1565
+ AllowedMethods: []
1566
+ AllowedPatterns: []
1458
1567
 
1459
1568
  Lint/AmbiguousOperator:
1460
1569
  Description: >-
@@ -1491,7 +1600,9 @@ Lint/AssignmentInCondition:
1491
1600
  Description: "Don't use assignment in conditions."
1492
1601
  StyleGuide: '#safe-assignment-in-condition'
1493
1602
  Enabled: true
1603
+ SafeAutoCorrect: false
1494
1604
  VersionAdded: '0.9'
1605
+ VersionChanged: '1.45'
1495
1606
  AllowSafeAssignment: true
1496
1607
 
1497
1608
  Lint/BigDecimalNew:
@@ -1500,7 +1611,7 @@ Lint/BigDecimalNew:
1500
1611
  VersionAdded: '0.53'
1501
1612
 
1502
1613
  Lint/BinaryOperatorWithIdenticalOperands:
1503
- Description: 'This cop checks for places where binary operator has identical operands.'
1614
+ Description: 'Checks for places where binary operator has identical operands.'
1504
1615
  Enabled: true
1505
1616
  Safe: false
1506
1617
  VersionAdded: '0.89'
@@ -1529,6 +1640,11 @@ Lint/ConstantDefinitionInBlock:
1529
1640
  AllowedMethods:
1530
1641
  - enums
1531
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
+
1532
1648
  Lint/ConstantResolution:
1533
1649
  Description: 'Check that constants are fully qualified with `::`.'
1534
1650
  Enabled: false
@@ -1542,21 +1658,27 @@ Lint/Debugger:
1542
1658
  Description: 'Check for debugger calls.'
1543
1659
  Enabled: true
1544
1660
  VersionAdded: '0.14'
1545
- VersionChanged: '1.10'
1546
- DebuggerReceivers: [] # deprecated
1661
+ VersionChanged: '1.63'
1547
1662
  DebuggerMethods:
1548
1663
  # Groups are available so that a specific group can be disabled in
1549
1664
  # a user's configuration, but are otherwise not significant.
1550
1665
  Kernel:
1551
1666
  - binding.irb
1667
+ - Kernel.binding.irb
1552
1668
  Byebug:
1553
1669
  - byebug
1554
1670
  - remote_byebug
1555
1671
  - Kernel.byebug
1556
1672
  - Kernel.remote_byebug
1557
1673
  Capybara:
1674
+ - page.save_and_open_page
1675
+ - page.save_and_open_screenshot
1676
+ - page.save_page
1677
+ - page.save_screenshot
1558
1678
  - save_and_open_page
1559
1679
  - save_and_open_screenshot
1680
+ - save_page
1681
+ - save_screenshot
1560
1682
  debug.rb:
1561
1683
  - binding.b
1562
1684
  - binding.break
@@ -1566,7 +1688,11 @@ Lint/Debugger:
1566
1688
  - binding.pry
1567
1689
  - binding.remote_pry
1568
1690
  - binding.pry_remote
1691
+ - Kernel.binding.pry
1692
+ - Kernel.binding.remote_pry
1693
+ - Kernel.binding.pry_remote
1569
1694
  - Pry.rescue
1695
+ - pry
1570
1696
  Rails:
1571
1697
  - debugger
1572
1698
  - Kernel.debugger
@@ -1574,6 +1700,10 @@ Lint/Debugger:
1574
1700
  - jard
1575
1701
  WebConsole:
1576
1702
  - binding.console
1703
+ DebuggerRequires:
1704
+ debug.rb:
1705
+ - debug/open
1706
+ - debug/start
1577
1707
 
1578
1708
  Lint/DeprecatedClassMethods:
1579
1709
  Description: 'Check for deprecated class method calls.'
@@ -1584,7 +1714,7 @@ Lint/DeprecatedConstants:
1584
1714
  Description: 'Checks for deprecated constants.'
1585
1715
  Enabled: pending
1586
1716
  VersionAdded: '1.8'
1587
- VersionChanged: '1.22'
1717
+ VersionChanged: '1.40'
1588
1718
  # You can configure deprecated constants.
1589
1719
  # If there is an alternative method, you can set alternative value as `Alternative`.
1590
1720
  # And you can set the deprecated version as `DeprecatedVersion`.
@@ -1611,6 +1741,12 @@ Lint/DeprecatedConstants:
1611
1741
  'Random::DEFAULT':
1612
1742
  Alternative: 'Random.new'
1613
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'
1614
1750
 
1615
1751
  Lint/DeprecatedOpenSSLConstant:
1616
1752
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
@@ -1648,6 +1784,16 @@ Lint/DuplicateHashKey:
1648
1784
  VersionAdded: '0.34'
1649
1785
  VersionChanged: '0.77'
1650
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
+
1651
1797
  Lint/DuplicateMethods:
1652
1798
  Description: 'Check for duplicate method definitions.'
1653
1799
  Enabled: true
@@ -1661,7 +1807,9 @@ Lint/DuplicateRegexpCharacterClassElement:
1661
1807
  Lint/DuplicateRequire:
1662
1808
  Description: 'Check for duplicate `require`s and `require_relative`s.'
1663
1809
  Enabled: true
1810
+ SafeAutoCorrect: false
1664
1811
  VersionAdded: '0.90'
1812
+ VersionChanged: '1.28'
1665
1813
 
1666
1814
  Lint/DuplicateRescueException:
1667
1815
  Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
@@ -1680,7 +1828,7 @@ Lint/ElseLayout:
1680
1828
  VersionChanged: '1.2'
1681
1829
 
1682
1830
  Lint/EmptyBlock:
1683
- Description: 'This cop checks for blocks without a body.'
1831
+ Description: 'Checks for blocks without a body.'
1684
1832
  Enabled: pending
1685
1833
  VersionAdded: '1.1'
1686
1834
  VersionChanged: '1.15'
@@ -1694,16 +1842,20 @@ Lint/EmptyClass:
1694
1842
  AllowComments: false
1695
1843
 
1696
1844
  Lint/EmptyConditionalBody:
1697
- Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1845
+ Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1698
1846
  Enabled: true
1847
+ AutoCorrect: contextual
1848
+ SafeAutoCorrect: false
1699
1849
  AllowComments: true
1700
1850
  VersionAdded: '0.89'
1851
+ VersionChanged: '1.61'
1701
1852
 
1702
1853
  Lint/EmptyEnsure:
1703
1854
  Description: 'Checks for empty ensure block.'
1704
1855
  Enabled: true
1856
+ AutoCorrect: contextual
1705
1857
  VersionAdded: '0.10'
1706
- VersionChanged: '0.48'
1858
+ VersionChanged: '1.61'
1707
1859
 
1708
1860
  Lint/EmptyExpression:
1709
1861
  Description: 'Checks for empty expressions.'
@@ -1725,8 +1877,9 @@ Lint/EmptyInPattern:
1725
1877
  Lint/EmptyInterpolation:
1726
1878
  Description: 'Checks for empty string interpolation.'
1727
1879
  Enabled: true
1880
+ AutoCorrect: contextual
1728
1881
  VersionAdded: '0.20'
1729
- VersionChanged: '0.45'
1882
+ VersionChanged: '1.61'
1730
1883
 
1731
1884
  Lint/EmptyWhen:
1732
1885
  Description: 'Checks for `when` branches with empty bodies.'
@@ -1816,19 +1969,27 @@ Lint/IneffectiveAccessModifier:
1816
1969
  Lint/InheritException:
1817
1970
  Description: 'Avoid inheriting from the `Exception` class.'
1818
1971
  Enabled: true
1972
+ SafeAutoCorrect: false
1819
1973
  VersionAdded: '0.41'
1974
+ VersionChanged: '1.26'
1820
1975
  # The default base class in favour of `Exception`.
1821
- EnforcedStyle: runtime_error
1976
+ EnforcedStyle: standard_error
1822
1977
  SupportedStyles:
1823
- - runtime_error
1824
1978
  - standard_error
1979
+ - runtime_error
1825
1980
 
1826
1981
  Lint/InterpolationCheck:
1827
- Description: 'Raise warning for interpolation in single q strs.'
1982
+ Description: 'Checks for interpolation in a single quoted string.'
1828
1983
  Enabled: true
1829
- Safe: false
1984
+ SafeAutoCorrect: false
1830
1985
  VersionAdded: '0.50'
1831
- 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'
1832
1993
 
1833
1994
  Lint/LambdaWithoutLiteralBlock:
1834
1995
  Description: 'Checks uses of lambda without a literal block.'
@@ -1840,6 +2001,11 @@ Lint/LiteralAsCondition:
1840
2001
  Enabled: true
1841
2002
  VersionAdded: '0.51'
1842
2003
 
2004
+ Lint/LiteralAssignmentInCondition:
2005
+ Description: 'Checks for literal assignments in the conditions.'
2006
+ Enabled: pending
2007
+ VersionAdded: '1.58'
2008
+
1843
2009
  Lint/LiteralInInterpolation:
1844
2010
  Description: 'Checks for literals used in interpolation.'
1845
2011
  Enabled: true
@@ -1871,12 +2037,19 @@ Lint/MissingCopEnableDirective:
1871
2037
 
1872
2038
  Lint/MissingSuper:
1873
2039
  Description: >-
1874
- This cop checks for the presence of constructors and lifecycle callbacks
2040
+ Checks for the presence of constructors and lifecycle callbacks
1875
2041
  without calls to `super`.
1876
2042
  Enabled: true
2043
+ AllowedParentClasses: []
1877
2044
  VersionAdded: '0.89'
1878
2045
  VersionChanged: '1.4'
1879
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
+
1880
2053
  Lint/MixedRegexpCaptureTypes:
1881
2054
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1882
2055
  Enabled: true
@@ -1892,6 +2065,8 @@ Lint/NestedMethodDefinition:
1892
2065
  Description: 'Do not use nested method definitions.'
1893
2066
  StyleGuide: '#no-nested-methods'
1894
2067
  Enabled: true
2068
+ AllowedMethods: []
2069
+ AllowedPatterns: []
1895
2070
  VersionAdded: '0.32'
1896
2071
 
1897
2072
  Lint/NestedPercentLiteral:
@@ -1900,7 +2075,7 @@ Lint/NestedPercentLiteral:
1900
2075
  VersionAdded: '0.52'
1901
2076
 
1902
2077
  Lint/NextWithoutAccumulator:
1903
- Description: >-
2078
+ Description: >-
1904
2079
  Do not omit the accumulator when calling `next`
1905
2080
  in a `reduce`/`inject` block.
1906
2081
  Enabled: true
@@ -1911,6 +2086,13 @@ Lint/NoReturnInBeginEndBlocks:
1911
2086
  Enabled: pending
1912
2087
  VersionAdded: '1.2'
1913
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
+
1914
2096
  Lint/NonDeterministicRequireOrder:
1915
2097
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1916
2098
  Enabled: true
@@ -1928,7 +2110,8 @@ Lint/NumberConversion:
1928
2110
  VersionAdded: '0.53'
1929
2111
  VersionChanged: '1.1'
1930
2112
  SafeAutoCorrect: false
1931
- IgnoredMethods: []
2113
+ AllowedMethods: []
2114
+ AllowedPatterns: []
1932
2115
  IgnoredClasses:
1933
2116
  - Time
1934
2117
  - DateTime
@@ -1947,7 +2130,9 @@ Lint/OrAssignmentToConstant:
1947
2130
  Lint/OrderedMagicComments:
1948
2131
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1949
2132
  Enabled: true
2133
+ SafeAutoCorrect: false
1950
2134
  VersionAdded: '0.53'
2135
+ VersionChanged: '1.37'
1951
2136
 
1952
2137
  Lint/OutOfRangeRegexpRef:
1953
2138
  Description: 'Checks for out of range reference for Regexp because it always returns nil.'
@@ -2011,11 +2196,20 @@ Lint/RedundantDirGlobSort:
2011
2196
  Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
2012
2197
  Enabled: pending
2013
2198
  VersionAdded: '1.8'
2199
+ VersionChanged: '1.26'
2200
+ SafeAutoCorrect: false
2201
+
2202
+ Lint/RedundantRegexpQuantifiers:
2203
+ Description: 'Checks for redundant quantifiers in Regexps.'
2204
+ Enabled: pending
2205
+ VersionAdded: '1.53'
2014
2206
 
2015
2207
  Lint/RedundantRequireStatement:
2016
2208
  Description: 'Checks for unnecessary `require` statement.'
2017
2209
  Enabled: true
2210
+ SafeAutoCorrect: false
2018
2211
  VersionAdded: '0.76'
2212
+ VersionChanged: '1.57'
2019
2213
 
2020
2214
  Lint/RedundantSafeNavigation:
2021
2215
  Description: 'Checks for redundant safe navigation calls.'
@@ -2054,6 +2248,12 @@ Lint/RedundantWithObject:
2054
2248
  Enabled: true
2055
2249
  VersionAdded: '0.51'
2056
2250
 
2251
+ Lint/RefinementImportMethods:
2252
+ Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
2253
+ Enabled: pending
2254
+ SafeAutoCorrect: false
2255
+ VersionAdded: '1.27'
2256
+
2057
2257
  Lint/RegexpAsCondition:
2058
2258
  Description: >-
2059
2259
  Do not use regexp literal as a condition.
@@ -2069,6 +2269,11 @@ Lint/RequireParentheses:
2069
2269
  Enabled: true
2070
2270
  VersionAdded: '0.18'
2071
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
+
2072
2277
  Lint/RequireRelativeSelfPath:
2073
2278
  Description: 'Checks for uses a file requiring itself with `require_relative`.'
2074
2279
  Enabled: pending
@@ -2192,7 +2397,7 @@ Lint/Syntax:
2192
2397
  VersionAdded: '0.9'
2193
2398
 
2194
2399
  Lint/ToEnumArguments:
2195
- Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2400
+ Description: 'Ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2196
2401
  Enabled: pending
2197
2402
  VersionAdded: '1.1'
2198
2403
 
@@ -2202,14 +2407,19 @@ Lint/ToJSON:
2202
2407
  VersionAdded: '0.66'
2203
2408
 
2204
2409
  Lint/TopLevelReturnWithArgument:
2205
- Description: 'This cop detects top level return statements with argument.'
2410
+ Description: 'Detects top level return statements with argument.'
2206
2411
  Enabled: true
2207
2412
  VersionAdded: '0.89'
2413
+ # These codes are `eval`-ed in method and their return values may be used.
2414
+ Exclude:
2415
+ - '**/*.jb'
2208
2416
 
2209
2417
  Lint/TrailingCommaInAttributeDeclaration:
2210
- Description: 'This cop checks for trailing commas in attribute declarations.'
2418
+ Description: 'Checks for trailing commas in attribute declarations.'
2211
2419
  Enabled: true
2420
+ AutoCorrect: contextual
2212
2421
  VersionAdded: '0.90'
2422
+ VersionChanged: '1.61'
2213
2423
 
2214
2424
  Lint/TripleQuotes:
2215
2425
  Description: 'Checks for useless triple quote constructs.'
@@ -2256,11 +2466,11 @@ Lint/UnreachableCode:
2256
2466
  VersionAdded: '0.9'
2257
2467
 
2258
2468
  Lint/UnreachableLoop:
2259
- Description: 'This cop checks for loops that will have at most one iteration.'
2469
+ Description: 'Checks for loops that will have at most one iteration.'
2260
2470
  Enabled: true
2261
2471
  VersionAdded: '0.89'
2262
2472
  VersionChanged: '1.7'
2263
- IgnoredPatterns:
2473
+ AllowedPatterns:
2264
2474
  # RSpec uses `times` in its message expectations
2265
2475
  # eg. `exactly(2).times`
2266
2476
  - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
@@ -2269,8 +2479,9 @@ Lint/UnusedBlockArgument:
2269
2479
  Description: 'Checks for unused block arguments.'
2270
2480
  StyleGuide: '#underscore-unused-vars'
2271
2481
  Enabled: true
2482
+ AutoCorrect: contextual
2272
2483
  VersionAdded: '0.21'
2273
- VersionChanged: '0.22'
2484
+ VersionChanged: '1.61'
2274
2485
  IgnoreEmptyBlocks: true
2275
2486
  AllowUnusedKeywordArguments: false
2276
2487
 
@@ -2278,8 +2489,9 @@ Lint/UnusedMethodArgument:
2278
2489
  Description: 'Checks for unused method arguments.'
2279
2490
  StyleGuide: '#underscore-unused-vars'
2280
2491
  Enabled: true
2492
+ AutoCorrect: contextual
2281
2493
  VersionAdded: '0.21'
2282
- VersionChanged: '0.81'
2494
+ VersionChanged: '1.61'
2283
2495
  AllowUnusedKeywordArguments: false
2284
2496
  IgnoreEmptyMethods: true
2285
2497
  IgnoreNotImplementedMethods: true
@@ -2303,8 +2515,9 @@ Lint/UriRegexp:
2303
2515
  Lint/UselessAccessModifier:
2304
2516
  Description: 'Checks for useless access modifiers.'
2305
2517
  Enabled: true
2518
+ AutoCorrect: contextual
2306
2519
  VersionAdded: '0.20'
2307
- VersionChanged: '0.83'
2520
+ VersionChanged: '1.61'
2308
2521
  ContextCreatingMethods: []
2309
2522
  MethodCreatingMethods: []
2310
2523
 
@@ -2312,19 +2525,29 @@ Lint/UselessAssignment:
2312
2525
  Description: 'Checks for useless assignment to a local variable.'
2313
2526
  StyleGuide: '#underscore-unused-vars'
2314
2527
  Enabled: true
2528
+ AutoCorrect: contextual
2315
2529
  VersionAdded: '0.11'
2530
+ VersionChanged: '1.61'
2531
+ SafeAutoCorrect: false
2316
2532
 
2317
2533
  Lint/UselessElseWithoutRescue:
2318
2534
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2319
2535
  Enabled: true
2320
2536
  VersionAdded: '0.17'
2537
+ VersionChanged: '1.31'
2321
2538
 
2322
2539
  Lint/UselessMethodDefinition:
2323
2540
  Description: 'Checks for useless method definitions.'
2324
2541
  Enabled: true
2542
+ AutoCorrect: contextual
2325
2543
  VersionAdded: '0.90'
2544
+ VersionChanged: '1.61'
2326
2545
  Safe: false
2327
- AllowComments: true
2546
+
2547
+ Lint/UselessRescue:
2548
+ Description: 'Checks for useless `rescue`s.'
2549
+ Enabled: pending
2550
+ VersionAdded: '1.43'
2328
2551
 
2329
2552
  Lint/UselessRuby2Keywords:
2330
2553
  Description: 'Finds unnecessary uses of `ruby2_keywords`.'
@@ -2334,21 +2557,24 @@ Lint/UselessRuby2Keywords:
2334
2557
  Lint/UselessSetterCall:
2335
2558
  Description: 'Checks for useless setter call to a local variable.'
2336
2559
  Enabled: true
2337
- SafeAutoCorrect: false
2560
+ Safe: false
2338
2561
  VersionAdded: '0.13'
2339
2562
  VersionChanged: '1.2'
2340
- Safe: false
2341
2563
 
2342
2564
  Lint/UselessTimes:
2343
2565
  Description: 'Checks for useless `Integer#times` calls.'
2344
2566
  Enabled: true
2345
- VersionAdded: '0.91'
2346
2567
  Safe: false
2568
+ AutoCorrect: contextual
2569
+ VersionAdded: '0.91'
2570
+ VersionChanged: '1.61'
2347
2571
 
2348
2572
  Lint/Void:
2349
2573
  Description: 'Possible use of operator/literal/variable in void context.'
2350
2574
  Enabled: true
2575
+ AutoCorrect: contextual
2351
2576
  VersionAdded: '0.9'
2577
+ VersionChanged: '1.61'
2352
2578
  CheckForMethodsWithNoSideEffects: false
2353
2579
 
2354
2580
  #################### Metrics ###############################
@@ -2365,7 +2591,8 @@ Metrics/AbcSize:
2365
2591
  VersionChanged: '1.5'
2366
2592
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2367
2593
  # a Float.
2368
- IgnoredMethods: []
2594
+ AllowedMethods: []
2595
+ AllowedPatterns: []
2369
2596
  CountRepeatedAttributes: true
2370
2597
  Max: 17
2371
2598
 
@@ -2377,11 +2604,11 @@ Metrics/BlockLength:
2377
2604
  CountComments: false # count full line comments?
2378
2605
  Max: 25
2379
2606
  CountAsOne: []
2380
- ExcludedMethods: [] # deprecated, retained for backwards compatibility
2381
- IgnoredMethods:
2607
+ AllowedMethods:
2382
2608
  # By default, exclude the `#refine` method, as it tends to have larger
2383
2609
  # associated blocks.
2384
2610
  - refine
2611
+ AllowedPatterns: []
2385
2612
  Exclude:
2386
2613
  - '**/*.gemspec'
2387
2614
 
@@ -2403,6 +2630,12 @@ Metrics/ClassLength:
2403
2630
  Max: 100
2404
2631
  CountAsOne: []
2405
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
+
2406
2639
  # Avoid complex methods.
2407
2640
  Metrics/CyclomaticComplexity:
2408
2641
  Description: >-
@@ -2411,7 +2644,8 @@ Metrics/CyclomaticComplexity:
2411
2644
  Enabled: true
2412
2645
  VersionAdded: '0.25'
2413
2646
  VersionChanged: '0.81'
2414
- IgnoredMethods: []
2647
+ AllowedMethods: []
2648
+ AllowedPatterns: []
2415
2649
  Max: 7
2416
2650
 
2417
2651
  Metrics/MethodLength:
@@ -2423,8 +2657,8 @@ Metrics/MethodLength:
2423
2657
  CountComments: false # count full line comments?
2424
2658
  Max: 10
2425
2659
  CountAsOne: []
2426
- ExcludedMethods: [] # deprecated, retained for backwards compatibility
2427
- IgnoredMethods: []
2660
+ AllowedMethods: []
2661
+ AllowedPatterns: []
2428
2662
 
2429
2663
  Metrics/ModuleLength:
2430
2664
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2452,7 +2686,8 @@ Metrics/PerceivedComplexity:
2452
2686
  Enabled: true
2453
2687
  VersionAdded: '0.25'
2454
2688
  VersionChanged: '0.81'
2455
- IgnoredMethods: []
2689
+ AllowedMethods: []
2690
+ AllowedPatterns: []
2456
2691
  Max: 8
2457
2692
 
2458
2693
  ################## Migration #############################
@@ -2496,6 +2731,7 @@ Naming/BlockForwarding:
2496
2731
  SupportedStyles:
2497
2732
  - anonymous
2498
2733
  - explicit
2734
+ BlockForwardingName: block
2499
2735
 
2500
2736
  Naming/BlockParameterName:
2501
2737
  Description: >-
@@ -2537,7 +2773,8 @@ Naming/FileName:
2537
2773
  VersionChanged: '1.23'
2538
2774
  # Camel case file names listed in `AllCops:Include` and all file names listed
2539
2775
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2540
- Exclude: []
2776
+ Exclude:
2777
+ - Rakefile.rb
2541
2778
  # When `true`, requires that each source file should define a class or module
2542
2779
  # with a name which matches the file name (converted to ... case).
2543
2780
  # It further expects it to be nested inside modules which match the names
@@ -2622,13 +2859,13 @@ Naming/HeredocDelimiterNaming:
2622
2859
  Enabled: true
2623
2860
  VersionAdded: '0.50'
2624
2861
  ForbiddenDelimiters:
2625
- - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2862
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/i'
2626
2863
 
2627
2864
  Naming/InclusiveLanguage:
2628
2865
  Description: 'Recommend the use of inclusive language instead of problematic terms.'
2629
2866
  Enabled: false
2630
2867
  VersionAdded: '1.18'
2631
- VersionChanged: '1.21'
2868
+ VersionChanged: '1.49'
2632
2869
  CheckIdentifiers: true
2633
2870
  CheckConstants: true
2634
2871
  CheckVariables: true
@@ -2675,11 +2912,11 @@ Naming/MethodName:
2675
2912
  - camelCase
2676
2913
  # Method names matching patterns are always allowed.
2677
2914
  #
2678
- # IgnoredPatterns:
2915
+ # AllowedPatterns:
2679
2916
  # - '\A\s*onSelectionBulkChange\s*'
2680
2917
  # - '\A\s*onSelectionCleared\s*'
2681
2918
  #
2682
- IgnoredPatterns: []
2919
+ AllowedPatterns: []
2683
2920
 
2684
2921
  Naming/MethodParameterName:
2685
2922
  Description: >-
@@ -2693,10 +2930,13 @@ Naming/MethodParameterName:
2693
2930
  AllowNamesEndingInNumbers: true
2694
2931
  # Allowed names that will not register an offense
2695
2932
  AllowedNames:
2933
+ - as
2696
2934
  - at
2697
2935
  - by
2936
+ - cc
2698
2937
  - db
2699
2938
  - id
2939
+ - if
2700
2940
  - in
2701
2941
  - io
2702
2942
  - ip
@@ -2755,6 +2995,7 @@ Naming/VariableName:
2755
2995
  - snake_case
2756
2996
  - camelCase
2757
2997
  AllowedIdentifiers: []
2998
+ AllowedPatterns: []
2758
2999
 
2759
3000
  Naming/VariableNumber:
2760
3001
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2776,9 +3017,18 @@ Naming/VariableNumber:
2776
3017
  - rfc822 # Time#rfc822
2777
3018
  - rfc2822 # Time#rfc2822
2778
3019
  - rfc3339 # DateTime.rfc3339
3020
+ - x86_64 # Allowed by default as an underscore separated CPU architecture name
3021
+ AllowedPatterns: []
2779
3022
 
2780
3023
  #################### Security ##############################
2781
3024
 
3025
+ Security/CompoundHash:
3026
+ Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
3027
+ Enabled: pending
3028
+ Safe: false
3029
+ VersionAdded: '1.28'
3030
+ VersionChanged: '1.51'
3031
+
2782
3032
  Security/Eval:
2783
3033
  Description: 'The use of eval represents a serious security risk.'
2784
3034
  Enabled: true
@@ -2840,6 +3090,8 @@ Style/AccessModifierDeclarations:
2840
3090
  - inline
2841
3091
  - group
2842
3092
  AllowModifiersOnSymbols: true
3093
+ AllowModifiersOnAttrs: true
3094
+ SafeAutoCorrect: false
2843
3095
 
2844
3096
  Style/AccessorGrouping:
2845
3097
  Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
@@ -2882,7 +3134,20 @@ Style/ArgumentsForwarding:
2882
3134
  StyleGuide: '#arguments-forwarding'
2883
3135
  Enabled: pending
2884
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
2885
3149
  VersionAdded: '1.1'
3150
+ VersionChanged: '1.58'
2886
3151
 
2887
3152
  Style/ArrayCoercion:
2888
3153
  Description: >-
@@ -2893,6 +3158,19 @@ Style/ArrayCoercion:
2893
3158
  Enabled: false
2894
3159
  VersionAdded: '0.88'
2895
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
+
2896
3174
  Style/ArrayJoin:
2897
3175
  Description: 'Use Array#join instead of Array#*.'
2898
3176
  StyleGuide: '#array-join'
@@ -2974,7 +3252,7 @@ Style/BlockDelimiters:
2974
3252
  # This looks at the usage of a block's method to determine its type (e.g. is
2975
3253
  # the result of a `map` assigned to a variable or passed to another
2976
3254
  # method) but exceptions are permitted in the `ProceduralMethods`,
2977
- # `FunctionalMethods` and `IgnoredMethods` sections below.
3255
+ # `FunctionalMethods` and `AllowedMethods` sections below.
2978
3256
  - semantic
2979
3257
  # The `braces_for_chaining` style enforces braces around single line blocks
2980
3258
  # and do..end around multi-line blocks, except for multi-line blocks whose
@@ -3015,7 +3293,7 @@ Style/BlockDelimiters:
3015
3293
  - let!
3016
3294
  - subject
3017
3295
  - watch
3018
- IgnoredMethods:
3296
+ AllowedMethods:
3019
3297
  # Methods that can be either procedural or functional and cannot be
3020
3298
  # categorised from their usage alone, e.g.
3021
3299
  #
@@ -3032,6 +3310,7 @@ Style/BlockDelimiters:
3032
3310
  - lambda
3033
3311
  - proc
3034
3312
  - it
3313
+ AllowedPatterns: []
3035
3314
  # The AllowBracesOnProceduralOneLiners option is ignored unless the
3036
3315
  # EnforcedStyle is set to `semantic`. If so:
3037
3316
  #
@@ -3055,7 +3334,7 @@ Style/BlockDelimiters:
3055
3334
  # collection.each do |element| puts element end
3056
3335
  AllowBracesOnProceduralOneLiners: false
3057
3336
  # The BracesRequiredMethods overrides all other configurations except
3058
- # 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
3059
3338
  # methods use braces. For example, you can use this to enforce Sorbet
3060
3339
  # signatures use braces even when the rest of your codebase enforces
3061
3340
  # the `line_count_based` style.
@@ -3076,13 +3355,25 @@ Style/CaseEquality:
3076
3355
  # # good
3077
3356
  # String === "string"
3078
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
3079
3367
 
3080
3368
  Style/CaseLikeIf:
3081
- Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
3369
+ Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
3082
3370
  StyleGuide: '#case-vs-if-else'
3083
3371
  Enabled: true
3084
3372
  Safe: false
3085
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
3086
3377
 
3087
3378
  Style/CharacterLiteral:
3088
3379
  Description: 'Checks for uses of character literals.'
@@ -3095,7 +3386,7 @@ Style/ClassAndModuleChildren:
3095
3386
  StyleGuide: '#namespace-definition'
3096
3387
  # Moving from compact to nested children requires knowledge of whether the
3097
3388
  # outer parent is a module or a class. Moving from nested to compact requires
3098
- # verification that the outer parent is defined elsewhere. Rubocop does not
3389
+ # verification that the outer parent is defined elsewhere. RuboCop does not
3099
3390
  # have the knowledge to perform either operation safely and thus requires
3100
3391
  # manual oversight.
3101
3392
  SafeAutoCorrect: false
@@ -3134,11 +3425,14 @@ Style/ClassEqualityComparison:
3134
3425
  Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3135
3426
  StyleGuide: '#instance-of-vs-class-comparison'
3136
3427
  Enabled: true
3428
+ SafeAutoCorrect: false
3137
3429
  VersionAdded: '0.93'
3138
- IgnoredMethods:
3430
+ VersionChanged: '1.57'
3431
+ AllowedMethods:
3139
3432
  - ==
3140
3433
  - equal?
3141
3434
  - eql?
3435
+ AllowedPatterns: []
3142
3436
 
3143
3437
  Style/ClassMethods:
3144
3438
  Description: 'Use self when defining module/class methods.'
@@ -3152,7 +3446,7 @@ Style/ClassMethodsDefinitions:
3152
3446
  StyleGuide: '#def-self-class-methods'
3153
3447
  Enabled: false
3154
3448
  VersionAdded: '0.89'
3155
- EnforcedStyle: def_self
3449
+ EnforcedStyle: def_self
3156
3450
  SupportedStyles:
3157
3451
  - def_self
3158
3452
  - self_class
@@ -3169,6 +3463,7 @@ Style/CollectionCompact:
3169
3463
  Safe: false
3170
3464
  VersionAdded: '1.2'
3171
3465
  VersionChanged: '1.3'
3466
+ AllowedReceivers: []
3172
3467
 
3173
3468
  # Align with the style guide.
3174
3469
  Style/CollectionMethods:
@@ -3187,6 +3482,7 @@ Style/CollectionMethods:
3187
3482
  PreferredMethods:
3188
3483
  collect: 'map'
3189
3484
  collect!: 'map!'
3485
+ collect_concat: 'flat_map'
3190
3486
  inject: 'reduce'
3191
3487
  detect: 'find'
3192
3488
  find_all: 'select'
@@ -3259,6 +3555,17 @@ Style/CommentedKeyword:
3259
3555
  VersionAdded: '0.51'
3260
3556
  VersionChanged: '1.19'
3261
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
+
3262
3569
  Style/ConditionalAssignment:
3263
3570
  Description: >-
3264
3571
  Use the return value of `if` and `case` statements for
@@ -3314,9 +3621,17 @@ Style/Copyright:
3314
3621
  Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
3315
3622
  AutocorrectNotice: ''
3316
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
+
3317
3632
  Style/DateTime:
3318
3633
  Description: 'Use Time over DateTime.'
3319
- StyleGuide: '#date--time'
3634
+ StyleGuide: '#date-time'
3320
3635
  Enabled: false
3321
3636
  VersionAdded: '0.51'
3322
3637
  VersionChanged: '0.92'
@@ -3337,6 +3652,12 @@ Style/Dir:
3337
3652
  Enabled: true
3338
3653
  VersionAdded: '0.50'
3339
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
+
3340
3661
  Style/DisableCopsWithinSourceCodeDirective:
3341
3662
  Description: >-
3342
3663
  Forbids disabling/enabling cops within source code.
@@ -3367,6 +3688,7 @@ Style/DocumentationMethod:
3367
3688
  Description: 'Checks for missing documentation comment for public methods.'
3368
3689
  Enabled: false
3369
3690
  VersionAdded: '0.43'
3691
+ AllowedMethods: []
3370
3692
  Exclude:
3371
3693
  - 'spec/**/*'
3372
3694
  - 'test/**/*'
@@ -3415,8 +3737,9 @@ Style/EmptyCaseCondition:
3415
3737
  Style/EmptyElse:
3416
3738
  Description: 'Avoid empty else-clauses.'
3417
3739
  Enabled: true
3740
+ AutoCorrect: contextual
3418
3741
  VersionAdded: '0.28'
3419
- VersionChanged: '0.32'
3742
+ VersionChanged: '1.61'
3420
3743
  EnforcedStyle: both
3421
3744
  # empty - warn only on empty `else`
3422
3745
  # nil - warn on `else` with nil in it
@@ -3425,6 +3748,14 @@ Style/EmptyElse:
3425
3748
  - empty
3426
3749
  - nil
3427
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'
3428
3759
 
3429
3760
  Style/EmptyLambdaParameter:
3430
3761
  Description: 'Omit parens for empty lambda parameters.'
@@ -3442,7 +3773,9 @@ Style/EmptyMethod:
3442
3773
  Description: 'Checks the formatting of empty method definitions.'
3443
3774
  StyleGuide: '#no-single-line-methods'
3444
3775
  Enabled: true
3776
+ AutoCorrect: contextual
3445
3777
  VersionAdded: '0.46'
3778
+ VersionChanged: '1.61'
3446
3779
  EnforcedStyle: compact
3447
3780
  SupportedStyles:
3448
3781
  - compact
@@ -3473,6 +3806,12 @@ Style/EndlessMethod:
3473
3806
  - allow_always
3474
3807
  - disallow
3475
3808
 
3809
+ Style/EnvHome:
3810
+ Description: "Checks for consistent usage of `ENV['HOME']`."
3811
+ Enabled: pending
3812
+ Safe: false
3813
+ VersionAdded: '1.29'
3814
+
3476
3815
  Style/EvalWithLocation:
3477
3816
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3478
3817
  Enabled: true
@@ -3485,6 +3824,11 @@ Style/EvenOdd:
3485
3824
  VersionAdded: '0.12'
3486
3825
  VersionChanged: '0.29'
3487
3826
 
3827
+ Style/ExactRegexpMatch:
3828
+ Description: 'Checks for exact regexp match inside Regexp literals.'
3829
+ Enabled: pending
3830
+ VersionAdded: '1.51'
3831
+
3488
3832
  Style/ExpandPathArguments:
3489
3833
  Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3490
3834
  Enabled: true
@@ -3510,6 +3854,23 @@ Style/ExponentialNotation:
3510
3854
  - engineering
3511
3855
  - integral
3512
3856
 
3857
+ Style/FetchEnvVar:
3858
+ Description: >-
3859
+ Suggests `ENV.fetch` for the replacement of `ENV[]`.
3860
+ Reference:
3861
+ - https://rubystyle.guide/#hash-fetch-defaults
3862
+ Enabled: pending
3863
+ VersionAdded: '1.28'
3864
+ # Environment variables to be excluded from the inspection.
3865
+ AllowedVars: []
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
+
3513
3874
  Style/FileRead:
3514
3875
  Description: 'Favor `File.(bin)read` convenience methods.'
3515
3876
  StyleGuide: '#file-read'
@@ -3541,8 +3902,9 @@ Style/For:
3541
3902
  Description: 'Checks use of for or each in multiline loops.'
3542
3903
  StyleGuide: '#no-for-loops'
3543
3904
  Enabled: true
3905
+ SafeAutoCorrect: false
3544
3906
  VersionAdded: '0.13'
3545
- VersionChanged: '0.59'
3907
+ VersionChanged: '1.26'
3546
3908
  EnforcedStyle: each
3547
3909
  SupportedStyles:
3548
3910
  - each
@@ -3577,7 +3939,8 @@ Style/FormatStringToken:
3577
3939
  MaxUnannotatedPlaceholdersAllowed: 1
3578
3940
  VersionAdded: '0.49'
3579
3941
  VersionChanged: '1.0'
3580
- IgnoredMethods: []
3942
+ AllowedMethods: []
3943
+ AllowedPatterns: []
3581
3944
 
3582
3945
  Style/FrozenStringLiteralComment:
3583
3946
  Description: >-
@@ -3622,10 +3985,11 @@ Style/GuardClause:
3622
3985
  StyleGuide: '#no-nested-conditionals'
3623
3986
  Enabled: true
3624
3987
  VersionAdded: '0.20'
3625
- VersionChanged: '0.22'
3988
+ VersionChanged: '1.31'
3626
3989
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3627
3990
  # needs to have to trigger this cop
3628
3991
  MinBodyLength: 1
3992
+ AllowConsecutiveConditionals: false
3629
3993
 
3630
3994
  Style/HashAsLastArrayItem:
3631
3995
  Description: >-
@@ -3643,8 +4007,9 @@ Style/HashConversion:
3643
4007
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3644
4008
  StyleGuide: '#avoid-hash-constructor'
3645
4009
  Enabled: pending
4010
+ SafeAutoCorrect: false
3646
4011
  VersionAdded: '1.10'
3647
- VersionChanged: '1.11'
4012
+ VersionChanged: '1.55'
3648
4013
  AllowSplatArgument: true
3649
4014
 
3650
4015
  Style/HashEachMethods:
@@ -3654,14 +4019,17 @@ Style/HashEachMethods:
3654
4019
  Safe: false
3655
4020
  VersionAdded: '0.80'
3656
4021
  VersionChanged: '1.16'
3657
- AllowedReceivers: []
4022
+ AllowedReceivers:
4023
+ - Thread.current
3658
4024
 
3659
4025
  Style/HashExcept:
3660
4026
  Description: >-
3661
4027
  Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3662
4028
  that can be replaced with `Hash#except` method.
3663
4029
  Enabled: pending
4030
+ Safe: false
3664
4031
  VersionAdded: '1.7'
4032
+ VersionChanged: '1.39'
3665
4033
 
3666
4034
  Style/HashLikeCase:
3667
4035
  Description: >-
@@ -3698,6 +4066,12 @@ Style/HashSyntax:
3698
4066
  - always
3699
4067
  # forces use of explicit hash literal value.
3700
4068
  - never
4069
+ # accepts both shorthand and explicit use of hash literal value.
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
3701
4075
  # Force hashes that have a symbol value to use hash rockets
3702
4076
  UseHashRocketsWithSymbolValues: false
3703
4077
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3810,16 +4184,35 @@ Style/InverseMethods:
3810
4184
  :=~: :!~
3811
4185
  :<: :>=
3812
4186
  :>: :<=
3813
- # `ActiveSupport` defines some common inverse methods. They are listed below,
3814
- # and not enabled by default.
3815
- #:present?: :blank?,
3816
- #:include?: :exclude?
3817
4187
  # `InverseBlocks` are methods that are inverted by inverting the return
3818
4188
  # of the block that is passed to the method
3819
4189
  InverseBlocks:
3820
4190
  :select: :reject
3821
4191
  :select!: :reject!
3822
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
+
3823
4216
  Style/IpAddresses:
3824
4217
  Description: "Don't include literal IP addresses in code."
3825
4218
  Enabled: false
@@ -3874,12 +4267,50 @@ Style/LineEndConcatenation:
3874
4267
  VersionAdded: '0.18'
3875
4268
  VersionChanged: '0.64'
3876
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
+
4290
+ Style/MapCompactWithConditionalBlock:
4291
+ Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
4292
+ Enabled: pending
4293
+ VersionAdded: '1.30'
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
+
3877
4302
  Style/MapToHash:
3878
4303
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
3879
4304
  Enabled: pending
3880
4305
  VersionAdded: '1.24'
3881
4306
  Safe: false
3882
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
+
3883
4314
  Style/MethodCallWithArgsParentheses:
3884
4315
  Description: 'Use parentheses for method calls with arguments.'
3885
4316
  StyleGuide: '#method-invocation-parens'
@@ -3887,8 +4318,8 @@ Style/MethodCallWithArgsParentheses:
3887
4318
  VersionAdded: '0.47'
3888
4319
  VersionChanged: '1.7'
3889
4320
  IgnoreMacros: true
3890
- IgnoredMethods: []
3891
- IgnoredPatterns: []
4321
+ AllowedMethods: []
4322
+ AllowedPatterns: []
3892
4323
  IncludedMacros: []
3893
4324
  AllowParenthesesInMultilineCall: false
3894
4325
  AllowParenthesesInChaining: false
@@ -3903,7 +4334,8 @@ Style/MethodCallWithoutArgsParentheses:
3903
4334
  Description: 'Do not use parentheses for method calls with no arguments.'
3904
4335
  StyleGuide: '#method-invocation-parens'
3905
4336
  Enabled: true
3906
- IgnoredMethods: []
4337
+ AllowedMethods: []
4338
+ AllowedPatterns: []
3907
4339
  VersionAdded: '0.47'
3908
4340
  VersionChanged: '0.55'
3909
4341
 
@@ -3934,6 +4366,12 @@ Style/MinMax:
3934
4366
  Enabled: true
3935
4367
  VersionAdded: '0.50'
3936
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
+
3937
4375
  Style/MissingElse:
3938
4376
  Description: >-
3939
4377
  Require if/case expressions to have an else branches.
@@ -4057,6 +4495,7 @@ Style/MultipleComparison:
4057
4495
  VersionAdded: '0.49'
4058
4496
  VersionChanged: '1.1'
4059
4497
  AllowMethodComparison: true
4498
+ ComparisonsThreshold: 2
4060
4499
 
4061
4500
  Style/MutableConstant:
4062
4501
  Description: 'Do not assign mutable objects to constants.'
@@ -4094,7 +4533,7 @@ Style/NegatedIf:
4094
4533
 
4095
4534
  Style/NegatedIfElseCondition:
4096
4535
  Description: >-
4097
- This cop checks for uses of `if-else` and ternary operators with a negated condition
4536
+ Checks for uses of `if-else` and ternary operators with a negated condition
4098
4537
  which can be simplified by inverting condition and swapping branches.
4099
4538
  Enabled: pending
4100
4539
  VersionAdded: '1.2'
@@ -4119,6 +4558,11 @@ Style/NegatedWhile:
4119
4558
  Enabled: true
4120
4559
  VersionAdded: '0.20'
4121
4560
 
4561
+ Style/NestedFileDirname:
4562
+ Description: 'Checks for nested `File.dirname`.'
4563
+ Enabled: pending
4564
+ VersionAdded: '1.26'
4565
+
4122
4566
  Style/NestedModifier:
4123
4567
  Description: 'Avoid using nested modifiers.'
4124
4568
  StyleGuide: '#no-nested-modifiers'
@@ -4250,17 +4694,17 @@ Style/NumericLiterals:
4250
4694
  Strict: false
4251
4695
  # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4252
4696
  AllowedNumbers: []
4697
+ AllowedPatterns: []
4253
4698
 
4254
4699
  Style/NumericPredicate:
4255
4700
  Description: >-
4256
4701
  Checks for the use of predicate- or comparison methods for
4257
4702
  numeric comparisons.
4258
4703
  StyleGuide: '#predicate-methods'
4259
- Safe: false
4260
4704
  # This will change to a new method call which isn't guaranteed to be on the
4261
4705
  # object. Switching these methods has to be done with knowledge of the types
4262
4706
  # of the variables which rubocop doesn't have.
4263
- SafeAutoCorrect: false
4707
+ Safe: false
4264
4708
  Enabled: true
4265
4709
  VersionAdded: '0.42'
4266
4710
  VersionChanged: '0.59'
@@ -4268,12 +4712,26 @@ Style/NumericPredicate:
4268
4712
  SupportedStyles:
4269
4713
  - predicate
4270
4714
  - comparison
4271
- IgnoredMethods: []
4715
+ AllowedMethods: []
4716
+ AllowedPatterns: []
4272
4717
  # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
4273
4718
  # false positives.
4274
4719
  Exclude:
4275
4720
  - 'spec/**/*'
4276
4721
 
4722
+ Style/ObjectThen:
4723
+ Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
4724
+ StyleGuide: '#object-yield-self-vs-object-then'
4725
+ Enabled: pending
4726
+ VersionAdded: '1.28'
4727
+ # Use `Object#yield_self` or `Object#then`?
4728
+ # Prefer `Object#yield_self` to `Object#then` (yield_self)
4729
+ # Prefer `Object#then` to `Object#yield_self` (then)
4730
+ EnforcedStyle: 'then'
4731
+ SupportedStyles:
4732
+ - then
4733
+ - yield_self
4734
+
4277
4735
  Style/OneLineConditional:
4278
4736
  Description: >-
4279
4737
  Favor the ternary operator (?:) or multi-line constructs over
@@ -4292,10 +4750,19 @@ Style/OpenStructUse:
4292
4750
  - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4293
4751
 
4294
4752
  Enabled: pending
4753
+ Safe: false
4295
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'
4296
4762
 
4297
4763
  Style/OptionHash:
4298
4764
  Description: "Don't use option hashes when you can use keyword arguments."
4765
+ StyleGuide: '#keyword-arguments-vs-option-hashes'
4299
4766
  Enabled: false
4300
4767
  VersionAdded: '0.33'
4301
4768
  VersionChanged: '0.34'
@@ -4418,8 +4885,9 @@ Style/RaiseArgs:
4418
4885
  Description: 'Checks the arguments passed to raise/fail.'
4419
4886
  StyleGuide: '#exception-class-messages'
4420
4887
  Enabled: true
4888
+ Safe: false
4421
4889
  VersionAdded: '0.14'
4422
- VersionChanged: '1.2'
4890
+ VersionChanged: '1.61'
4423
4891
  EnforcedStyle: exploded
4424
4892
  SupportedStyles:
4425
4893
  - compact # raise Exception.new(msg)
@@ -4439,10 +4907,16 @@ Style/RedundantArgument:
4439
4907
  Enabled: pending
4440
4908
  Safe: false
4441
4909
  VersionAdded: '1.4'
4442
- VersionChanged: '1.7'
4910
+ VersionChanged: '1.55'
4443
4911
  Methods:
4444
4912
  # Array#join
4445
4913
  join: ''
4914
+ # Array#sum
4915
+ sum: 0
4916
+ # Kernel.#exit
4917
+ exit: true
4918
+ # Kernel.#exit!
4919
+ exit!: false
4446
4920
  # String#split
4447
4921
  split: ' '
4448
4922
  # String#chomp
@@ -4450,6 +4924,11 @@ Style/RedundantArgument:
4450
4924
  # String#chomp!
4451
4925
  chomp!: "\n"
4452
4926
 
4927
+ Style/RedundantArrayConstructor:
4928
+ Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
4929
+ Enabled: pending
4930
+ VersionAdded: '1.52'
4931
+
4453
4932
  Style/RedundantAssignment:
4454
4933
  Description: 'Checks for redundant assignment before returning.'
4455
4934
  Enabled: true
@@ -4477,6 +4956,27 @@ Style/RedundantConditional:
4477
4956
  Enabled: true
4478
4957
  VersionAdded: '0.50'
4479
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
+
4480
4980
  Style/RedundantException:
4481
4981
  Description: "Checks for an obsolete RuntimeException argument in raise/fail."
4482
4982
  StyleGuide: '#no-explicit-runtimeerror'
@@ -4488,7 +4988,7 @@ Style/RedundantFetchBlock:
4488
4988
  Description: >-
4489
4989
  Use `fetch(key, value)` instead of `fetch(key) { value }`
4490
4990
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4491
- 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'
4492
4992
  Enabled: true
4493
4993
  Safe: false
4494
4994
  # If enabled, this cop will autocorrect usages of
@@ -4505,16 +5005,46 @@ Style/RedundantFileExtensionInRequire:
4505
5005
  Enabled: true
4506
5006
  VersionAdded: '0.88'
4507
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
+
4508
5017
  Style/RedundantFreeze:
4509
5018
  Description: "Checks usages of Object#freeze on immutable objects."
4510
5019
  Enabled: true
4511
5020
  VersionAdded: '0.34'
4512
5021
  VersionChanged: '0.66'
4513
5022
 
5023
+ Style/RedundantHeredocDelimiterQuotes:
5024
+ Description: 'Checks for redundant heredoc delimiter quotes.'
5025
+ Enabled: pending
5026
+ VersionAdded: '1.45'
5027
+
5028
+ Style/RedundantInitialize:
5029
+ Description: 'Checks for redundant `initialize` methods.'
5030
+ Enabled: pending
5031
+ AutoCorrect: contextual
5032
+ Safe: false
5033
+ AllowComments: true
5034
+ VersionAdded: '1.27'
5035
+ VersionChanged: '1.61'
5036
+
4514
5037
  Style/RedundantInterpolation:
4515
5038
  Description: 'Checks for strings that are just an interpolated expression.'
4516
5039
  Enabled: true
5040
+ SafeAutoCorrect: false
4517
5041
  VersionAdded: '0.76'
5042
+ VersionChanged: '1.30'
5043
+
5044
+ Style/RedundantLineContinuation:
5045
+ Description: 'Check for redundant line continuation.'
5046
+ Enabled: pending
5047
+ VersionAdded: '1.49'
4518
5048
 
4519
5049
  Style/RedundantParentheses:
4520
5050
  Description: "Checks for parentheses that seem not to serve any purpose."
@@ -4527,11 +5057,21 @@ Style/RedundantPercentQ:
4527
5057
  Enabled: true
4528
5058
  VersionAdded: '0.76'
4529
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
+
4530
5065
  Style/RedundantRegexpCharacterClass:
4531
5066
  Description: 'Checks for unnecessary single-element Regexp character classes.'
4532
5067
  Enabled: true
4533
5068
  VersionAdded: '0.85'
4534
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
+
4535
5075
  Style/RedundantRegexpEscape:
4536
5076
  Description: 'Checks for redundant escapes in Regexps.'
4537
5077
  Enabled: true
@@ -4578,6 +5118,11 @@ Style/RedundantSortBy:
4578
5118
  Enabled: true
4579
5119
  VersionAdded: '0.36'
4580
5120
 
5121
+ Style/RedundantStringEscape:
5122
+ Description: 'Checks for redundant escapes in string literals.'
5123
+ Enabled: pending
5124
+ VersionAdded: '1.37'
5125
+
4581
5126
  Style/RegexpLiteral:
4582
5127
  Description: 'Use / or %r around regular expressions.'
4583
5128
  StyleGuide: '#percent-r'
@@ -4596,6 +5141,12 @@ Style/RegexpLiteral:
4596
5141
  # are found in the regexp string.
4597
5142
  AllowInnerSlashes: false
4598
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
+
4599
5150
  Style/RescueModifier:
4600
5151
  Description: 'Avoid using rescue in its modifier form.'
4601
5152
  StyleGuide: '#no-rescue-modifiers'
@@ -4623,16 +5174,25 @@ Style/ReturnNil:
4623
5174
  - return_nil
4624
5175
  VersionAdded: '0.50'
4625
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
+
4626
5186
  Style/SafeNavigation:
4627
5187
  Description: >-
4628
- This cop transforms usages of a method call safeguarded by
5188
+ Transforms usages of a method call safeguarded by
4629
5189
  a check for the existence of the object to
4630
5190
  safe navigation (`&.`).
4631
- Auto-correction is unsafe as it assumes the object will
5191
+ Autocorrection is unsafe as it assumes the object will
4632
5192
  be `nil` or truthy, but never `false`.
4633
5193
  Enabled: true
4634
5194
  VersionAdded: '0.43'
4635
- VersionChanged: '0.77'
5195
+ VersionChanged: '1.27'
4636
5196
  # Safe navigation may cause a statement to start returning `nil` in addition
4637
5197
  # to whatever it used to return.
4638
5198
  ConvertCodeThatCanStartToReturnNil: false
@@ -4643,12 +5203,14 @@ Style/SafeNavigation:
4643
5203
  - try
4644
5204
  - try!
4645
5205
  SafeAutoCorrect: false
5206
+ # Maximum length of method chains for register an offense.
5207
+ MaxChainLength: 2
4646
5208
 
4647
5209
  Style/Sample:
4648
5210
  Description: >-
4649
5211
  Use `sample` instead of `shuffle.first`,
4650
5212
  `shuffle.last`, and `shuffle[Integer]`.
4651
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5213
+ Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
4652
5214
  Enabled: true
4653
5215
  VersionAdded: '0.30'
4654
5216
 
@@ -4682,6 +5244,13 @@ Style/Send:
4682
5244
  Enabled: false
4683
5245
  VersionAdded: '0.33'
4684
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
+
4685
5254
  Style/SignalException:
4686
5255
  Description: 'Checks for proper usage of fail and raise.'
4687
5256
  StyleGuide: '#prefer-raise-over-fail'
@@ -4713,6 +5282,12 @@ Style/SingleLineBlockParams:
4713
5282
  - acc
4714
5283
  - elem
4715
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
+
4716
5291
  Style/SingleLineMethods:
4717
5292
  Description: 'Avoid single-line methods.'
4718
5293
  StyleGuide: '#no-single-line-methods'
@@ -4722,7 +5297,8 @@ Style/SingleLineMethods:
4722
5297
  AllowIfMethodIsEmpty: true
4723
5298
 
4724
5299
  Style/SlicingWithRange:
4725
- 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'
4726
5302
  Enabled: true
4727
5303
  VersionAdded: '0.83'
4728
5304
  Safe: false
@@ -4748,6 +5324,7 @@ Style/SpecialGlobalVars:
4748
5324
  SupportedStyles:
4749
5325
  - use_perl_names
4750
5326
  - use_english_names
5327
+ - use_builtin_english_names
4751
5328
 
4752
5329
  Style/StabbyLambdaParentheses:
4753
5330
  Description: 'Check for the usage of parentheses around stabby lambda arguments.'
@@ -4848,8 +5425,19 @@ Style/StructInheritance:
4848
5425
  VersionAdded: '0.29'
4849
5426
  VersionChanged: '1.20'
4850
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
+
4851
5439
  Style/SwapValues:
4852
- Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
5440
+ Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
4853
5441
  StyleGuide: '#values-swapping'
4854
5442
  Enabled: pending
4855
5443
  VersionAdded: '1.1'
@@ -4877,13 +5465,14 @@ Style/SymbolProc:
4877
5465
  Enabled: true
4878
5466
  Safe: false
4879
5467
  VersionAdded: '0.26'
4880
- VersionChanged: '1.5'
5468
+ VersionChanged: '1.64'
4881
5469
  AllowMethodsWithArguments: false
4882
- # A list of method names to be ignored by the check.
5470
+ # A list of method names to be always allowed by the check.
4883
5471
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4884
- IgnoredMethods:
4885
- - respond_to
5472
+ AllowedMethods:
4886
5473
  - define_method
5474
+ AllowedPatterns: []
5475
+ AllowComments: false
4887
5476
 
4888
5477
  Style/TernaryParentheses:
4889
5478
  Description: 'Checks for use of parentheses around ternary conditions.'
@@ -4898,7 +5487,7 @@ Style/TernaryParentheses:
4898
5487
  AllowSafeAssignment: true
4899
5488
 
4900
5489
  Style/TopLevelMethodDefinition:
4901
- Description: 'This cop looks for top-level method definitions.'
5490
+ Description: 'Looks for top-level method definitions.'
4902
5491
  StyleGuide: '#top-level-methods'
4903
5492
  Enabled: false
4904
5493
  VersionAdded: '1.15'
@@ -5103,6 +5692,11 @@ Style/WordArray:
5103
5692
  # The regular expression `WordRegex` decides what is considered a word.
5104
5693
  WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
5105
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
+
5106
5700
  Style/YodaCondition:
5107
5701
  Description: 'Forbid or enforce yoda conditions.'
5108
5702
  Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
@@ -5121,6 +5715,19 @@ Style/YodaCondition:
5121
5715
  VersionAdded: '0.49'
5122
5716
  VersionChanged: '0.75'
5123
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
+
5124
5731
  Style/ZeroLengthPredicate:
5125
5732
  Description: 'Use #empty? when testing for objects of length 0.'
5126
5733
  Enabled: true