rubocop 1.18.0 → 1.56.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (735) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +10 -7
  4. data/config/default.yml +778 -118
  5. data/config/obsoletion.yml +40 -2
  6. data/exe/rubocop +15 -7
  7. data/lib/rubocop/arguments_env.rb +17 -0
  8. data/lib/rubocop/arguments_file.rb +17 -0
  9. data/lib/rubocop/cache_config.rb +29 -0
  10. data/lib/rubocop/cli/command/{auto_genenerate_config.rb → auto_generate_config.rb} +28 -6
  11. data/lib/rubocop/cli/command/execute_runner.rb +15 -10
  12. data/lib/rubocop/cli/command/init_dotfile.rb +2 -2
  13. data/lib/rubocop/cli/command/lsp.rb +19 -0
  14. data/lib/rubocop/cli/command/show_cops.rb +1 -1
  15. data/lib/rubocop/cli/command/show_docs_url.rb +48 -0
  16. data/lib/rubocop/cli/command/suggest_extensions.rb +62 -17
  17. data/lib/rubocop/cli.rb +79 -9
  18. data/lib/rubocop/comment_config.rb +60 -1
  19. data/lib/rubocop/config.rb +57 -20
  20. data/lib/rubocop/config_finder.rb +68 -0
  21. data/lib/rubocop/config_loader.rb +53 -71
  22. data/lib/rubocop/config_loader_resolver.rb +31 -16
  23. data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
  24. data/lib/rubocop/config_obsoletion/extracted_cop.rb +3 -1
  25. data/lib/rubocop/config_obsoletion/parameter_rule.rb +13 -1
  26. data/lib/rubocop/config_obsoletion.rb +9 -4
  27. data/lib/rubocop/config_validator.rb +49 -11
  28. data/lib/rubocop/cop/autocorrect_logic.rb +36 -14
  29. data/lib/rubocop/cop/badge.rb +15 -4
  30. data/lib/rubocop/cop/base.rb +124 -88
  31. data/lib/rubocop/cop/bundler/duplicated_gem.rb +5 -8
  32. data/lib/rubocop/cop/bundler/duplicated_group.rb +81 -0
  33. data/lib/rubocop/cop/bundler/gem_comment.rb +5 -5
  34. data/lib/rubocop/cop/bundler/gem_filename.rb +103 -0
  35. data/lib/rubocop/cop/bundler/gem_version.rb +2 -2
  36. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +45 -21
  37. data/lib/rubocop/cop/bundler/ordered_gems.rb +14 -15
  38. data/lib/rubocop/cop/commissioner.rb +19 -6
  39. data/lib/rubocop/cop/cop.rb +54 -34
  40. data/lib/rubocop/cop/corrector.rb +33 -13
  41. data/lib/rubocop/cop/correctors/alignment_corrector.rb +4 -4
  42. data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -1
  43. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +5 -5
  44. data/lib/rubocop/cop/correctors/empty_line_corrector.rb +1 -1
  45. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +7 -5
  46. data/lib/rubocop/cop/correctors/if_then_corrector.rb +55 -0
  47. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +3 -3
  48. data/lib/rubocop/cop/correctors/line_break_corrector.rb +9 -3
  49. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +26 -10
  50. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +10 -14
  51. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +59 -1
  52. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +3 -3
  53. data/lib/rubocop/cop/correctors/punctuation_corrector.rb +1 -1
  54. data/lib/rubocop/cop/correctors/require_library_corrector.rb +23 -0
  55. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -1
  56. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +1 -1
  57. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +2 -2
  58. data/lib/rubocop/cop/documentation.rb +20 -3
  59. data/lib/rubocop/cop/gemspec/dependency_version.rb +154 -0
  60. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +92 -0
  61. data/lib/rubocop/cop/gemspec/development_dependencies.rb +107 -0
  62. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +6 -22
  63. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +13 -14
  64. data/lib/rubocop/cop/gemspec/require_mfa.rb +145 -0
  65. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +41 -27
  66. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +4 -11
  67. data/lib/rubocop/cop/generator/require_file_injector.rb +3 -3
  68. data/lib/rubocop/cop/generator.rb +26 -21
  69. data/lib/rubocop/cop/internal_affairs/cop_description.rb +122 -0
  70. data/lib/rubocop/cop/internal_affairs/create_empty_file.rb +37 -0
  71. data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +1 -1
  72. data/lib/rubocop/cop/internal_affairs/example_description.rb +2 -1
  73. data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +111 -0
  74. data/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb +34 -0
  75. data/lib/rubocop/cop/internal_affairs/lambda_or_proc.rb +46 -0
  76. data/lib/rubocop/cop/internal_affairs/location_expression.rb +37 -0
  77. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +62 -0
  78. data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +80 -0
  79. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +7 -11
  80. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
  81. data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
  82. data/lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb +42 -0
  83. data/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb +46 -0
  84. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +1 -1
  85. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +12 -4
  86. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
  87. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
  88. data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +47 -0
  89. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +66 -0
  90. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +62 -0
  91. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +73 -0
  92. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +60 -0
  93. data/lib/rubocop/cop/internal_affairs.rb +16 -0
  94. data/lib/rubocop/cop/layout/argument_alignment.rb +57 -9
  95. data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
  96. data/lib/rubocop/cop/layout/assignment_indentation.rb +2 -2
  97. data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -1
  98. data/lib/rubocop/cop/layout/block_alignment.rb +20 -16
  99. data/lib/rubocop/cop/layout/block_end_newline.rb +32 -10
  100. data/lib/rubocop/cop/layout/case_indentation.rb +17 -1
  101. data/lib/rubocop/cop/layout/class_structure.rb +49 -27
  102. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +2 -3
  103. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +3 -7
  104. data/lib/rubocop/cop/layout/comment_indentation.rb +36 -5
  105. data/lib/rubocop/cop/layout/condition_position.rb +1 -1
  106. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  107. data/lib/rubocop/cop/layout/dot_position.rb +39 -6
  108. data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
  109. data/lib/rubocop/cop/layout/empty_comment.rb +5 -5
  110. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +11 -2
  111. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
  112. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +51 -7
  113. data/lib/rubocop/cop/layout/empty_lines.rb +4 -2
  114. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +7 -2
  115. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
  116. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +25 -4
  117. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
  118. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +7 -5
  119. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +10 -10
  120. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +14 -5
  121. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
  122. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +10 -10
  123. data/lib/rubocop/cop/layout/end_alignment.rb +18 -3
  124. data/lib/rubocop/cop/layout/end_of_line.rb +5 -5
  125. data/lib/rubocop/cop/layout/extra_spacing.rb +16 -7
  126. data/lib/rubocop/cop/layout/first_argument_indentation.rb +43 -32
  127. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +22 -15
  128. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +36 -9
  129. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +53 -14
  130. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +37 -2
  131. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +58 -9
  132. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +53 -20
  133. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
  134. data/lib/rubocop/cop/layout/hash_alignment.rb +30 -19
  135. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +12 -6
  136. data/lib/rubocop/cop/layout/heredoc_indentation.rb +9 -19
  137. data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
  138. data/lib/rubocop/cop/layout/indentation_style.rb +11 -6
  139. data/lib/rubocop/cop/layout/indentation_width.rb +21 -15
  140. data/lib/rubocop/cop/layout/initial_indentation.rb +3 -3
  141. data/lib/rubocop/cop/layout/leading_comment_space.rb +4 -4
  142. data/lib/rubocop/cop/layout/leading_empty_lines.rb +1 -1
  143. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +136 -0
  144. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +140 -0
  145. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +40 -19
  146. data/lib/rubocop/cop/layout/line_length.rb +22 -13
  147. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
  148. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +32 -2
  149. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +3 -3
  150. data/lib/rubocop/cop/layout/multiline_block_layout.rb +7 -5
  151. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +1 -1
  152. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +30 -2
  153. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +42 -2
  154. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
  155. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +23 -6
  156. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
  157. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +77 -0
  158. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +9 -10
  159. data/lib/rubocop/cop/layout/redundant_line_break.rb +23 -16
  160. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +26 -13
  161. data/lib/rubocop/cop/layout/single_line_block_chain.rb +16 -5
  162. data/lib/rubocop/cop/layout/space_after_colon.rb +1 -1
  163. data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
  164. data/lib/rubocop/cop/layout/space_after_not.rb +2 -1
  165. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +3 -3
  166. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +2 -1
  167. data/lib/rubocop/cop/layout/space_around_keyword.rb +5 -5
  168. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +2 -2
  169. data/lib/rubocop/cop/layout/space_around_operators.rb +17 -4
  170. data/lib/rubocop/cop/layout/space_before_block_braces.rb +5 -3
  171. data/lib/rubocop/cop/layout/space_before_brackets.rb +8 -0
  172. data/lib/rubocop/cop/layout/space_before_comment.rb +3 -3
  173. data/lib/rubocop/cop/layout/space_before_first_arg.rb +6 -2
  174. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +14 -8
  175. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +32 -30
  176. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -0
  177. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +35 -15
  178. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +30 -3
  179. data/lib/rubocop/cop/layout/space_inside_parens.rb +79 -33
  180. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +34 -0
  181. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
  182. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +12 -8
  183. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +6 -5
  184. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +15 -10
  185. data/lib/rubocop/cop/layout/trailing_whitespace.rb +37 -7
  186. data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
  187. data/lib/rubocop/cop/legacy/corrector.rb +1 -1
  188. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -1
  189. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +41 -8
  190. data/lib/rubocop/cop/lint/ambiguous_operator.rb +11 -7
  191. data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +111 -0
  192. data/lib/rubocop/cop/lint/ambiguous_range.rb +105 -0
  193. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +11 -4
  194. data/lib/rubocop/cop/lint/assignment_in_condition.rb +19 -7
  195. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +19 -6
  196. data/lib/rubocop/cop/lint/boolean_symbol.rb +6 -1
  197. data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
  198. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +1 -1
  199. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +51 -0
  200. data/lib/rubocop/cop/lint/constant_resolution.rb +5 -1
  201. data/lib/rubocop/cop/lint/debugger.rb +35 -37
  202. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +69 -101
  203. data/lib/rubocop/cop/lint/deprecated_constants.rb +12 -4
  204. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +7 -1
  205. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +24 -1
  206. data/lib/rubocop/cop/lint/duplicate_branch.rb +3 -4
  207. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
  208. data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +1 -1
  209. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +3 -2
  210. data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
  211. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +122 -0
  212. data/lib/rubocop/cop/lint/duplicate_methods.rb +56 -23
  213. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +56 -12
  214. data/lib/rubocop/cop/lint/duplicate_require.rb +11 -2
  215. data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +1 -1
  216. data/lib/rubocop/cop/lint/each_with_object_argument.rb +2 -2
  217. data/lib/rubocop/cop/lint/else_layout.rb +11 -11
  218. data/lib/rubocop/cop/lint/empty_block.rb +4 -8
  219. data/lib/rubocop/cop/lint/empty_class.rb +4 -2
  220. data/lib/rubocop/cop/lint/empty_conditional_body.rb +114 -4
  221. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  222. data/lib/rubocop/cop/lint/empty_expression.rb +1 -1
  223. data/lib/rubocop/cop/lint/empty_file.rb +1 -1
  224. data/lib/rubocop/cop/lint/empty_in_pattern.rb +4 -2
  225. data/lib/rubocop/cop/lint/empty_interpolation.rb +2 -2
  226. data/lib/rubocop/cop/lint/empty_when.rb +4 -2
  227. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  228. data/lib/rubocop/cop/lint/erb_new_arguments.rb +14 -15
  229. data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
  230. data/lib/rubocop/cop/lint/float_comparison.rb +1 -1
  231. data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -2
  232. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +14 -7
  233. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +12 -3
  234. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +17 -19
  235. data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
  236. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +2 -2
  237. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +81 -0
  238. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +2 -2
  239. data/lib/rubocop/cop/lint/inherit_exception.rb +28 -28
  240. data/lib/rubocop/cop/lint/interpolation_check.rb +8 -2
  241. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +11 -4
  242. data/lib/rubocop/cop/lint/literal_as_condition.rb +6 -1
  243. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +49 -3
  244. data/lib/rubocop/cop/lint/loop.rb +5 -4
  245. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +19 -4
  246. data/lib/rubocop/cop/lint/missing_super.rb +64 -6
  247. data/lib/rubocop/cop/lint/mixed_case_range.rb +111 -0
  248. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
  249. data/lib/rubocop/cop/lint/nested_method_definition.rb +54 -10
  250. data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
  251. data/lib/rubocop/cop/lint/next_without_accumulator.rb +25 -6
  252. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +162 -0
  253. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +21 -5
  254. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
  255. data/lib/rubocop/cop/lint/number_conversion.rb +52 -11
  256. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +4 -4
  257. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +6 -3
  258. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +4 -6
  259. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +34 -2
  260. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +17 -8
  261. data/lib/rubocop/cop/lint/percent_string_array.rb +12 -2
  262. data/lib/rubocop/cop/lint/percent_symbol_array.rb +2 -2
  263. data/lib/rubocop/cop/lint/raise_exception.rb +5 -1
  264. data/lib/rubocop/cop/lint/rand_one.rb +1 -1
  265. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +55 -15
  266. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +8 -8
  267. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +12 -0
  268. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
  269. data/lib/rubocop/cop/lint/redundant_require_statement.rb +53 -7
  270. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +18 -4
  271. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +2 -2
  272. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +35 -15
  273. data/lib/rubocop/cop/lint/redundant_with_index.rb +15 -12
  274. data/lib/rubocop/cop/lint/redundant_with_object.rb +14 -13
  275. data/lib/rubocop/cop/lint/refinement_import_methods.rb +52 -0
  276. data/lib/rubocop/cop/lint/regexp_as_condition.rb +9 -3
  277. data/lib/rubocop/cop/lint/require_parentheses.rb +4 -2
  278. data/lib/rubocop/cop/lint/require_range_parentheses.rb +57 -0
  279. data/lib/rubocop/cop/lint/require_relative_self_path.rb +50 -0
  280. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  281. data/lib/rubocop/cop/lint/rescue_type.rb +3 -3
  282. data/lib/rubocop/cop/lint/return_in_void_context.rb +6 -18
  283. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +44 -8
  284. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +2 -2
  285. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  286. data/lib/rubocop/cop/lint/script_permission.rb +2 -2
  287. data/lib/rubocop/cop/lint/self_assignment.rb +1 -1
  288. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +6 -6
  289. data/lib/rubocop/cop/lint/shadowed_argument.rb +2 -2
  290. data/lib/rubocop/cop/lint/shadowed_exception.rb +22 -23
  291. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +43 -2
  292. data/lib/rubocop/cop/lint/struct_new_override.rb +15 -15
  293. data/lib/rubocop/cop/lint/suppressed_exception.rb +4 -4
  294. data/lib/rubocop/cop/lint/symbol_conversion.rb +6 -5
  295. data/lib/rubocop/cop/lint/syntax.rb +6 -3
  296. data/lib/rubocop/cop/lint/to_enum_arguments.rb +14 -4
  297. data/lib/rubocop/cop/lint/to_json.rb +1 -1
  298. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +24 -10
  299. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +2 -2
  300. data/lib/rubocop/cop/lint/triple_quotes.rb +1 -1
  301. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -1
  302. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +9 -4
  303. data/lib/rubocop/cop/lint/unified_integer.rb +3 -1
  304. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  305. data/lib/rubocop/cop/lint/unreachable_loop.rb +15 -9
  306. data/lib/rubocop/cop/lint/unused_block_argument.rb +1 -1
  307. data/lib/rubocop/cop/lint/unused_method_argument.rb +10 -6
  308. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
  309. data/lib/rubocop/cop/lint/uri_regexp.rb +1 -1
  310. data/lib/rubocop/cop/lint/useless_access_modifier.rb +18 -13
  311. data/lib/rubocop/cop/lint/useless_assignment.rb +60 -2
  312. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +2 -3
  313. data/lib/rubocop/cop/lint/useless_method_definition.rb +16 -7
  314. data/lib/rubocop/cop/lint/useless_rescue.rb +89 -0
  315. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +127 -0
  316. data/lib/rubocop/cop/lint/useless_setter_call.rb +8 -5
  317. data/lib/rubocop/cop/lint/useless_times.rb +21 -16
  318. data/lib/rubocop/cop/lint/void.rb +86 -21
  319. data/lib/rubocop/cop/metrics/abc_size.rb +11 -3
  320. data/lib/rubocop/cop/metrics/block_length.rb +18 -12
  321. data/lib/rubocop/cop/metrics/block_nesting.rb +3 -3
  322. data/lib/rubocop/cop/metrics/class_length.rb +11 -5
  323. data/lib/rubocop/cop/metrics/collection_literal_length.rb +76 -0
  324. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +2 -11
  325. data/lib/rubocop/cop/metrics/method_length.rb +19 -12
  326. data/lib/rubocop/cop/metrics/module_length.rb +11 -6
  327. data/lib/rubocop/cop/metrics/parameter_lists.rb +33 -3
  328. data/lib/rubocop/cop/metrics/perceived_complexity.rb +2 -2
  329. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +7 -12
  330. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +61 -11
  331. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +1 -1
  332. data/lib/rubocop/cop/migration/department_name.rb +3 -3
  333. data/lib/rubocop/cop/mixin/alignment.rb +2 -2
  334. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +2 -2
  335. data/lib/rubocop/cop/mixin/allowed_methods.rb +23 -2
  336. data/lib/rubocop/cop/mixin/allowed_pattern.rb +56 -0
  337. data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
  338. data/lib/rubocop/cop/mixin/annotation_comment.rb +58 -28
  339. data/lib/rubocop/cop/mixin/check_line_breakable.rb +7 -3
  340. data/lib/rubocop/cop/mixin/code_length.rb +2 -2
  341. data/lib/rubocop/cop/mixin/comments_help.rb +47 -3
  342. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +21 -9
  343. data/lib/rubocop/cop/mixin/def_node.rb +3 -8
  344. data/lib/rubocop/cop/mixin/documentation_comment.rb +6 -3
  345. data/lib/rubocop/cop/mixin/duplication.rb +1 -1
  346. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +2 -3
  347. data/lib/rubocop/cop/mixin/enforce_superclass.rb +7 -1
  348. data/lib/rubocop/cop/mixin/first_element_line_break.rb +11 -7
  349. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +27 -1
  350. data/lib/rubocop/cop/mixin/gemspec_help.rb +30 -0
  351. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +5 -4
  352. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +226 -0
  353. data/lib/rubocop/cop/mixin/hash_transform_method.rb +21 -12
  354. data/lib/rubocop/cop/mixin/heredoc.rb +11 -2
  355. data/lib/rubocop/cop/mixin/line_length_help.rb +28 -8
  356. data/lib/rubocop/cop/mixin/method_complexity.rb +13 -16
  357. data/lib/rubocop/cop/mixin/min_branches_count.rb +40 -0
  358. data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +35 -13
  359. data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +5 -6
  360. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +6 -5
  361. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -1
  362. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +10 -2
  363. data/lib/rubocop/cop/mixin/percent_array.rb +75 -7
  364. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  365. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +15 -7
  366. data/lib/rubocop/cop/mixin/preferred_delimiters.rb +2 -2
  367. data/lib/rubocop/cop/mixin/range_help.rb +28 -7
  368. data/lib/rubocop/cop/mixin/require_library.rb +61 -0
  369. data/lib/rubocop/cop/mixin/rescue_node.rb +5 -3
  370. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +2 -2
  371. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +2 -2
  372. data/lib/rubocop/cop/mixin/statement_modifier.rb +19 -4
  373. data/lib/rubocop/cop/mixin/string_help.rb +5 -3
  374. data/lib/rubocop/cop/mixin/surrounding_space.rb +17 -13
  375. data/lib/rubocop/cop/mixin/trailing_body.rb +1 -1
  376. data/lib/rubocop/cop/mixin/trailing_comma.rb +4 -4
  377. data/lib/rubocop/cop/mixin/visibility_help.rb +40 -5
  378. data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -2
  379. data/lib/rubocop/cop/naming/ascii_identifiers.rb +2 -5
  380. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  381. data/lib/rubocop/cop/naming/block_forwarding.rb +125 -0
  382. data/lib/rubocop/cop/naming/block_parameter_name.rb +3 -3
  383. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +4 -2
  384. data/lib/rubocop/cop/naming/constant_name.rb +5 -5
  385. data/lib/rubocop/cop/naming/file_name.rb +39 -6
  386. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +2 -2
  387. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +4 -2
  388. data/lib/rubocop/cop/naming/inclusive_language.rb +58 -18
  389. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +30 -14
  390. data/lib/rubocop/cop/naming/method_name.rb +9 -9
  391. data/lib/rubocop/cop/naming/method_parameter_name.rb +2 -2
  392. data/lib/rubocop/cop/naming/predicate_name.rb +33 -4
  393. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +20 -5
  394. data/lib/rubocop/cop/naming/variable_name.rb +15 -1
  395. data/lib/rubocop/cop/naming/variable_number.rb +28 -18
  396. data/lib/rubocop/cop/offense.rb +1 -1
  397. data/lib/rubocop/cop/registry.rb +73 -45
  398. data/lib/rubocop/cop/security/compound_hash.rb +106 -0
  399. data/lib/rubocop/cop/security/eval.rb +1 -1
  400. data/lib/rubocop/cop/security/io_methods.rb +49 -0
  401. data/lib/rubocop/cop/security/json_load.rb +9 -8
  402. data/lib/rubocop/cop/security/marshal_load.rb +1 -1
  403. data/lib/rubocop/cop/security/open.rb +15 -1
  404. data/lib/rubocop/cop/security/yaml_load.rb +14 -4
  405. data/lib/rubocop/cop/style/access_modifier_declarations.rb +92 -3
  406. data/lib/rubocop/cop/style/accessor_grouping.rb +54 -24
  407. data/lib/rubocop/cop/style/alias.rb +22 -13
  408. data/lib/rubocop/cop/style/and_or.rb +14 -9
  409. data/lib/rubocop/cop/style/arguments_forwarding.rb +276 -58
  410. data/lib/rubocop/cop/style/array_coercion.rb +22 -4
  411. data/lib/rubocop/cop/style/array_intersect.rb +111 -0
  412. data/lib/rubocop/cop/style/array_join.rb +1 -1
  413. data/lib/rubocop/cop/style/ascii_comments.rb +2 -5
  414. data/lib/rubocop/cop/style/attr.rb +12 -2
  415. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +1 -1
  416. data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
  417. data/lib/rubocop/cop/style/begin_block.rb +1 -2
  418. data/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb +1 -1
  419. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +2 -2
  420. data/lib/rubocop/cop/style/block_comments.rb +4 -4
  421. data/lib/rubocop/cop/style/block_delimiters.rb +103 -13
  422. data/lib/rubocop/cop/style/case_equality.rb +47 -20
  423. data/lib/rubocop/cop/style/case_like_if.rb +26 -4
  424. data/lib/rubocop/cop/style/character_literal.rb +10 -3
  425. data/lib/rubocop/cop/style/class_and_module_children.rb +18 -16
  426. data/lib/rubocop/cop/style/class_check.rb +1 -1
  427. data/lib/rubocop/cop/style/class_equality_comparison.rb +75 -13
  428. data/lib/rubocop/cop/style/class_methods.rb +1 -1
  429. data/lib/rubocop/cop/style/class_methods_definitions.rb +3 -2
  430. data/lib/rubocop/cop/style/class_vars.rb +1 -1
  431. data/lib/rubocop/cop/style/collection_compact.rb +64 -22
  432. data/lib/rubocop/cop/style/collection_methods.rb +11 -7
  433. data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
  434. data/lib/rubocop/cop/style/colon_method_definition.rb +1 -1
  435. data/lib/rubocop/cop/style/combinable_loops.rb +35 -11
  436. data/lib/rubocop/cop/style/command_literal.rb +2 -2
  437. data/lib/rubocop/cop/style/comment_annotation.rb +57 -27
  438. data/lib/rubocop/cop/style/commented_keyword.rb +13 -7
  439. data/lib/rubocop/cop/style/comparable_clamp.rb +125 -0
  440. data/lib/rubocop/cop/style/concat_array_literals.rb +94 -0
  441. data/lib/rubocop/cop/style/conditional_assignment.rb +32 -21
  442. data/lib/rubocop/cop/style/constant_visibility.rb +1 -1
  443. data/lib/rubocop/cop/style/copyright.rb +6 -3
  444. data/lib/rubocop/cop/style/data_inheritance.rb +75 -0
  445. data/lib/rubocop/cop/style/date_time.rb +6 -1
  446. data/lib/rubocop/cop/style/def_with_parentheses.rb +17 -12
  447. data/lib/rubocop/cop/style/dir.rb +4 -1
  448. data/lib/rubocop/cop/style/dir_empty.rb +54 -0
  449. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +2 -2
  450. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +4 -4
  451. data/lib/rubocop/cop/style/documentation.rb +40 -13
  452. data/lib/rubocop/cop/style/documentation_method.rb +11 -5
  453. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +1 -7
  454. data/lib/rubocop/cop/style/double_negation.rb +87 -7
  455. data/lib/rubocop/cop/style/each_for_simple_loop.rb +42 -7
  456. data/lib/rubocop/cop/style/each_with_object.rb +41 -10
  457. data/lib/rubocop/cop/style/empty_block_parameter.rb +3 -3
  458. data/lib/rubocop/cop/style/empty_case_condition.rb +13 -4
  459. data/lib/rubocop/cop/style/empty_else.rb +40 -3
  460. data/lib/rubocop/cop/style/empty_heredoc.rb +73 -0
  461. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +3 -3
  462. data/lib/rubocop/cop/style/empty_literal.rb +2 -2
  463. data/lib/rubocop/cop/style/empty_method.rb +20 -5
  464. data/lib/rubocop/cop/style/encoding.rb +27 -16
  465. data/lib/rubocop/cop/style/end_block.rb +1 -1
  466. data/lib/rubocop/cop/style/endless_method.rb +2 -2
  467. data/lib/rubocop/cop/style/env_home.rb +56 -0
  468. data/lib/rubocop/cop/style/eval_with_location.rb +10 -10
  469. data/lib/rubocop/cop/style/even_odd.rb +1 -1
  470. data/lib/rubocop/cop/style/exact_regexp_match.rb +68 -0
  471. data/lib/rubocop/cop/style/expand_path_arguments.rb +1 -1
  472. data/lib/rubocop/cop/style/explicit_block_argument.rb +53 -14
  473. data/lib/rubocop/cop/style/exponential_notation.rb +1 -1
  474. data/lib/rubocop/cop/style/fetch_env_var.rb +132 -0
  475. data/lib/rubocop/cop/style/file_empty.rb +71 -0
  476. data/lib/rubocop/cop/style/file_read.rb +112 -0
  477. data/lib/rubocop/cop/style/file_write.rb +136 -0
  478. data/lib/rubocop/cop/style/float_division.rb +11 -3
  479. data/lib/rubocop/cop/style/for.rb +7 -1
  480. data/lib/rubocop/cop/style/format_string.rb +1 -1
  481. data/lib/rubocop/cop/style/format_string_token.rb +74 -23
  482. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +24 -8
  483. data/lib/rubocop/cop/style/global_std_stream.rb +5 -1
  484. data/lib/rubocop/cop/style/global_vars.rb +1 -1
  485. data/lib/rubocop/cop/style/guard_clause.rb +161 -25
  486. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +12 -0
  487. data/lib/rubocop/cop/style/hash_conversion.rb +13 -2
  488. data/lib/rubocop/cop/style/hash_each_methods.rb +42 -22
  489. data/lib/rubocop/cop/style/hash_except.rb +105 -13
  490. data/lib/rubocop/cop/style/hash_like_case.rb +4 -10
  491. data/lib/rubocop/cop/style/hash_syntax.rb +66 -6
  492. data/lib/rubocop/cop/style/hash_transform_keys.rb +15 -15
  493. data/lib/rubocop/cop/style/hash_transform_values.rb +15 -14
  494. data/lib/rubocop/cop/style/identical_conditional_branches.rb +51 -5
  495. data/lib/rubocop/cop/style/if_inside_else.rb +21 -0
  496. data/lib/rubocop/cop/style/if_unless_modifier.rb +117 -20
  497. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +49 -8
  498. data/lib/rubocop/cop/style/if_with_semicolon.rb +6 -6
  499. data/lib/rubocop/cop/style/implicit_runtime_error.rb +3 -3
  500. data/lib/rubocop/cop/style/in_pattern_then.rb +1 -1
  501. data/lib/rubocop/cop/style/infinite_loop.rb +6 -8
  502. data/lib/rubocop/cop/style/inline_comment.rb +1 -1
  503. data/lib/rubocop/cop/style/inverse_methods.rb +26 -15
  504. data/lib/rubocop/cop/style/invertible_unless_condition.rb +118 -0
  505. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  506. data/lib/rubocop/cop/style/keyword_parameters_order.rb +2 -2
  507. data/lib/rubocop/cop/style/lambda.rb +4 -4
  508. data/lib/rubocop/cop/style/lambda_call.rb +19 -22
  509. data/lib/rubocop/cop/style/line_end_concatenation.rb +20 -4
  510. data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
  511. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +136 -0
  512. data/lib/rubocop/cop/style/map_to_hash.rb +71 -0
  513. data/lib/rubocop/cop/style/map_to_set.rb +64 -0
  514. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +64 -24
  515. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +6 -2
  516. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +52 -43
  517. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +22 -3
  518. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +5 -2
  519. data/lib/rubocop/cop/style/method_def_parentheses.rb +31 -11
  520. data/lib/rubocop/cop/style/min_max.rb +4 -4
  521. data/lib/rubocop/cop/style/min_max_comparison.rb +83 -0
  522. data/lib/rubocop/cop/style/missing_else.rb +44 -25
  523. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +1 -1
  524. data/lib/rubocop/cop/style/mixin_grouping.rb +7 -7
  525. data/lib/rubocop/cop/style/mixin_usage.rb +1 -1
  526. data/lib/rubocop/cop/style/module_function.rb +33 -12
  527. data/lib/rubocop/cop/style/multiline_block_chain.rb +4 -2
  528. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -6
  529. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  530. data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +4 -6
  531. data/lib/rubocop/cop/style/multiline_memoization.rb +3 -3
  532. data/lib/rubocop/cop/style/multiline_method_signature.rb +9 -6
  533. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +52 -11
  534. data/lib/rubocop/cop/style/multiline_when_then.rb +3 -5
  535. data/lib/rubocop/cop/style/multiple_comparison.rb +15 -1
  536. data/lib/rubocop/cop/style/mutable_constant.rb +80 -15
  537. data/lib/rubocop/cop/style/negated_if.rb +1 -1
  538. data/lib/rubocop/cop/style/negated_if_else_condition.rb +18 -11
  539. data/lib/rubocop/cop/style/negated_unless.rb +1 -1
  540. data/lib/rubocop/cop/style/nested_file_dirname.rb +66 -0
  541. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  542. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +11 -2
  543. data/lib/rubocop/cop/style/nested_ternary_operator.rb +20 -8
  544. data/lib/rubocop/cop/style/next.rb +4 -6
  545. data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
  546. data/lib/rubocop/cop/style/nil_lambda.rb +5 -5
  547. data/lib/rubocop/cop/style/non_nil_check.rb +3 -3
  548. data/lib/rubocop/cop/style/not.rb +4 -4
  549. data/lib/rubocop/cop/style/numbered_parameters.rb +46 -0
  550. data/lib/rubocop/cop/style/numbered_parameters_limit.rb +58 -0
  551. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
  552. data/lib/rubocop/cop/style/numeric_literals.rb +33 -10
  553. data/lib/rubocop/cop/style/numeric_predicate.rb +58 -11
  554. data/lib/rubocop/cop/style/object_then.rb +74 -0
  555. data/lib/rubocop/cop/style/one_line_conditional.rb +16 -40
  556. data/lib/rubocop/cop/style/open_struct_use.rb +69 -0
  557. data/lib/rubocop/cop/style/operator_method_call.rb +67 -0
  558. data/lib/rubocop/cop/style/option_hash.rb +1 -1
  559. data/lib/rubocop/cop/style/optional_arguments.rb +5 -1
  560. data/lib/rubocop/cop/style/optional_boolean_parameter.rb +16 -5
  561. data/lib/rubocop/cop/style/or_assignment.rb +1 -1
  562. data/lib/rubocop/cop/style/parallel_assignment.rb +30 -20
  563. data/lib/rubocop/cop/style/parentheses_around_condition.rb +13 -3
  564. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +3 -4
  565. data/lib/rubocop/cop/style/percent_q_literals.rb +4 -4
  566. data/lib/rubocop/cop/style/perl_backrefs.rb +23 -2
  567. data/lib/rubocop/cop/style/preferred_hash_methods.rb +10 -5
  568. data/lib/rubocop/cop/style/proc.rb +5 -2
  569. data/lib/rubocop/cop/style/quoted_symbols.rb +22 -8
  570. data/lib/rubocop/cop/style/raise_args.rb +11 -5
  571. data/lib/rubocop/cop/style/random_with_offset.rb +1 -1
  572. data/lib/rubocop/cop/style/redundant_argument.rb +30 -12
  573. data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
  574. data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
  575. data/lib/rubocop/cop/style/redundant_begin.rb +46 -11
  576. data/lib/rubocop/cop/style/redundant_capital_w.rb +2 -3
  577. data/lib/rubocop/cop/style/redundant_condition.rb +150 -17
  578. data/lib/rubocop/cop/style/redundant_conditional.rb +2 -6
  579. data/lib/rubocop/cop/style/redundant_constant_base.rb +85 -0
  580. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +38 -0
  581. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +45 -0
  582. data/lib/rubocop/cop/style/redundant_each.rb +116 -0
  583. data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
  584. data/lib/rubocop/cop/style/redundant_fetch_block.rb +11 -5
  585. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +13 -4
  586. data/lib/rubocop/cop/style/redundant_filter_chain.rb +101 -0
  587. data/lib/rubocop/cop/style/redundant_freeze.rb +5 -5
  588. data/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb +58 -0
  589. data/lib/rubocop/cop/style/redundant_initialize.rb +156 -0
  590. data/lib/rubocop/cop/style/redundant_interpolation.rb +41 -6
  591. data/lib/rubocop/cop/style/redundant_line_continuation.rb +183 -0
  592. data/lib/rubocop/cop/style/redundant_parentheses.rb +23 -25
  593. data/lib/rubocop/cop/style/redundant_percent_q.rb +4 -5
  594. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +100 -0
  595. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +19 -4
  596. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
  597. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +24 -6
  598. data/lib/rubocop/cop/style/redundant_return.rb +16 -4
  599. data/lib/rubocop/cop/style/redundant_self.rb +14 -2
  600. data/lib/rubocop/cop/style/redundant_self_assignment.rb +7 -7
  601. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +85 -0
  602. data/lib/rubocop/cop/style/redundant_sort.rb +72 -24
  603. data/lib/rubocop/cop/style/redundant_sort_by.rb +25 -9
  604. data/lib/rubocop/cop/style/redundant_string_escape.rb +185 -0
  605. data/lib/rubocop/cop/style/regexp_literal.rb +14 -5
  606. data/lib/rubocop/cop/style/require_order.rb +139 -0
  607. data/lib/rubocop/cop/style/rescue_modifier.rb +2 -4
  608. data/lib/rubocop/cop/style/rescue_standard_error.rb +15 -15
  609. data/lib/rubocop/cop/style/return_nil.rb +3 -2
  610. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +95 -0
  611. data/lib/rubocop/cop/style/safe_navigation.rb +71 -25
  612. data/lib/rubocop/cop/style/sample.rb +6 -4
  613. data/lib/rubocop/cop/style/select_by_regexp.rb +162 -0
  614. data/lib/rubocop/cop/style/self_assignment.rb +3 -3
  615. data/lib/rubocop/cop/style/semicolon.rb +93 -30
  616. data/lib/rubocop/cop/style/send.rb +1 -1
  617. data/lib/rubocop/cop/style/signal_exception.rb +10 -8
  618. data/lib/rubocop/cop/style/single_argument_dig.rb +10 -0
  619. data/lib/rubocop/cop/style/single_line_block_params.rb +7 -5
  620. data/lib/rubocop/cop/style/single_line_methods.rb +27 -17
  621. data/lib/rubocop/cop/style/slicing_with_range.rb +14 -1
  622. data/lib/rubocop/cop/style/sole_nested_conditional.rb +107 -33
  623. data/lib/rubocop/cop/style/special_global_vars.rb +90 -8
  624. data/lib/rubocop/cop/style/static_class.rb +38 -7
  625. data/lib/rubocop/cop/style/stderr_puts.rb +2 -2
  626. data/lib/rubocop/cop/style/string_chars.rb +4 -2
  627. data/lib/rubocop/cop/style/string_concatenation.rb +17 -8
  628. data/lib/rubocop/cop/style/string_hash_keys.rb +9 -2
  629. data/lib/rubocop/cop/style/string_literals.rb +1 -5
  630. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
  631. data/lib/rubocop/cop/style/string_methods.rb +1 -1
  632. data/lib/rubocop/cop/style/strip.rb +1 -1
  633. data/lib/rubocop/cop/style/struct_inheritance.rb +8 -4
  634. data/lib/rubocop/cop/style/swap_values.rb +8 -4
  635. data/lib/rubocop/cop/style/symbol_array.rb +35 -11
  636. data/lib/rubocop/cop/style/symbol_literal.rb +1 -1
  637. data/lib/rubocop/cop/style/symbol_proc.rb +90 -8
  638. data/lib/rubocop/cop/style/ternary_parentheses.rb +19 -18
  639. data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
  640. data/lib/rubocop/cop/style/trailing_body_on_class.rb +2 -1
  641. data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +1 -1
  642. data/lib/rubocop/cop/style/trailing_body_on_module.rb +1 -1
  643. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +5 -5
  644. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +2 -2
  645. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +21 -2
  646. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +2 -2
  647. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +2 -5
  648. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +2 -2
  649. data/lib/rubocop/cop/style/trivial_accessors.rb +13 -11
  650. data/lib/rubocop/cop/style/unless_else.rb +5 -1
  651. data/lib/rubocop/cop/style/unless_logical_operators.rb +2 -1
  652. data/lib/rubocop/cop/style/unpack_first.rb +8 -5
  653. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
  654. data/lib/rubocop/cop/style/when_then.rb +1 -1
  655. data/lib/rubocop/cop/style/word_array.rb +80 -8
  656. data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
  657. data/lib/rubocop/cop/style/yoda_condition.rb +40 -14
  658. data/lib/rubocop/cop/style/yoda_expression.rb +90 -0
  659. data/lib/rubocop/cop/style/zero_length_predicate.rb +47 -20
  660. data/lib/rubocop/cop/team.rb +66 -59
  661. data/lib/rubocop/cop/util.rb +74 -14
  662. data/lib/rubocop/cop/utils/regexp_ranges.rb +100 -0
  663. data/lib/rubocop/cop/variable_force/assignment.rb +45 -4
  664. data/lib/rubocop/cop/variable_force/branch.rb +1 -1
  665. data/lib/rubocop/cop/variable_force/scope.rb +3 -3
  666. data/lib/rubocop/cop/variable_force/variable.rb +5 -3
  667. data/lib/rubocop/cop/variable_force/variable_table.rb +6 -4
  668. data/lib/rubocop/cop/variable_force.rb +20 -35
  669. data/lib/rubocop/cops_documentation_generator.rb +80 -21
  670. data/lib/rubocop/directive_comment.rb +4 -4
  671. data/lib/rubocop/ext/comment.rb +18 -0
  672. data/lib/rubocop/ext/processed_source.rb +2 -0
  673. data/lib/rubocop/ext/range.rb +15 -0
  674. data/lib/rubocop/ext/regexp_node.rb +1 -1
  675. data/lib/rubocop/ext/regexp_parser.rb +5 -2
  676. data/lib/rubocop/feature_loader.rb +94 -0
  677. data/lib/rubocop/file_patterns.rb +43 -0
  678. data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
  679. data/lib/rubocop/formatter/disabled_config_formatter.rb +45 -11
  680. data/lib/rubocop/formatter/formatter_set.rb +20 -18
  681. data/lib/rubocop/formatter/git_hub_actions_formatter.rb +16 -3
  682. data/lib/rubocop/formatter/html_formatter.rb +11 -16
  683. data/lib/rubocop/formatter/json_formatter.rb +4 -1
  684. data/lib/rubocop/formatter/junit_formatter.rb +4 -1
  685. data/lib/rubocop/formatter/markdown_formatter.rb +78 -0
  686. data/lib/rubocop/formatter/offense_count_formatter.rb +15 -6
  687. data/lib/rubocop/formatter/simple_text_formatter.rb +9 -8
  688. data/lib/rubocop/formatter/tap_formatter.rb +1 -1
  689. data/lib/rubocop/formatter/worst_offenders_formatter.rb +6 -4
  690. data/lib/rubocop/formatter.rb +34 -0
  691. data/lib/rubocop/lsp/logger.rb +22 -0
  692. data/lib/rubocop/lsp/routes.rb +243 -0
  693. data/lib/rubocop/lsp/runtime.rb +99 -0
  694. data/lib/rubocop/lsp/server.rb +68 -0
  695. data/lib/rubocop/lsp/severity.rb +27 -0
  696. data/lib/rubocop/magic_comment.rb +74 -19
  697. data/lib/rubocop/options.rb +291 -151
  698. data/lib/rubocop/path_util.rb +50 -22
  699. data/lib/rubocop/rake_task.rb +35 -10
  700. data/lib/rubocop/remote_config.rb +2 -4
  701. data/lib/rubocop/result_cache.rb +34 -19
  702. data/lib/rubocop/rspec/cop_helper.rb +28 -5
  703. data/lib/rubocop/rspec/expect_offense.rb +12 -6
  704. data/lib/rubocop/rspec/parallel_formatter.rb +90 -0
  705. data/lib/rubocop/rspec/shared_contexts.rb +51 -10
  706. data/lib/rubocop/rspec/support.rb +17 -1
  707. data/lib/rubocop/runner.rb +114 -32
  708. data/lib/rubocop/server/cache.rb +155 -0
  709. data/lib/rubocop/server/cli.rb +147 -0
  710. data/lib/rubocop/server/client_command/base.rb +44 -0
  711. data/lib/rubocop/server/client_command/exec.rb +65 -0
  712. data/lib/rubocop/server/client_command/restart.rb +25 -0
  713. data/lib/rubocop/server/client_command/start.rb +48 -0
  714. data/lib/rubocop/server/client_command/status.rb +28 -0
  715. data/lib/rubocop/server/client_command/stop.rb +31 -0
  716. data/lib/rubocop/server/client_command.rb +26 -0
  717. data/lib/rubocop/server/core.rb +111 -0
  718. data/lib/rubocop/server/errors.rb +23 -0
  719. data/lib/rubocop/server/helper.rb +34 -0
  720. data/lib/rubocop/server/server_command/base.rb +50 -0
  721. data/lib/rubocop/server/server_command/exec.rb +34 -0
  722. data/lib/rubocop/server/server_command/stop.rb +24 -0
  723. data/lib/rubocop/server/server_command.rb +21 -0
  724. data/lib/rubocop/server/socket_reader.rb +69 -0
  725. data/lib/rubocop/server.rb +53 -0
  726. data/lib/rubocop/string_interpreter.rb +7 -7
  727. data/lib/rubocop/target_finder.rb +8 -4
  728. data/lib/rubocop/target_ruby.rb +16 -8
  729. data/lib/rubocop/version.rb +28 -11
  730. data/lib/rubocop/yaml_duplication_checker.rb +1 -1
  731. data/lib/rubocop.rb +100 -37
  732. metadata +193 -37
  733. data/lib/rubocop/cop/gemspec/date_assignment.rb +0 -57
  734. data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
  735. 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'
@@ -78,6 +80,8 @@ AllCops:
78
80
  # When specifying style guide URLs, any paths and/or fragments will be
79
81
  # evaluated relative to the base URL.
80
82
  StyleGuideBaseURL: https://rubystyle.guide
83
+ # Documentation URLs will be constructed using the base URL.
84
+ DocumentationBaseURL: https://docs.rubocop.org/rubocop
81
85
  # Extra details are not displayed in offense messages by default. Change
82
86
  # behavior by overriding ExtraDetails, or by giving the
83
87
  # `-E/--extra-details` option.
@@ -130,7 +134,7 @@ AllCops:
130
134
  # What MRI version of the Ruby interpreter is the inspected code intended to
131
135
  # run on? (If there is more than one, set this to the lowest version.)
132
136
  # If a value is specified for TargetRubyVersion then it is used. Acceptable
133
- # values are specificed as a float (i.e. 3.0); the teeny version of Ruby
137
+ # values are specified as a float (i.e. 3.0); the teeny version of Ruby
134
138
  # should not be included. If the project specifies a Ruby version in the
135
139
  # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
136
140
  # try to determine the desired version of Ruby by inspecting the
@@ -138,7 +142,7 @@ AllCops:
138
142
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
139
143
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
140
144
  # Ruby version is still unresolved, RuboCop will use the oldest officially
141
- # supported Ruby version (currently Ruby 2.5).
145
+ # supported Ruby version (currently Ruby 2.7).
142
146
  TargetRubyVersion: ~
143
147
  # Determines if a notification for extension libraries should be shown when
144
148
  # rubocop is run. Keys are the name of the extension, and values are an array
@@ -150,13 +154,30 @@ AllCops:
150
154
  rubocop-minitest: [minitest]
151
155
  rubocop-sequel: [sequel]
152
156
  rubocop-rake: [rake]
157
+ rubocop-graphql: [graphql]
158
+ rubocop-capybara: [capybara]
159
+ rubocop-factory_bot: [factory_bot, factory_bot_rails]
160
+ # Enable/Disable checking the methods extended by Active Support.
161
+ ActiveSupportExtensionsEnabled: false
153
162
 
154
163
  #################### Bundler ###############################
155
164
 
156
165
  Bundler/DuplicatedGem:
157
166
  Description: 'Checks for duplicate gem entries in Gemfile.'
158
167
  Enabled: true
168
+ Severity: warning
159
169
  VersionAdded: '0.46'
170
+ VersionChanged: '1.40'
171
+ Include:
172
+ - '**/*.gemfile'
173
+ - '**/Gemfile'
174
+ - '**/gems.rb'
175
+
176
+ Bundler/DuplicatedGroup:
177
+ Description: 'Checks for duplicate group entries in Gemfile.'
178
+ Enabled: true
179
+ Severity: warning
180
+ VersionAdded: '1.56'
160
181
  Include:
161
182
  - '**/*.gemfile'
162
183
  - '**/Gemfile'
@@ -174,6 +195,20 @@ Bundler/GemComment:
174
195
  IgnoredGems: []
175
196
  OnlyFor: []
176
197
 
198
+ Bundler/GemFilename:
199
+ Description: 'Enforces the filename for managing gems.'
200
+ Enabled: true
201
+ VersionAdded: '1.20'
202
+ EnforcedStyle: 'Gemfile'
203
+ SupportedStyles:
204
+ - 'Gemfile'
205
+ - 'gems.rb'
206
+ Include:
207
+ - '**/Gemfile'
208
+ - '**/gems.rb'
209
+ - '**/Gemfile.lock'
210
+ - '**/gems.locked'
211
+
177
212
  Bundler/GemVersion:
178
213
  Description: 'Requires or forbids specifying gem versions.'
179
214
  Enabled: false
@@ -194,7 +229,10 @@ Bundler/InsecureProtocolSource:
194
229
  because HTTP requests are insecure. Please change your source to
195
230
  'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
196
231
  Enabled: true
232
+ Severity: warning
197
233
  VersionAdded: '0.50'
234
+ VersionChanged: '1.40'
235
+ AllowHttpProtocol: true
198
236
  Include:
199
237
  - '**/*.gemfile'
200
238
  - '**/Gemfile'
@@ -217,17 +255,48 @@ Bundler/OrderedGems:
217
255
 
218
256
  #################### Gemspec ###############################
219
257
 
220
- Gemspec/DateAssignment:
221
- Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
258
+ Gemspec/DependencyVersion:
259
+ Description: 'Requires or forbids specifying gem dependency versions.'
260
+ Enabled: false
261
+ VersionAdded: '1.29'
262
+ EnforcedStyle: 'required'
263
+ SupportedStyles:
264
+ - 'required'
265
+ - 'forbidden'
266
+ Include:
267
+ - '**/*.gemspec'
268
+ AllowedGems: []
269
+
270
+ Gemspec/DeprecatedAttributeAssignment:
271
+ Description: Checks that deprecated attribute assignments are not set in a gemspec file.
222
272
  Enabled: pending
223
- VersionAdded: '1.10'
273
+ Severity: warning
274
+ VersionAdded: '1.30'
275
+ VersionChanged: '1.40'
276
+ Include:
277
+ - '**/*.gemspec'
278
+
279
+ Gemspec/DevelopmentDependencies:
280
+ Description: Checks that development dependencies are specified in Gemfile rather than gemspec.
281
+ Enabled: pending
282
+ VersionAdded: '1.44'
283
+ EnforcedStyle: Gemfile
284
+ SupportedStyles:
285
+ - Gemfile
286
+ - gems.rb
287
+ - gemspec
288
+ AllowedGems: []
224
289
  Include:
225
290
  - '**/*.gemspec'
291
+ - '**/Gemfile'
292
+ - '**/gems.rb'
226
293
 
227
294
  Gemspec/DuplicatedAssignment:
228
295
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
229
296
  Enabled: true
297
+ Severity: warning
230
298
  VersionAdded: '0.52'
299
+ VersionChanged: '1.40'
231
300
  Include:
232
301
  - '**/*.gemspec'
233
302
 
@@ -243,11 +312,23 @@ Gemspec/OrderedDependencies:
243
312
  Include:
244
313
  - '**/*.gemspec'
245
314
 
315
+ Gemspec/RequireMFA:
316
+ Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
317
+ Enabled: pending
318
+ Severity: warning
319
+ VersionAdded: '1.23'
320
+ VersionChanged: '1.40'
321
+ Reference:
322
+ - https://guides.rubygems.org/mfa-requirement-opt-in/
323
+ Include:
324
+ - '**/*.gemspec'
325
+
246
326
  Gemspec/RequiredRubyVersion:
247
327
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
248
328
  Enabled: true
329
+ Severity: warning
249
330
  VersionAdded: '0.52'
250
- VersionChanged: '0.89'
331
+ VersionChanged: '1.40'
251
332
  Include:
252
333
  - '**/*.gemspec'
253
334
 
@@ -255,7 +336,9 @@ Gemspec/RubyVersionGlobalsUsage:
255
336
  Description: Checks usage of RUBY_VERSION in gemspec.
256
337
  StyleGuide: '#no-ruby-version-in-the-gemspec'
257
338
  Enabled: true
339
+ Severity: warning
258
340
  VersionAdded: '0.72'
341
+ VersionChanged: '1.40'
259
342
  Include:
260
343
  - '**/*.gemspec'
261
344
 
@@ -338,7 +421,7 @@ Layout/AssignmentIndentation:
338
421
  right-hand-side of a multi-line assignment.
339
422
  Enabled: true
340
423
  VersionAdded: '0.49'
341
- VersionChanged: '0.77'
424
+ VersionChanged: '1.45'
342
425
  # By default the indentation width from `Layout/IndentationWidth` is used,
343
426
  # but it can be overridden by setting this parameter.
344
427
  IndentationWidth: ~
@@ -396,20 +479,22 @@ Layout/ClassStructure:
396
479
  Description: 'Enforces a configured order of definitions within a class body.'
397
480
  StyleGuide: '#consistent-classes'
398
481
  Enabled: false
482
+ SafeAutoCorrect: false
399
483
  VersionAdded: '0.52'
484
+ VersionChanged: '1.53'
400
485
  Categories:
401
486
  module_inclusion:
402
487
  - include
403
488
  - prepend
404
489
  - extend
405
490
  ExpectedOrder:
406
- - module_inclusion
407
- - constants
408
- - public_class_methods
409
- - initializer
410
- - public_methods
411
- - protected_methods
412
- - private_methods
491
+ - module_inclusion
492
+ - constants
493
+ - public_class_methods
494
+ - initializer
495
+ - public_methods
496
+ - protected_methods
497
+ - private_methods
413
498
 
414
499
  Layout/ClosingHeredocIndentation:
415
500
  Description: 'Checks the indentation of here document closings.'
@@ -424,7 +509,11 @@ Layout/ClosingParenthesisIndentation:
424
509
  Layout/CommentIndentation:
425
510
  Description: 'Indentation of comments.'
426
511
  Enabled: true
512
+ # When true, allows comments to have extra indentation if that aligns them
513
+ # with a comment on the preceding line.
514
+ AllowForAlignment: false
427
515
  VersionAdded: '0.49'
516
+ VersionChanged: '1.24'
428
517
 
429
518
  Layout/ConditionPosition:
430
519
  Description: >-
@@ -496,13 +585,15 @@ Layout/EmptyLineBetweenDefs:
496
585
  StyleGuide: '#empty-lines-between-methods'
497
586
  Enabled: true
498
587
  VersionAdded: '0.49'
499
- VersionChanged: '1.7'
588
+ VersionChanged: '1.23'
500
589
  EmptyLineBetweenMethodDefs: true
501
590
  EmptyLineBetweenClassDefs: true
502
591
  EmptyLineBetweenModuleDefs: true
503
- # If `true`, this parameter means that single line method definitions don't
504
- # need an empty line between them.
505
- AllowAdjacentOneLineDefs: false
592
+ # `DefLikeMacros` takes the name of any macro that you want to treat like a def.
593
+ DefLikeMacros: []
594
+ # `AllowAdjacentOneLineDefs` means that single line method definitions don't
595
+ # need an empty line between them. `true` by default.
596
+ AllowAdjacentOneLineDefs: true
506
597
  # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
507
598
  NumberOfEmptyLines: 1
508
599
 
@@ -703,6 +794,7 @@ Layout/FirstArrayElementLineBreak:
703
794
  multi-line array.
704
795
  Enabled: false
705
796
  VersionAdded: '0.49'
797
+ AllowMultilineFinalElement: false
706
798
 
707
799
  Layout/FirstHashElementIndentation:
708
800
  Description: 'Checks the indentation of the first key in a hash literal.'
@@ -735,6 +827,7 @@ Layout/FirstHashElementLineBreak:
735
827
  multi-line hash.
736
828
  Enabled: false
737
829
  VersionAdded: '0.49'
830
+ AllowMultilineFinalElement: false
738
831
 
739
832
  Layout/FirstMethodArgumentLineBreak:
740
833
  Description: >-
@@ -742,6 +835,7 @@ Layout/FirstMethodArgumentLineBreak:
742
835
  multi-line method call.
743
836
  Enabled: false
744
837
  VersionAdded: '0.49'
838
+ AllowMultilineFinalElement: false
745
839
 
746
840
  Layout/FirstMethodParameterLineBreak:
747
841
  Description: >-
@@ -749,6 +843,7 @@ Layout/FirstMethodParameterLineBreak:
749
843
  multi-line method parameter definition.
750
844
  Enabled: false
751
845
  VersionAdded: '0.49'
846
+ AllowMultilineFinalElement: false
752
847
 
753
848
  Layout/FirstParameterIndentation:
754
849
  Description: >-
@@ -852,7 +947,7 @@ Layout/HeredocArgumentClosingParenthesis:
852
947
  VersionAdded: '0.68'
853
948
 
854
949
  Layout/HeredocIndentation:
855
- Description: 'This cop checks the indentation of the here document bodies.'
950
+ Description: 'Checks the indentation of the here document bodies.'
856
951
  StyleGuide: '#squiggly-heredocs'
857
952
  Enabled: true
858
953
  VersionAdded: '0.49'
@@ -885,7 +980,7 @@ Layout/IndentationStyle:
885
980
  VersionChanged: '0.82'
886
981
  # By default the indentation width from `Layout/IndentationWidth` is used,
887
982
  # but it can be overridden by setting this parameter.
888
- # It is used during auto-correction to determine how many spaces should
983
+ # It is used during autocorrection to determine how many spaces should
889
984
  # replace each tab.
890
985
  IndentationWidth: ~
891
986
  EnforcedStyle: spaces
@@ -900,7 +995,7 @@ Layout/IndentationWidth:
900
995
  VersionAdded: '0.49'
901
996
  # Number of spaces for each indentation level.
902
997
  Width: 2
903
- IgnoredPatterns: []
998
+ AllowedPatterns: []
904
999
 
905
1000
  Layout/InitialIndentation:
906
1001
  Description: >-
@@ -923,6 +1018,27 @@ Layout/LeadingEmptyLines:
923
1018
  VersionAdded: '0.57'
924
1019
  VersionChanged: '0.77'
925
1020
 
1021
+ Layout/LineContinuationLeadingSpace:
1022
+ Description: >-
1023
+ Use trailing spaces instead of leading spaces in strings
1024
+ broken over multiple lines (by a backslash).
1025
+ Enabled: pending
1026
+ VersionAdded: '1.31'
1027
+ VersionChanged: '1.45'
1028
+ EnforcedStyle: trailing
1029
+ SupportedStyles:
1030
+ - leading
1031
+ - trailing
1032
+
1033
+ Layout/LineContinuationSpacing:
1034
+ Description: 'Checks the spacing in front of backslash in line continuations.'
1035
+ Enabled: pending
1036
+ VersionAdded: '1.31'
1037
+ EnforcedStyle: space
1038
+ SupportedStyles:
1039
+ - space
1040
+ - no_space
1041
+
926
1042
  Layout/LineEndStringConcatenationIndentation:
927
1043
  Description: >-
928
1044
  Checks the indentation of the next line after a line that
@@ -943,7 +1059,6 @@ Layout/LineLength:
943
1059
  Enabled: true
944
1060
  VersionAdded: '0.25'
945
1061
  VersionChanged: '1.4'
946
- AutoCorrect: true
947
1062
  Max: 120
948
1063
  # To make it possible to copy or click on URIs in the code, we allow lines
949
1064
  # containing a URI to be longer than Max.
@@ -955,10 +1070,10 @@ Layout/LineLength:
955
1070
  # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
956
1071
  # directives like '# rubocop: enable ...' when calculating a line's length.
957
1072
  IgnoreCopDirectives: true
958
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1073
+ # The AllowedPatterns option is a list of !ruby/regexp and/or string
959
1074
  # elements. Strings will be converted to Regexp objects. A line that matches
960
1075
  # any regular expression listed in this option will be ignored by LineLength.
961
- IgnoredPatterns: []
1076
+ AllowedPatterns: []
962
1077
 
963
1078
  Layout/MultilineArrayBraceLayout:
964
1079
  Description: >-
@@ -982,6 +1097,7 @@ Layout/MultilineArrayLineBreaks:
982
1097
  starts on a separate line.
983
1098
  Enabled: false
984
1099
  VersionAdded: '0.67'
1100
+ AllowMultilineFinalElement: false
985
1101
 
986
1102
  Layout/MultilineAssignmentLayout:
987
1103
  Description: 'Check for a newline after the assignment operator in multi-line assignments.'
@@ -1032,6 +1148,7 @@ Layout/MultilineHashKeyLineBreaks:
1032
1148
  starts on a separate line.
1033
1149
  Enabled: false
1034
1150
  VersionAdded: '0.67'
1151
+ AllowMultilineFinalElement: false
1035
1152
 
1036
1153
  Layout/MultilineMethodArgumentLineBreaks:
1037
1154
  Description: >-
@@ -1039,6 +1156,7 @@ Layout/MultilineMethodArgumentLineBreaks:
1039
1156
  starts on a separate line.
1040
1157
  Enabled: false
1041
1158
  VersionAdded: '0.67'
1159
+ AllowMultilineFinalElement: false
1042
1160
 
1043
1161
  Layout/MultilineMethodCallBraceLayout:
1044
1162
  Description: >-
@@ -1087,6 +1205,14 @@ Layout/MultilineMethodDefinitionBraceLayout:
1087
1205
  - new_line
1088
1206
  - same_line
1089
1207
 
1208
+ Layout/MultilineMethodParameterLineBreaks:
1209
+ Description: >-
1210
+ Checks that each parameter in a multi-line method definition
1211
+ starts on a separate line.
1212
+ Enabled: false
1213
+ VersionAdded: '1.32'
1214
+ AllowMultilineFinalElement: false
1215
+
1090
1216
  Layout/MultilineOperationIndentation:
1091
1217
  Description: >-
1092
1218
  Checks indentation of binary operations that span more than
@@ -1347,10 +1473,11 @@ Layout/SpaceInsideParens:
1347
1473
  StyleGuide: '#spaces-braces'
1348
1474
  Enabled: true
1349
1475
  VersionAdded: '0.49'
1350
- VersionChanged: '0.55'
1476
+ VersionChanged: '1.22'
1351
1477
  EnforcedStyle: no_space
1352
1478
  SupportedStyles:
1353
1479
  - space
1480
+ - compact
1354
1481
  - no_space
1355
1482
 
1356
1483
  Layout/SpaceInsidePercentLiteralDelimiters:
@@ -1419,11 +1546,11 @@ Lint/AmbiguousBlockAssociation:
1419
1546
  Description: >-
1420
1547
  Checks for ambiguous block association with method when param passed without
1421
1548
  parentheses.
1422
- StyleGuide: '#syntax'
1423
1549
  Enabled: true
1424
1550
  VersionAdded: '0.48'
1425
1551
  VersionChanged: '1.13'
1426
- IgnoredMethods: []
1552
+ AllowedMethods: []
1553
+ AllowedPatterns: []
1427
1554
 
1428
1555
  Lint/AmbiguousOperator:
1429
1556
  Description: >-
@@ -1434,6 +1561,20 @@ Lint/AmbiguousOperator:
1434
1561
  VersionAdded: '0.17'
1435
1562
  VersionChanged: '0.83'
1436
1563
 
1564
+ Lint/AmbiguousOperatorPrecedence:
1565
+ Description: >-
1566
+ Checks for expressions containing multiple binary operations with
1567
+ ambiguous precedence.
1568
+ Enabled: pending
1569
+ VersionAdded: '1.21'
1570
+
1571
+ Lint/AmbiguousRange:
1572
+ Description: Checks for ranges with ambiguous boundaries.
1573
+ Enabled: pending
1574
+ VersionAdded: '1.19'
1575
+ SafeAutoCorrect: false
1576
+ RequireParenthesesForMethodChains: false
1577
+
1437
1578
  Lint/AmbiguousRegexpLiteral:
1438
1579
  Description: >-
1439
1580
  Checks for ambiguous regexp literals in the first argument of
@@ -1446,7 +1587,9 @@ Lint/AssignmentInCondition:
1446
1587
  Description: "Don't use assignment in conditions."
1447
1588
  StyleGuide: '#safe-assignment-in-condition'
1448
1589
  Enabled: true
1590
+ SafeAutoCorrect: false
1449
1591
  VersionAdded: '0.9'
1592
+ VersionChanged: '1.45'
1450
1593
  AllowSafeAssignment: true
1451
1594
 
1452
1595
  Lint/BigDecimalNew:
@@ -1455,7 +1598,7 @@ Lint/BigDecimalNew:
1455
1598
  VersionAdded: '0.53'
1456
1599
 
1457
1600
  Lint/BinaryOperatorWithIdenticalOperands:
1458
- Description: 'This cop checks for places where binary operator has identical operands.'
1601
+ Description: 'Checks for places where binary operator has identical operands.'
1459
1602
  Enabled: true
1460
1603
  Safe: false
1461
1604
  VersionAdded: '0.89'
@@ -1464,9 +1607,9 @@ Lint/BinaryOperatorWithIdenticalOperands:
1464
1607
  Lint/BooleanSymbol:
1465
1608
  Description: 'Check for `:true` and `:false` symbols.'
1466
1609
  Enabled: true
1467
- Safe: false
1610
+ SafeAutoCorrect: false
1468
1611
  VersionAdded: '0.50'
1469
- VersionChanged: '0.83'
1612
+ VersionChanged: '1.22'
1470
1613
 
1471
1614
  Lint/CircularArgumentReference:
1472
1615
  Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
@@ -1484,6 +1627,11 @@ Lint/ConstantDefinitionInBlock:
1484
1627
  AllowedMethods:
1485
1628
  - enums
1486
1629
 
1630
+ Lint/ConstantOverwrittenInRescue:
1631
+ Description: 'Checks for overwriting an exception with an exception result by use `rescue =>`.'
1632
+ Enabled: pending
1633
+ VersionAdded: '1.31'
1634
+
1487
1635
  Lint/ConstantResolution:
1488
1636
  Description: 'Check that constants are fully qualified with `::`.'
1489
1637
  Enabled: false
@@ -1497,13 +1645,13 @@ Lint/Debugger:
1497
1645
  Description: 'Check for debugger calls.'
1498
1646
  Enabled: true
1499
1647
  VersionAdded: '0.14'
1500
- VersionChanged: '1.10'
1501
- DebuggerReceivers: [] # deprecated
1648
+ VersionChanged: '1.46'
1502
1649
  DebuggerMethods:
1503
1650
  # Groups are available so that a specific group can be disabled in
1504
1651
  # a user's configuration, but are otherwise not significant.
1505
1652
  Kernel:
1506
1653
  - binding.irb
1654
+ - Kernel.binding.irb
1507
1655
  Byebug:
1508
1656
  - byebug
1509
1657
  - remote_byebug
@@ -1512,14 +1660,25 @@ Lint/Debugger:
1512
1660
  Capybara:
1513
1661
  - save_and_open_page
1514
1662
  - save_and_open_screenshot
1663
+ debug.rb:
1664
+ - binding.b
1665
+ - binding.break
1666
+ - Kernel.binding.b
1667
+ - Kernel.binding.break
1515
1668
  Pry:
1516
1669
  - binding.pry
1517
1670
  - binding.remote_pry
1518
1671
  - binding.pry_remote
1672
+ - Kernel.binding.pry
1673
+ - Kernel.binding.remote_pry
1674
+ - Kernel.binding.pry_remote
1519
1675
  - Pry.rescue
1676
+ - pry
1520
1677
  Rails:
1521
1678
  - debugger
1522
1679
  - Kernel.debugger
1680
+ RubyJard:
1681
+ - jard
1523
1682
  WebConsole:
1524
1683
  - binding.console
1525
1684
 
@@ -1532,6 +1691,7 @@ Lint/DeprecatedConstants:
1532
1691
  Description: 'Checks for deprecated constants.'
1533
1692
  Enabled: pending
1534
1693
  VersionAdded: '1.8'
1694
+ VersionChanged: '1.40'
1535
1695
  # You can configure deprecated constants.
1536
1696
  # If there is an alternative method, you can set alternative value as `Alternative`.
1537
1697
  # And you can set the deprecated version as `DeprecatedVersion`.
@@ -1552,9 +1712,18 @@ Lint/DeprecatedConstants:
1552
1712
  'FALSE':
1553
1713
  Alternative: 'false'
1554
1714
  DeprecatedVersion: '2.4'
1715
+ 'Net::HTTPServerException':
1716
+ Alternative: 'Net::HTTPClientException'
1717
+ DeprecatedVersion: '2.6'
1555
1718
  'Random::DEFAULT':
1556
1719
  Alternative: 'Random.new'
1557
1720
  DeprecatedVersion: '3.0'
1721
+ 'Struct::Group':
1722
+ Alternative: 'Etc::Group'
1723
+ DeprecatedVersion: '3.0'
1724
+ 'Struct::Passwd':
1725
+ Alternative: 'Etc::Passwd'
1726
+ DeprecatedVersion: '3.0'
1558
1727
 
1559
1728
  Lint/DeprecatedOpenSSLConstant:
1560
1729
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
@@ -1592,6 +1761,16 @@ Lint/DuplicateHashKey:
1592
1761
  VersionAdded: '0.34'
1593
1762
  VersionChanged: '0.77'
1594
1763
 
1764
+ Lint/DuplicateMagicComment:
1765
+ Description: 'Check for duplicated magic comments.'
1766
+ Enabled: pending
1767
+ VersionAdded: '1.37'
1768
+
1769
+ Lint/DuplicateMatchPattern:
1770
+ Description: 'Do not repeat patterns in `in` keywords.'
1771
+ Enabled: pending
1772
+ VersionAdded: '1.50'
1773
+
1595
1774
  Lint/DuplicateMethods:
1596
1775
  Description: 'Check for duplicate method definitions.'
1597
1776
  Enabled: true
@@ -1605,7 +1784,9 @@ Lint/DuplicateRegexpCharacterClassElement:
1605
1784
  Lint/DuplicateRequire:
1606
1785
  Description: 'Check for duplicate `require`s and `require_relative`s.'
1607
1786
  Enabled: true
1787
+ SafeAutoCorrect: false
1608
1788
  VersionAdded: '0.90'
1789
+ VersionChanged: '1.28'
1609
1790
 
1610
1791
  Lint/DuplicateRescueException:
1611
1792
  Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
@@ -1624,7 +1805,7 @@ Lint/ElseLayout:
1624
1805
  VersionChanged: '1.2'
1625
1806
 
1626
1807
  Lint/EmptyBlock:
1627
- Description: 'This cop checks for blocks without a body.'
1808
+ Description: 'Checks for blocks without a body.'
1628
1809
  Enabled: pending
1629
1810
  VersionAdded: '1.1'
1630
1811
  VersionChanged: '1.15'
@@ -1638,10 +1819,12 @@ Lint/EmptyClass:
1638
1819
  AllowComments: false
1639
1820
 
1640
1821
  Lint/EmptyConditionalBody:
1641
- Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1822
+ Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1642
1823
  Enabled: true
1824
+ SafeAutoCorrect: false
1643
1825
  AllowComments: true
1644
1826
  VersionAdded: '0.89'
1827
+ VersionChanged: '1.34'
1645
1828
 
1646
1829
  Lint/EmptyEnsure:
1647
1830
  Description: 'Checks for empty ensure block.'
@@ -1743,6 +1926,13 @@ Lint/ImplicitStringConcatenation:
1743
1926
  Enabled: true
1744
1927
  VersionAdded: '0.36'
1745
1928
 
1929
+ Lint/IncompatibleIoSelectWithFiberScheduler:
1930
+ Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
1931
+ Enabled: pending
1932
+ SafeAutoCorrect: false
1933
+ VersionAdded: '1.21'
1934
+ VersionChanged: '1.24'
1935
+
1746
1936
  Lint/IneffectiveAccessModifier:
1747
1937
  Description: >-
1748
1938
  Checks for attempts to use `private` or `protected` to set
@@ -1753,19 +1943,21 @@ Lint/IneffectiveAccessModifier:
1753
1943
  Lint/InheritException:
1754
1944
  Description: 'Avoid inheriting from the `Exception` class.'
1755
1945
  Enabled: true
1946
+ SafeAutoCorrect: false
1756
1947
  VersionAdded: '0.41'
1948
+ VersionChanged: '1.26'
1757
1949
  # The default base class in favour of `Exception`.
1758
- EnforcedStyle: runtime_error
1950
+ EnforcedStyle: standard_error
1759
1951
  SupportedStyles:
1760
- - runtime_error
1761
1952
  - standard_error
1953
+ - runtime_error
1762
1954
 
1763
1955
  Lint/InterpolationCheck:
1764
- Description: 'Raise warning for interpolation in single q strs.'
1956
+ Description: 'Checks for interpolation in a single quoted string.'
1765
1957
  Enabled: true
1766
- Safe: false
1958
+ SafeAutoCorrect: false
1767
1959
  VersionAdded: '0.50'
1768
- VersionChanged: '0.87'
1960
+ VersionChanged: '1.40'
1769
1961
 
1770
1962
  Lint/LambdaWithoutLiteralBlock:
1771
1963
  Description: 'Checks uses of lambda without a literal block.'
@@ -1808,12 +2000,19 @@ Lint/MissingCopEnableDirective:
1808
2000
 
1809
2001
  Lint/MissingSuper:
1810
2002
  Description: >-
1811
- This cop checks for the presence of constructors and lifecycle callbacks
1812
- without calls to `super`'.
2003
+ Checks for the presence of constructors and lifecycle callbacks
2004
+ without calls to `super`.
1813
2005
  Enabled: true
2006
+ AllowedParentClasses: []
1814
2007
  VersionAdded: '0.89'
1815
2008
  VersionChanged: '1.4'
1816
2009
 
2010
+ Lint/MixedCaseRange:
2011
+ Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
2012
+ Enabled: pending
2013
+ SafeAutoCorrect: false
2014
+ VersionAdded: '1.53'
2015
+
1817
2016
  Lint/MixedRegexpCaptureTypes:
1818
2017
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1819
2018
  Enabled: true
@@ -1824,12 +2023,13 @@ Lint/MultipleComparison:
1824
2023
  Enabled: true
1825
2024
  VersionAdded: '0.47'
1826
2025
  VersionChanged: '1.1'
1827
- AllowMethodComparison: true
1828
2026
 
1829
2027
  Lint/NestedMethodDefinition:
1830
2028
  Description: 'Do not use nested method definitions.'
1831
2029
  StyleGuide: '#no-nested-methods'
1832
2030
  Enabled: true
2031
+ AllowedMethods: []
2032
+ AllowedPatterns: []
1833
2033
  VersionAdded: '0.32'
1834
2034
 
1835
2035
  Lint/NestedPercentLiteral:
@@ -1838,7 +2038,7 @@ Lint/NestedPercentLiteral:
1838
2038
  VersionAdded: '0.52'
1839
2039
 
1840
2040
  Lint/NextWithoutAccumulator:
1841
- Description: >-
2041
+ Description: >-
1842
2042
  Do not omit the accumulator when calling `next`
1843
2043
  in a `reduce`/`inject` block.
1844
2044
  Enabled: true
@@ -1849,6 +2049,13 @@ Lint/NoReturnInBeginEndBlocks:
1849
2049
  Enabled: pending
1850
2050
  VersionAdded: '1.2'
1851
2051
 
2052
+ Lint/NonAtomicFileOperation:
2053
+ Description: Checks for non-atomic file operations.
2054
+ StyleGuide: '#atomic-file-operations'
2055
+ Enabled: pending
2056
+ VersionAdded: '1.31'
2057
+ SafeAutoCorrect: false
2058
+
1852
2059
  Lint/NonDeterministicRequireOrder:
1853
2060
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1854
2061
  Enabled: true
@@ -1866,7 +2073,8 @@ Lint/NumberConversion:
1866
2073
  VersionAdded: '0.53'
1867
2074
  VersionChanged: '1.1'
1868
2075
  SafeAutoCorrect: false
1869
- IgnoredMethods: []
2076
+ AllowedMethods: []
2077
+ AllowedPatterns: []
1870
2078
  IgnoredClasses:
1871
2079
  - Time
1872
2080
  - DateTime
@@ -1885,7 +2093,9 @@ Lint/OrAssignmentToConstant:
1885
2093
  Lint/OrderedMagicComments:
1886
2094
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1887
2095
  Enabled: true
2096
+ SafeAutoCorrect: false
1888
2097
  VersionAdded: '0.53'
2098
+ VersionChanged: '1.37'
1889
2099
 
1890
2100
  Lint/OutOfRangeRegexpRef:
1891
2101
  Description: 'Checks for out of range reference for Regexp because it always returns nil.'
@@ -1949,6 +2159,13 @@ Lint/RedundantDirGlobSort:
1949
2159
  Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1950
2160
  Enabled: pending
1951
2161
  VersionAdded: '1.8'
2162
+ VersionChanged: '1.26'
2163
+ SafeAutoCorrect: false
2164
+
2165
+ Lint/RedundantRegexpQuantifiers:
2166
+ Description: 'Checks for redundant quantifiers in Regexps.'
2167
+ Enabled: pending
2168
+ VersionAdded: '1.53'
1952
2169
 
1953
2170
  Lint/RedundantRequireStatement:
1954
2171
  Description: 'Checks for unnecessary `require` statement.'
@@ -1992,6 +2209,12 @@ Lint/RedundantWithObject:
1992
2209
  Enabled: true
1993
2210
  VersionAdded: '0.51'
1994
2211
 
2212
+ Lint/RefinementImportMethods:
2213
+ Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
2214
+ Enabled: pending
2215
+ SafeAutoCorrect: false
2216
+ VersionAdded: '1.27'
2217
+
1995
2218
  Lint/RegexpAsCondition:
1996
2219
  Description: >-
1997
2220
  Do not use regexp literal as a condition.
@@ -2007,6 +2230,16 @@ Lint/RequireParentheses:
2007
2230
  Enabled: true
2008
2231
  VersionAdded: '0.18'
2009
2232
 
2233
+ Lint/RequireRangeParentheses:
2234
+ Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
2235
+ Enabled: pending
2236
+ VersionAdded: '1.32'
2237
+
2238
+ Lint/RequireRelativeSelfPath:
2239
+ Description: 'Checks for uses a file requiring itself with `require_relative`.'
2240
+ Enabled: pending
2241
+ VersionAdded: '1.22'
2242
+
2010
2243
  Lint/RescueException:
2011
2244
  Description: 'Avoid rescuing the Exception class.'
2012
2245
  StyleGuide: '#no-blind-rescues'
@@ -2125,7 +2358,7 @@ Lint/Syntax:
2125
2358
  VersionAdded: '0.9'
2126
2359
 
2127
2360
  Lint/ToEnumArguments:
2128
- Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2361
+ Description: 'Ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2129
2362
  Enabled: pending
2130
2363
  VersionAdded: '1.1'
2131
2364
 
@@ -2135,12 +2368,15 @@ Lint/ToJSON:
2135
2368
  VersionAdded: '0.66'
2136
2369
 
2137
2370
  Lint/TopLevelReturnWithArgument:
2138
- Description: 'This cop detects top level return statements with argument.'
2371
+ Description: 'Detects top level return statements with argument.'
2139
2372
  Enabled: true
2140
2373
  VersionAdded: '0.89'
2374
+ # These codes are `eval`-ed in method and their return values may be used.
2375
+ Exclude:
2376
+ - '**/*.jb'
2141
2377
 
2142
2378
  Lint/TrailingCommaInAttributeDeclaration:
2143
- Description: 'This cop checks for trailing commas in attribute declarations.'
2379
+ Description: 'Checks for trailing commas in attribute declarations.'
2144
2380
  Enabled: true
2145
2381
  VersionAdded: '0.90'
2146
2382
 
@@ -2189,11 +2425,11 @@ Lint/UnreachableCode:
2189
2425
  VersionAdded: '0.9'
2190
2426
 
2191
2427
  Lint/UnreachableLoop:
2192
- Description: 'This cop checks for loops that will have at most one iteration.'
2428
+ Description: 'Checks for loops that will have at most one iteration.'
2193
2429
  Enabled: true
2194
2430
  VersionAdded: '0.89'
2195
2431
  VersionChanged: '1.7'
2196
- IgnoredPatterns:
2432
+ AllowedPatterns:
2197
2433
  # RSpec uses `times` in its message expectations
2198
2434
  # eg. `exactly(2).times`
2199
2435
  - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
@@ -2246,26 +2482,38 @@ Lint/UselessAssignment:
2246
2482
  StyleGuide: '#underscore-unused-vars'
2247
2483
  Enabled: true
2248
2484
  VersionAdded: '0.11'
2485
+ VersionChanged: '1.51'
2486
+ SafeAutoCorrect: false
2249
2487
 
2250
2488
  Lint/UselessElseWithoutRescue:
2251
2489
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2252
2490
  Enabled: true
2253
2491
  VersionAdded: '0.17'
2492
+ VersionChanged: '1.31'
2254
2493
 
2255
2494
  Lint/UselessMethodDefinition:
2256
2495
  Description: 'Checks for useless method definitions.'
2257
2496
  Enabled: true
2258
2497
  VersionAdded: '0.90'
2498
+ VersionChanged: '0.91'
2259
2499
  Safe: false
2260
- AllowComments: true
2500
+
2501
+ Lint/UselessRescue:
2502
+ Description: 'Checks for useless `rescue`s.'
2503
+ Enabled: pending
2504
+ VersionAdded: '1.43'
2505
+
2506
+ Lint/UselessRuby2Keywords:
2507
+ Description: 'Finds unnecessary uses of `ruby2_keywords`.'
2508
+ Enabled: pending
2509
+ VersionAdded: '1.23'
2261
2510
 
2262
2511
  Lint/UselessSetterCall:
2263
2512
  Description: 'Checks for useless setter call to a local variable.'
2264
2513
  Enabled: true
2265
- SafeAutoCorrect: false
2514
+ Safe: false
2266
2515
  VersionAdded: '0.13'
2267
2516
  VersionChanged: '1.2'
2268
- Safe: false
2269
2517
 
2270
2518
  Lint/UselessTimes:
2271
2519
  Description: 'Checks for useless `Integer#times` calls.'
@@ -2293,7 +2541,8 @@ Metrics/AbcSize:
2293
2541
  VersionChanged: '1.5'
2294
2542
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2295
2543
  # a Float.
2296
- IgnoredMethods: []
2544
+ AllowedMethods: []
2545
+ AllowedPatterns: []
2297
2546
  CountRepeatedAttributes: true
2298
2547
  Max: 17
2299
2548
 
@@ -2305,11 +2554,11 @@ Metrics/BlockLength:
2305
2554
  CountComments: false # count full line comments?
2306
2555
  Max: 25
2307
2556
  CountAsOne: []
2308
- ExcludedMethods: [] # deprecated, retained for backwards compatibility
2309
- IgnoredMethods:
2557
+ AllowedMethods:
2310
2558
  # By default, exclude the `#refine` method, as it tends to have larger
2311
2559
  # associated blocks.
2312
2560
  - refine
2561
+ AllowedPatterns: []
2313
2562
  Exclude:
2314
2563
  - '**/*.gemspec'
2315
2564
 
@@ -2331,6 +2580,12 @@ Metrics/ClassLength:
2331
2580
  Max: 100
2332
2581
  CountAsOne: []
2333
2582
 
2583
+ Metrics/CollectionLiteralLength:
2584
+ Description: 'Checks for `Array` or `Hash` literals with many entries.'
2585
+ Enabled: pending
2586
+ VersionAdded: '1.47'
2587
+ LengthThreshold: 250
2588
+
2334
2589
  # Avoid complex methods.
2335
2590
  Metrics/CyclomaticComplexity:
2336
2591
  Description: >-
@@ -2339,7 +2594,8 @@ Metrics/CyclomaticComplexity:
2339
2594
  Enabled: true
2340
2595
  VersionAdded: '0.25'
2341
2596
  VersionChanged: '0.81'
2342
- IgnoredMethods: []
2597
+ AllowedMethods: []
2598
+ AllowedPatterns: []
2343
2599
  Max: 7
2344
2600
 
2345
2601
  Metrics/MethodLength:
@@ -2351,8 +2607,8 @@ Metrics/MethodLength:
2351
2607
  CountComments: false # count full line comments?
2352
2608
  Max: 10
2353
2609
  CountAsOne: []
2354
- ExcludedMethods: [] # deprecated, retained for backwards compatibility
2355
- IgnoredMethods: []
2610
+ AllowedMethods: []
2611
+ AllowedPatterns: []
2356
2612
 
2357
2613
  Metrics/ModuleLength:
2358
2614
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2380,7 +2636,8 @@ Metrics/PerceivedComplexity:
2380
2636
  Enabled: true
2381
2637
  VersionAdded: '0.25'
2382
2638
  VersionChanged: '0.81'
2383
- IgnoredMethods: []
2639
+ AllowedMethods: []
2640
+ AllowedPatterns: []
2384
2641
  Max: 8
2385
2642
 
2386
2643
  ################## Migration #############################
@@ -2415,6 +2672,17 @@ Naming/BinaryOperatorParameterName:
2415
2672
  VersionAdded: '0.50'
2416
2673
  VersionChanged: '1.2'
2417
2674
 
2675
+ Naming/BlockForwarding:
2676
+ Description: 'Use anonymous block forwarding.'
2677
+ StyleGuide: '#block-forwarding'
2678
+ Enabled: pending
2679
+ VersionAdded: '1.24'
2680
+ EnforcedStyle: anonymous
2681
+ SupportedStyles:
2682
+ - anonymous
2683
+ - explicit
2684
+ BlockForwardingName: block
2685
+
2418
2686
  Naming/BlockParameterName:
2419
2687
  Description: >-
2420
2688
  Checks for block parameter names that contain capital letters,
@@ -2452,6 +2720,7 @@ Naming/FileName:
2452
2720
  StyleGuide: '#snake-case-files'
2453
2721
  Enabled: true
2454
2722
  VersionAdded: '0.50'
2723
+ VersionChanged: '1.23'
2455
2724
  # Camel case file names listed in `AllCops:Include` and all file names listed
2456
2725
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2457
2726
  Exclude: []
@@ -2464,6 +2733,13 @@ Naming/FileName:
2464
2733
  # whether each source file's class or module name matches the file name --
2465
2734
  # not whether the nested module hierarchy matches the subdirectory path.
2466
2735
  CheckDefinitionPathHierarchy: true
2736
+ # paths that are considered root directories, for example "lib" in most ruby projects
2737
+ # or "app/models" in rails projects
2738
+ CheckDefinitionPathHierarchyRoots:
2739
+ - lib
2740
+ - spec
2741
+ - test
2742
+ - src
2467
2743
  # If non-`nil`, expect all source file names to match the following regex.
2468
2744
  # Only the file name itself is matched, not the entire file path.
2469
2745
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2532,16 +2808,17 @@ Naming/HeredocDelimiterNaming:
2532
2808
  Enabled: true
2533
2809
  VersionAdded: '0.50'
2534
2810
  ForbiddenDelimiters:
2535
- - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2811
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/i'
2536
2812
 
2537
2813
  Naming/InclusiveLanguage:
2538
2814
  Description: 'Recommend the use of inclusive language instead of problematic terms.'
2539
- Enabled: pending
2815
+ Enabled: false
2540
2816
  VersionAdded: '1.18'
2817
+ VersionChanged: '1.49'
2541
2818
  CheckIdentifiers: true
2542
2819
  CheckConstants: true
2543
2820
  CheckVariables: true
2544
- CheckStrings: true
2821
+ CheckStrings: false
2545
2822
  CheckSymbols: true
2546
2823
  CheckComments: true
2547
2824
  CheckFilepaths: true
@@ -2556,12 +2833,8 @@ Naming/InclusiveLanguage:
2556
2833
  Suggestions:
2557
2834
  - denylist
2558
2835
  - block
2559
- master:
2560
- Suggestions: ['main', 'primary', 'leader']
2561
- AllowedRegex:
2562
- - 'Master of None'
2563
- - 'Master Boot Record'
2564
2836
  slave:
2837
+ WholeWord: true
2565
2838
  Suggestions: ['replica', 'secondary', 'follower']
2566
2839
 
2567
2840
  Naming/MemoizedInstanceVariableName:
@@ -2588,11 +2861,11 @@ Naming/MethodName:
2588
2861
  - camelCase
2589
2862
  # Method names matching patterns are always allowed.
2590
2863
  #
2591
- # IgnoredPatterns:
2864
+ # AllowedPatterns:
2592
2865
  # - '\A\s*onSelectionBulkChange\s*'
2593
2866
  # - '\A\s*onSelectionCleared\s*'
2594
2867
  #
2595
- IgnoredPatterns: []
2868
+ AllowedPatterns: []
2596
2869
 
2597
2870
  Naming/MethodParameterName:
2598
2871
  Description: >-
@@ -2606,10 +2879,13 @@ Naming/MethodParameterName:
2606
2879
  AllowNamesEndingInNumbers: true
2607
2880
  # Allowed names that will not register an offense
2608
2881
  AllowedNames:
2882
+ - as
2609
2883
  - at
2610
2884
  - by
2885
+ - cc
2611
2886
  - db
2612
2887
  - id
2888
+ - if
2613
2889
  - in
2614
2890
  - io
2615
2891
  - ip
@@ -2668,6 +2944,7 @@ Naming/VariableName:
2668
2944
  - snake_case
2669
2945
  - camelCase
2670
2946
  AllowedIdentifiers: []
2947
+ AllowedPatterns: []
2671
2948
 
2672
2949
  Naming/VariableNumber:
2673
2950
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2689,14 +2966,31 @@ Naming/VariableNumber:
2689
2966
  - rfc822 # Time#rfc822
2690
2967
  - rfc2822 # Time#rfc2822
2691
2968
  - rfc3339 # DateTime.rfc3339
2969
+ - x86_64 # Allowed by default as an underscore separated CPU architecture name
2970
+ AllowedPatterns: []
2692
2971
 
2693
2972
  #################### Security ##############################
2694
2973
 
2974
+ Security/CompoundHash:
2975
+ Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
2976
+ Enabled: pending
2977
+ Safe: false
2978
+ VersionAdded: '1.28'
2979
+ VersionChanged: '1.51'
2980
+
2695
2981
  Security/Eval:
2696
2982
  Description: 'The use of eval represents a serious security risk.'
2697
2983
  Enabled: true
2698
2984
  VersionAdded: '0.47'
2699
2985
 
2986
+ Security/IoMethods:
2987
+ Description: >-
2988
+ Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
2989
+ `IO.foreach`, and `IO.readlines`.
2990
+ Enabled: pending
2991
+ Safe: false
2992
+ VersionAdded: '1.22'
2993
+
2700
2994
  Security/JSONLoad:
2701
2995
  Description: >-
2702
2996
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
@@ -2704,10 +2998,9 @@ Security/JSONLoad:
2704
2998
  Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2705
2999
  Enabled: true
2706
3000
  VersionAdded: '0.43'
2707
- VersionChanged: '0.44'
3001
+ VersionChanged: '1.22'
2708
3002
  # Autocorrect here will change to a method that may cause crashes depending
2709
3003
  # on the value of the argument.
2710
- AutoCorrect: false
2711
3004
  SafeAutoCorrect: false
2712
3005
 
2713
3006
  Security/MarshalLoad:
@@ -2746,6 +3039,7 @@ Style/AccessModifierDeclarations:
2746
3039
  - inline
2747
3040
  - group
2748
3041
  AllowModifiersOnSymbols: true
3042
+ SafeAutoCorrect: false
2749
3043
 
2750
3044
  Style/AccessorGrouping:
2751
3045
  Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
@@ -2773,8 +3067,9 @@ Style/AndOr:
2773
3067
  Description: 'Use &&/|| instead of and/or.'
2774
3068
  StyleGuide: '#no-and-or-or'
2775
3069
  Enabled: true
3070
+ SafeAutoCorrect: false
2776
3071
  VersionAdded: '0.9'
2777
- VersionChanged: '0.25'
3072
+ VersionChanged: '1.21'
2778
3073
  # Whether `and` and `or` are banned only in conditionals (conditionals)
2779
3074
  # or completely (always).
2780
3075
  EnforcedStyle: conditionals
@@ -2787,6 +3082,7 @@ Style/ArgumentsForwarding:
2787
3082
  StyleGuide: '#arguments-forwarding'
2788
3083
  Enabled: pending
2789
3084
  AllowOnlyRestArgument: true
3085
+ UseAnonymousForwarding: true
2790
3086
  VersionAdded: '1.1'
2791
3087
 
2792
3088
  Style/ArrayCoercion:
@@ -2798,6 +3094,12 @@ Style/ArrayCoercion:
2798
3094
  Enabled: false
2799
3095
  VersionAdded: '0.88'
2800
3096
 
3097
+ Style/ArrayIntersect:
3098
+ Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
3099
+ Enabled: 'pending'
3100
+ Safe: false
3101
+ VersionAdded: '1.40'
3102
+
2801
3103
  Style/ArrayJoin:
2802
3104
  Description: 'Use Array#join instead of Array#*.'
2803
3105
  StyleGuide: '#array-join'
@@ -2808,9 +3110,9 @@ Style/ArrayJoin:
2808
3110
  Style/AsciiComments:
2809
3111
  Description: 'Use only ascii symbols in comments.'
2810
3112
  StyleGuide: '#english-comments'
2811
- Enabled: true
3113
+ Enabled: false
2812
3114
  VersionAdded: '0.9'
2813
- VersionChanged: '0.52'
3115
+ VersionChanged: '1.21'
2814
3116
  AllowedChars:
2815
3117
  - ©
2816
3118
 
@@ -2879,7 +3181,7 @@ Style/BlockDelimiters:
2879
3181
  # This looks at the usage of a block's method to determine its type (e.g. is
2880
3182
  # the result of a `map` assigned to a variable or passed to another
2881
3183
  # method) but exceptions are permitted in the `ProceduralMethods`,
2882
- # `FunctionalMethods` and `IgnoredMethods` sections below.
3184
+ # `FunctionalMethods` and `AllowedMethods` sections below.
2883
3185
  - semantic
2884
3186
  # The `braces_for_chaining` style enforces braces around single line blocks
2885
3187
  # and do..end around multi-line blocks, except for multi-line blocks whose
@@ -2920,7 +3222,7 @@ Style/BlockDelimiters:
2920
3222
  - let!
2921
3223
  - subject
2922
3224
  - watch
2923
- IgnoredMethods:
3225
+ AllowedMethods:
2924
3226
  # Methods that can be either procedural or functional and cannot be
2925
3227
  # categorised from their usage alone, e.g.
2926
3228
  #
@@ -2937,6 +3239,7 @@ Style/BlockDelimiters:
2937
3239
  - lambda
2938
3240
  - proc
2939
3241
  - it
3242
+ AllowedPatterns: []
2940
3243
  # The AllowBracesOnProceduralOneLiners option is ignored unless the
2941
3244
  # EnforcedStyle is set to `semantic`. If so:
2942
3245
  #
@@ -2960,7 +3263,7 @@ Style/BlockDelimiters:
2960
3263
  # collection.each do |element| puts element end
2961
3264
  AllowBracesOnProceduralOneLiners: false
2962
3265
  # The BracesRequiredMethods overrides all other configurations except
2963
- # IgnoredMethods. It can be used to enforce that all blocks for specific
3266
+ # AllowedMethods. It can be used to enforce that all blocks for specific
2964
3267
  # methods use braces. For example, you can use this to enforce Sorbet
2965
3268
  # signatures use braces even when the rest of your codebase enforces
2966
3269
  # the `line_count_based` style.
@@ -2972,7 +3275,7 @@ Style/CaseEquality:
2972
3275
  Enabled: true
2973
3276
  VersionAdded: '0.9'
2974
3277
  VersionChanged: '0.89'
2975
- # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
3278
+ # If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
2976
3279
  # the case equality operator is a constant.
2977
3280
  #
2978
3281
  # # bad
@@ -2981,13 +3284,25 @@ Style/CaseEquality:
2981
3284
  # # good
2982
3285
  # String === "string"
2983
3286
  AllowOnConstant: false
3287
+ # If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
3288
+ # the case equality operator is `self.class`.
3289
+ #
3290
+ # # bad
3291
+ # some_class === object
3292
+ #
3293
+ # # good
3294
+ # self.class === object
3295
+ AllowOnSelfClass: false
2984
3296
 
2985
3297
  Style/CaseLikeIf:
2986
- Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
3298
+ Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2987
3299
  StyleGuide: '#case-vs-if-else'
2988
3300
  Enabled: true
2989
3301
  Safe: false
2990
3302
  VersionAdded: '0.88'
3303
+ VersionChanged: '1.48'
3304
+ # `MinBranchesCount` defines the number of branches `if` needs to have to trigger this cop.
3305
+ MinBranchesCount: 3
2991
3306
 
2992
3307
  Style/CharacterLiteral:
2993
3308
  Description: 'Checks for uses of character literals.'
@@ -3000,7 +3315,7 @@ Style/ClassAndModuleChildren:
3000
3315
  StyleGuide: '#namespace-definition'
3001
3316
  # Moving from compact to nested children requires knowledge of whether the
3002
3317
  # outer parent is a module or a class. Moving from nested to compact requires
3003
- # verification that the outer parent is defined elsewhere. Rubocop does not
3318
+ # verification that the outer parent is defined elsewhere. RuboCop does not
3004
3319
  # have the knowledge to perform either operation safely and thus requires
3005
3320
  # manual oversight.
3006
3321
  SafeAutoCorrect: false
@@ -3040,10 +3355,11 @@ Style/ClassEqualityComparison:
3040
3355
  StyleGuide: '#instance-of-vs-class-comparison'
3041
3356
  Enabled: true
3042
3357
  VersionAdded: '0.93'
3043
- IgnoredMethods:
3358
+ AllowedMethods:
3044
3359
  - ==
3045
3360
  - equal?
3046
3361
  - eql?
3362
+ AllowedPatterns: []
3047
3363
 
3048
3364
  Style/ClassMethods:
3049
3365
  Description: 'Use self when defining module/class methods.'
@@ -3057,7 +3373,7 @@ Style/ClassMethodsDefinitions:
3057
3373
  StyleGuide: '#def-self-class-methods'
3058
3374
  Enabled: false
3059
3375
  VersionAdded: '0.89'
3060
- EnforcedStyle: def_self
3376
+ EnforcedStyle: def_self
3061
3377
  SupportedStyles:
3062
3378
  - def_self
3063
3379
  - self_class
@@ -3074,6 +3390,7 @@ Style/CollectionCompact:
3074
3390
  Safe: false
3075
3391
  VersionAdded: '1.2'
3076
3392
  VersionChanged: '1.3'
3393
+ AllowedReceivers: []
3077
3394
 
3078
3395
  # Align with the style guide.
3079
3396
  Style/CollectionMethods:
@@ -3147,7 +3464,7 @@ Style/CommentAnnotation:
3147
3464
  StyleGuide: '#annotate-keywords'
3148
3465
  Enabled: true
3149
3466
  VersionAdded: '0.10'
3150
- VersionChanged: '1.3'
3467
+ VersionChanged: '1.20'
3151
3468
  Keywords:
3152
3469
  - TODO
3153
3470
  - FIXME
@@ -3155,12 +3472,25 @@ Style/CommentAnnotation:
3155
3472
  - HACK
3156
3473
  - REVIEW
3157
3474
  - NOTE
3475
+ RequireColon: true
3158
3476
 
3159
3477
  Style/CommentedKeyword:
3160
3478
  Description: 'Do not place comments on the same line as certain keywords.'
3161
3479
  Enabled: true
3480
+ SafeAutoCorrect: false
3162
3481
  VersionAdded: '0.51'
3163
- VersionChanged: '1.7'
3482
+ VersionChanged: '1.19'
3483
+
3484
+ Style/ComparableClamp:
3485
+ Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3486
+ Enabled: pending
3487
+ VersionAdded: '1.44'
3488
+
3489
+ Style/ConcatArrayLiterals:
3490
+ Description: 'Enforces the use of `Array#push(item)` instead of `Array#concat([item])` to avoid redundant array literals.'
3491
+ Enabled: pending
3492
+ Safe: false
3493
+ VersionAdded: '1.41'
3164
3494
 
3165
3495
  Style/ConditionalAssignment:
3166
3496
  Description: >-
@@ -3217,9 +3547,17 @@ Style/Copyright:
3217
3547
  Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
3218
3548
  AutocorrectNotice: ''
3219
3549
 
3550
+ Style/DataInheritance:
3551
+ Description: 'Checks for inheritance from Data.define.'
3552
+ StyleGuide: '#no-extend-data-define'
3553
+ Enabled: pending
3554
+ SafeAutoCorrect: false
3555
+ VersionAdded: '1.49'
3556
+ VersionChanged: '1.51'
3557
+
3220
3558
  Style/DateTime:
3221
3559
  Description: 'Use Time over DateTime.'
3222
- StyleGuide: '#date--time'
3560
+ StyleGuide: '#date-time'
3223
3561
  Enabled: false
3224
3562
  VersionAdded: '0.51'
3225
3563
  VersionChanged: '0.92'
@@ -3240,6 +3578,12 @@ Style/Dir:
3240
3578
  Enabled: true
3241
3579
  VersionAdded: '0.50'
3242
3580
 
3581
+ Style/DirEmpty:
3582
+ Description: >-
3583
+ Prefer to use `Dir.empty?('path/to/dir')` when checking if a directory is empty.
3584
+ Enabled: pending
3585
+ VersionAdded: '1.48'
3586
+
3243
3587
  Style/DisableCopsWithinSourceCodeDirective:
3244
3588
  Description: >-
3245
3589
  Forbids disabling/enabling cops within source code.
@@ -3328,6 +3672,12 @@ Style/EmptyElse:
3328
3672
  - empty
3329
3673
  - nil
3330
3674
  - both
3675
+ AllowComments: false
3676
+
3677
+ Style/EmptyHeredoc:
3678
+ Description: 'Checks for using empty heredoc to reduce redundancy.'
3679
+ Enabled: pending
3680
+ VersionAdded: '1.32'
3331
3681
 
3332
3682
  Style/EmptyLambdaParameter:
3333
3683
  Description: 'Omit parens for empty lambda parameters.'
@@ -3376,6 +3726,12 @@ Style/EndlessMethod:
3376
3726
  - allow_always
3377
3727
  - disallow
3378
3728
 
3729
+ Style/EnvHome:
3730
+ Description: "Checks for consistent usage of `ENV['HOME']`."
3731
+ Enabled: pending
3732
+ Safe: false
3733
+ VersionAdded: '1.29'
3734
+
3379
3735
  Style/EvalWithLocation:
3380
3736
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3381
3737
  Enabled: true
@@ -3388,6 +3744,11 @@ Style/EvenOdd:
3388
3744
  VersionAdded: '0.12'
3389
3745
  VersionChanged: '0.29'
3390
3746
 
3747
+ Style/ExactRegexpMatch:
3748
+ Description: 'Checks for exact regexp match inside Regexp literals.'
3749
+ Enabled: pending
3750
+ VersionAdded: '1.51'
3751
+
3391
3752
  Style/ExpandPathArguments:
3392
3753
  Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3393
3754
  Enabled: true
@@ -3413,6 +3774,35 @@ Style/ExponentialNotation:
3413
3774
  - engineering
3414
3775
  - integral
3415
3776
 
3777
+ Style/FetchEnvVar:
3778
+ Description: >-
3779
+ Suggests `ENV.fetch` for the replacement of `ENV[]`.
3780
+ Reference:
3781
+ - https://rubystyle.guide/#hash-fetch-defaults
3782
+ Enabled: pending
3783
+ VersionAdded: '1.28'
3784
+ # Environment variables to be excluded from the inspection.
3785
+ AllowedVars: []
3786
+
3787
+ Style/FileEmpty:
3788
+ Description: >-
3789
+ Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
3790
+ Enabled: pending
3791
+ Safe: false
3792
+ VersionAdded: '1.48'
3793
+
3794
+ Style/FileRead:
3795
+ Description: 'Favor `File.(bin)read` convenience methods.'
3796
+ StyleGuide: '#file-read'
3797
+ Enabled: pending
3798
+ VersionAdded: '1.24'
3799
+
3800
+ Style/FileWrite:
3801
+ Description: 'Favor `File.(bin)write` convenience methods.'
3802
+ StyleGuide: '#file-write'
3803
+ Enabled: pending
3804
+ VersionAdded: '1.24'
3805
+
3416
3806
  Style/FloatDivision:
3417
3807
  Description: 'For performing float division, coerce one side only.'
3418
3808
  StyleGuide: '#float-division'
@@ -3432,8 +3822,9 @@ Style/For:
3432
3822
  Description: 'Checks use of for or each in multiline loops.'
3433
3823
  StyleGuide: '#no-for-loops'
3434
3824
  Enabled: true
3825
+ SafeAutoCorrect: false
3435
3826
  VersionAdded: '0.13'
3436
- VersionChanged: '0.59'
3827
+ VersionChanged: '1.26'
3437
3828
  EnforcedStyle: each
3438
3829
  SupportedStyles:
3439
3830
  - each
@@ -3468,7 +3859,8 @@ Style/FormatStringToken:
3468
3859
  MaxUnannotatedPlaceholdersAllowed: 1
3469
3860
  VersionAdded: '0.49'
3470
3861
  VersionChanged: '1.0'
3471
- IgnoredMethods: []
3862
+ AllowedMethods: []
3863
+ AllowedPatterns: []
3472
3864
 
3473
3865
  Style/FrozenStringLiteralComment:
3474
3866
  Description: >-
@@ -3513,10 +3905,11 @@ Style/GuardClause:
3513
3905
  StyleGuide: '#no-nested-conditionals'
3514
3906
  Enabled: true
3515
3907
  VersionAdded: '0.20'
3516
- VersionChanged: '0.22'
3908
+ VersionChanged: '1.31'
3517
3909
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3518
3910
  # needs to have to trigger this cop
3519
3911
  MinBodyLength: 1
3912
+ AllowConsecutiveConditionals: false
3520
3913
 
3521
3914
  Style/HashAsLastArrayItem:
3522
3915
  Description: >-
@@ -3534,8 +3927,9 @@ Style/HashConversion:
3534
3927
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3535
3928
  StyleGuide: '#avoid-hash-constructor'
3536
3929
  Enabled: pending
3930
+ SafeAutoCorrect: false
3537
3931
  VersionAdded: '1.10'
3538
- VersionChanged: '1.11'
3932
+ VersionChanged: '1.55'
3539
3933
  AllowSplatArgument: true
3540
3934
 
3541
3935
  Style/HashEachMethods:
@@ -3545,14 +3939,17 @@ Style/HashEachMethods:
3545
3939
  Safe: false
3546
3940
  VersionAdded: '0.80'
3547
3941
  VersionChanged: '1.16'
3548
- AllowedReceivers: []
3942
+ AllowedReceivers:
3943
+ - Thread.current
3549
3944
 
3550
3945
  Style/HashExcept:
3551
3946
  Description: >-
3552
3947
  Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3553
3948
  that can be replaced with `Hash#except` method.
3554
3949
  Enabled: pending
3950
+ Safe: false
3555
3951
  VersionAdded: '1.7'
3952
+ VersionChanged: '1.39'
3556
3953
 
3557
3954
  Style/HashLikeCase:
3558
3955
  Description: >-
@@ -3571,7 +3968,7 @@ Style/HashSyntax:
3571
3968
  StyleGuide: '#hash-literals'
3572
3969
  Enabled: true
3573
3970
  VersionAdded: '0.9'
3574
- VersionChanged: '0.43'
3971
+ VersionChanged: '1.24'
3575
3972
  EnforcedStyle: ruby19
3576
3973
  SupportedStyles:
3577
3974
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -3582,6 +3979,17 @@ Style/HashSyntax:
3582
3979
  - no_mixed_keys
3583
3980
  # enforces both ruby19 and no_mixed_keys styles
3584
3981
  - ruby19_no_mixed_keys
3982
+ # Force hashes that have a hash value omission
3983
+ EnforcedShorthandSyntax: always
3984
+ SupportedShorthandSyntax:
3985
+ # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3986
+ - always
3987
+ # forces use of explicit hash literal value.
3988
+ - never
3989
+ # accepts both shorthand and explicit use of hash literal value.
3990
+ - either
3991
+ # forces use of the 3.1 syntax only if all values can be omitted in the hash.
3992
+ - consistent
3585
3993
  # Force hashes that have a symbol value to use hash rockets
3586
3994
  UseHashRocketsWithSymbolValues: false
3587
3995
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3607,8 +4015,9 @@ Style/IdenticalConditionalBranches:
3607
4015
  line at the end of each branch, which can validly be moved
3608
4016
  out of the conditional.
3609
4017
  Enabled: true
4018
+ SafeAutoCorrect: false
3610
4019
  VersionAdded: '0.36'
3611
- VersionChanged: '1.16'
4020
+ VersionChanged: '1.19'
3612
4021
 
3613
4022
  Style/IfInsideElse:
3614
4023
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
@@ -3664,7 +4073,7 @@ Style/InPatternThen:
3664
4073
  Style/InfiniteLoop:
3665
4074
  Description: >-
3666
4075
  Use Kernel#loop for infinite loops.
3667
- This cop is unsafe in the body may raise a `StopIteration` exception.
4076
+ This cop is unsafe if the body may raise a `StopIteration` exception.
3668
4077
  Safe: false
3669
4078
  StyleGuide: '#infinite-loop'
3670
4079
  Enabled: true
@@ -3693,16 +4102,41 @@ Style/InverseMethods:
3693
4102
  :=~: :!~
3694
4103
  :<: :>=
3695
4104
  :>: :<=
3696
- # `ActiveSupport` defines some common inverse methods. They are listed below,
3697
- # and not enabled by default.
3698
- #:present?: :blank?,
3699
- #:include?: :exclude?
3700
4105
  # `InverseBlocks` are methods that are inverted by inverting the return
3701
4106
  # of the block that is passed to the method
3702
4107
  InverseBlocks:
3703
4108
  :select: :reject
3704
4109
  :select!: :reject!
3705
4110
 
4111
+ Style/InvertibleUnlessCondition:
4112
+ Description: 'Favor `if` with inverted condition over `unless`.'
4113
+ Enabled: false
4114
+ Safe: false
4115
+ VersionAdded: '1.44'
4116
+ VersionChanged: '1.50'
4117
+ # `InverseMethods` are methods that can be inverted in a `unless` condition.
4118
+ # The relationship of inverse methods needs to be defined in both directions.
4119
+ # Keys and values both need to be defined as symbols.
4120
+ InverseMethods:
4121
+ :!=: :==
4122
+ :>: :<=
4123
+ :<=: :>
4124
+ :<: :>=
4125
+ :>=: :<
4126
+ :!~: :=~
4127
+ :zero?: :nonzero?
4128
+ :nonzero?: :zero?
4129
+ :any?: :none?
4130
+ :none?: :any?
4131
+ :even?: :odd?
4132
+ :odd?: :even?
4133
+ # `ActiveSupport` defines some common inverse methods. They are listed below,
4134
+ # and not enabled by default.
4135
+ # :present?: :blank?
4136
+ # :blank?: :present?
4137
+ # :include?: :exclude?
4138
+ # :exclude?: :include?
4139
+
3706
4140
  Style/IpAddresses:
3707
4141
  Description: "Don't include literal IP addresses in code."
3708
4142
  Enabled: false
@@ -3757,6 +4191,43 @@ Style/LineEndConcatenation:
3757
4191
  VersionAdded: '0.18'
3758
4192
  VersionChanged: '0.64'
3759
4193
 
4194
+ Style/MagicCommentFormat:
4195
+ Description: 'Use a consistent style for magic comments.'
4196
+ Enabled: pending
4197
+ VersionAdded: '1.35'
4198
+ EnforcedStyle: snake_case
4199
+ SupportedStyles:
4200
+ # `snake` will enforce the magic comment is written
4201
+ # in snake case (words separated by underscores).
4202
+ # Eg: froze_string_literal: true
4203
+ - snake_case
4204
+ # `kebab` will enforce the magic comment is written
4205
+ # in kebab case (words separated by hyphens).
4206
+ # Eg: froze-string-literal: true
4207
+ - kebab_case
4208
+ DirectiveCapitalization: lowercase
4209
+ ValueCapitalization: ~
4210
+ SupportedCapitalizations:
4211
+ - lowercase
4212
+ - uppercase
4213
+
4214
+ Style/MapCompactWithConditionalBlock:
4215
+ Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
4216
+ Enabled: pending
4217
+ VersionAdded: '1.30'
4218
+
4219
+ Style/MapToHash:
4220
+ Description: 'Prefer `to_h` with a block over `map.to_h`.'
4221
+ Enabled: pending
4222
+ VersionAdded: '1.24'
4223
+ Safe: false
4224
+
4225
+ Style/MapToSet:
4226
+ Description: 'Prefer `to_set` with a block over `map.to_set`.'
4227
+ Enabled: pending
4228
+ Safe: false
4229
+ VersionAdded: '1.42'
4230
+
3760
4231
  Style/MethodCallWithArgsParentheses:
3761
4232
  Description: 'Use parentheses for method calls with arguments.'
3762
4233
  StyleGuide: '#method-invocation-parens'
@@ -3764,8 +4235,8 @@ Style/MethodCallWithArgsParentheses:
3764
4235
  VersionAdded: '0.47'
3765
4236
  VersionChanged: '1.7'
3766
4237
  IgnoreMacros: true
3767
- IgnoredMethods: []
3768
- IgnoredPatterns: []
4238
+ AllowedMethods: []
4239
+ AllowedPatterns: []
3769
4240
  IncludedMacros: []
3770
4241
  AllowParenthesesInMultilineCall: false
3771
4242
  AllowParenthesesInChaining: false
@@ -3780,7 +4251,8 @@ Style/MethodCallWithoutArgsParentheses:
3780
4251
  Description: 'Do not use parentheses for method calls with no arguments.'
3781
4252
  StyleGuide: '#method-invocation-parens'
3782
4253
  Enabled: true
3783
- IgnoredMethods: []
4254
+ AllowedMethods: []
4255
+ AllowedPatterns: []
3784
4256
  VersionAdded: '0.47'
3785
4257
  VersionChanged: '0.55'
3786
4258
 
@@ -3811,6 +4283,12 @@ Style/MinMax:
3811
4283
  Enabled: true
3812
4284
  VersionAdded: '0.50'
3813
4285
 
4286
+ Style/MinMaxComparison:
4287
+ Description: 'Enforces the use of `max` or `min` instead of comparison for greater or less.'
4288
+ Enabled: pending
4289
+ Safe: false
4290
+ VersionAdded: '1.42'
4291
+
3814
4292
  Style/MissingElse:
3815
4293
  Description: >-
3816
4294
  Require if/case expressions to have an else branches.
@@ -3933,6 +4411,8 @@ Style/MultipleComparison:
3933
4411
  Enabled: true
3934
4412
  VersionAdded: '0.49'
3935
4413
  VersionChanged: '1.1'
4414
+ AllowMethodComparison: true
4415
+ ComparisonsThreshold: 2
3936
4416
 
3937
4417
  Style/MutableConstant:
3938
4418
  Description: 'Do not assign mutable objects to constants.'
@@ -3970,7 +4450,7 @@ Style/NegatedIf:
3970
4450
 
3971
4451
  Style/NegatedIfElseCondition:
3972
4452
  Description: >-
3973
- This cop checks for uses of `if-else` and ternary operators with a negated condition
4453
+ Checks for uses of `if-else` and ternary operators with a negated condition
3974
4454
  which can be simplified by inverting condition and swapping branches.
3975
4455
  Enabled: pending
3976
4456
  VersionAdded: '1.2'
@@ -3995,6 +4475,11 @@ Style/NegatedWhile:
3995
4475
  Enabled: true
3996
4476
  VersionAdded: '0.20'
3997
4477
 
4478
+ Style/NestedFileDirname:
4479
+ Description: 'Checks for nested `File.dirname`.'
4480
+ Enabled: pending
4481
+ VersionAdded: '1.26'
4482
+
3998
4483
  Style/NestedModifier:
3999
4484
  Description: 'Avoid using nested modifiers.'
4000
4485
  StyleGuide: '#no-nested-modifiers'
@@ -4089,6 +4574,21 @@ Style/Not:
4089
4574
  VersionAdded: '0.9'
4090
4575
  VersionChanged: '0.20'
4091
4576
 
4577
+ Style/NumberedParameters:
4578
+ Description: 'Restrict the usage of numbered parameters.'
4579
+ Enabled: pending
4580
+ VersionAdded: '1.22'
4581
+ EnforcedStyle: allow_single_line
4582
+ SupportedStyles:
4583
+ - allow_single_line
4584
+ - disallow
4585
+
4586
+ Style/NumberedParametersLimit:
4587
+ Description: 'Avoid excessive numbered params in a single block.'
4588
+ Enabled: pending
4589
+ VersionAdded: '1.22'
4590
+ Max: 1
4591
+
4092
4592
  Style/NumericLiteralPrefix:
4093
4593
  Description: 'Use smallcase prefixes for numeric literals.'
4094
4594
  StyleGuide: '#numeric-literal-prefixes'
@@ -4099,7 +4599,6 @@ Style/NumericLiteralPrefix:
4099
4599
  - zero_with_o
4100
4600
  - zero_only
4101
4601
 
4102
-
4103
4602
  Style/NumericLiterals:
4104
4603
  Description: >-
4105
4604
  Add underscores to large numeric literals to improve their
@@ -4110,17 +4609,19 @@ Style/NumericLiterals:
4110
4609
  VersionChanged: '0.48'
4111
4610
  MinDigits: 5
4112
4611
  Strict: false
4612
+ # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4613
+ AllowedNumbers: []
4614
+ AllowedPatterns: []
4113
4615
 
4114
4616
  Style/NumericPredicate:
4115
4617
  Description: >-
4116
4618
  Checks for the use of predicate- or comparison methods for
4117
4619
  numeric comparisons.
4118
4620
  StyleGuide: '#predicate-methods'
4119
- Safe: false
4120
4621
  # This will change to a new method call which isn't guaranteed to be on the
4121
4622
  # object. Switching these methods has to be done with knowledge of the types
4122
4623
  # of the variables which rubocop doesn't have.
4123
- SafeAutoCorrect: false
4624
+ Safe: false
4124
4625
  Enabled: true
4125
4626
  VersionAdded: '0.42'
4126
4627
  VersionChanged: '0.59'
@@ -4128,12 +4629,26 @@ Style/NumericPredicate:
4128
4629
  SupportedStyles:
4129
4630
  - predicate
4130
4631
  - comparison
4131
- IgnoredMethods: []
4632
+ AllowedMethods: []
4633
+ AllowedPatterns: []
4132
4634
  # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
4133
4635
  # false positives.
4134
4636
  Exclude:
4135
4637
  - 'spec/**/*'
4136
4638
 
4639
+ Style/ObjectThen:
4640
+ Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
4641
+ StyleGuide: '#object-yield-self-vs-object-then'
4642
+ Enabled: pending
4643
+ VersionAdded: '1.28'
4644
+ # Use `Object#yield_self` or `Object#then`?
4645
+ # Prefer `Object#yield_self` to `Object#then` (yield_self)
4646
+ # Prefer `Object#then` to `Object#yield_self` (then)
4647
+ EnforcedStyle: 'then'
4648
+ SupportedStyles:
4649
+ - then
4650
+ - yield_self
4651
+
4137
4652
  Style/OneLineConditional:
4138
4653
  Description: >-
4139
4654
  Favor the ternary operator (?:) or multi-line constructs over
@@ -4144,6 +4659,24 @@ Style/OneLineConditional:
4144
4659
  VersionAdded: '0.9'
4145
4660
  VersionChanged: '0.90'
4146
4661
 
4662
+ Style/OpenStructUse:
4663
+ Description: >-
4664
+ Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4665
+ version compatibility, and potential security issues.
4666
+ Reference:
4667
+ - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4668
+
4669
+ Enabled: pending
4670
+ Safe: false
4671
+ VersionAdded: '1.23'
4672
+ VersionChanged: '1.51'
4673
+
4674
+ Style/OperatorMethodCall:
4675
+ Description: 'Checks for redundant dot before operator method call.'
4676
+ StyleGuide: '#operator-method-call'
4677
+ Enabled: pending
4678
+ VersionAdded: '1.37'
4679
+
4147
4680
  Style/OptionHash:
4148
4681
  Description: "Don't use option hashes when you can use keyword arguments."
4149
4682
  Enabled: false
@@ -4156,6 +4689,7 @@ Style/OptionHash:
4156
4689
  - args
4157
4690
  - params
4158
4691
  - parameters
4692
+ Allowlist: []
4159
4693
 
4160
4694
  Style/OptionalArguments:
4161
4695
  Description: >-
@@ -4288,10 +4822,16 @@ Style/RedundantArgument:
4288
4822
  Enabled: pending
4289
4823
  Safe: false
4290
4824
  VersionAdded: '1.4'
4291
- VersionChanged: '1.7'
4825
+ VersionChanged: '1.55'
4292
4826
  Methods:
4293
4827
  # Array#join
4294
4828
  join: ''
4829
+ # Array#sum
4830
+ sum: 0
4831
+ # Kernel.#exit
4832
+ exit: true
4833
+ # Kernel.#exit!
4834
+ exit!: false
4295
4835
  # String#split
4296
4836
  split: ' '
4297
4837
  # String#chomp
@@ -4299,6 +4839,11 @@ Style/RedundantArgument:
4299
4839
  # String#chomp!
4300
4840
  chomp!: "\n"
4301
4841
 
4842
+ Style/RedundantArrayConstructor:
4843
+ Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
4844
+ Enabled: pending
4845
+ VersionAdded: '1.52'
4846
+
4302
4847
  Style/RedundantAssignment:
4303
4848
  Description: 'Checks for redundant assignment before returning.'
4304
4849
  Enabled: true
@@ -4326,6 +4871,27 @@ Style/RedundantConditional:
4326
4871
  Enabled: true
4327
4872
  VersionAdded: '0.50'
4328
4873
 
4874
+ Style/RedundantConstantBase:
4875
+ Description: Avoid redundant `::` prefix on constant.
4876
+ Enabled: pending
4877
+ VersionAdded: '1.40'
4878
+
4879
+ Style/RedundantCurrentDirectoryInPath:
4880
+ Description: 'Checks for uses a redundant current directory in path.'
4881
+ Enabled: pending
4882
+ VersionAdded: '1.53'
4883
+
4884
+ Style/RedundantDoubleSplatHashBraces:
4885
+ Description: 'Checks for redundant uses of double splat hash braces.'
4886
+ Enabled: pending
4887
+ VersionAdded: '1.41'
4888
+
4889
+ Style/RedundantEach:
4890
+ Description: 'Checks for redundant `each`.'
4891
+ Enabled: pending
4892
+ Safe: false
4893
+ VersionAdded: '1.38'
4894
+
4329
4895
  Style/RedundantException:
4330
4896
  Description: "Checks for an obsolete RuntimeException argument in raise/fail."
4331
4897
  StyleGuide: '#no-explicit-runtimeerror'
@@ -4354,16 +4920,43 @@ Style/RedundantFileExtensionInRequire:
4354
4920
  Enabled: true
4355
4921
  VersionAdded: '0.88'
4356
4922
 
4923
+ Style/RedundantFilterChain:
4924
+ Description: >-
4925
+ Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
4926
+ `select`/`filter`/`find_all` and change them to use predicate method instead.
4927
+ Enabled: pending
4928
+ VersionAdded: '1.52'
4929
+
4357
4930
  Style/RedundantFreeze:
4358
4931
  Description: "Checks usages of Object#freeze on immutable objects."
4359
4932
  Enabled: true
4360
4933
  VersionAdded: '0.34'
4361
4934
  VersionChanged: '0.66'
4362
4935
 
4936
+ Style/RedundantHeredocDelimiterQuotes:
4937
+ Description: 'Checks for redundant heredoc delimiter quotes.'
4938
+ Enabled: pending
4939
+ VersionAdded: '1.45'
4940
+
4941
+ Style/RedundantInitialize:
4942
+ Description: 'Checks for redundant `initialize` methods.'
4943
+ Enabled: pending
4944
+ Safe: false
4945
+ AllowComments: true
4946
+ VersionAdded: '1.27'
4947
+ VersionChanged: '1.28'
4948
+
4363
4949
  Style/RedundantInterpolation:
4364
4950
  Description: 'Checks for strings that are just an interpolated expression.'
4365
4951
  Enabled: true
4952
+ SafeAutoCorrect: false
4366
4953
  VersionAdded: '0.76'
4954
+ VersionChanged: '1.30'
4955
+
4956
+ Style/RedundantLineContinuation:
4957
+ Description: 'Check for redundant line continuation.'
4958
+ Enabled: pending
4959
+ VersionAdded: '1.49'
4367
4960
 
4368
4961
  Style/RedundantParentheses:
4369
4962
  Description: "Checks for parentheses that seem not to serve any purpose."
@@ -4376,11 +4969,21 @@ Style/RedundantPercentQ:
4376
4969
  Enabled: true
4377
4970
  VersionAdded: '0.76'
4378
4971
 
4972
+ Style/RedundantRegexpArgument:
4973
+ Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
4974
+ Enabled: pending
4975
+ VersionAdded: '1.53'
4976
+
4379
4977
  Style/RedundantRegexpCharacterClass:
4380
4978
  Description: 'Checks for unnecessary single-element Regexp character classes.'
4381
4979
  Enabled: true
4382
4980
  VersionAdded: '0.85'
4383
4981
 
4982
+ Style/RedundantRegexpConstructor:
4983
+ Description: 'Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.'
4984
+ Enabled: pending
4985
+ VersionAdded: '1.52'
4986
+
4384
4987
  Style/RedundantRegexpEscape:
4385
4988
  Description: 'Checks for redundant escapes in Regexps.'
4386
4989
  Enabled: true
@@ -4408,18 +5011,30 @@ Style/RedundantSelfAssignment:
4408
5011
  Safe: false
4409
5012
  VersionAdded: '0.90'
4410
5013
 
5014
+ Style/RedundantSelfAssignmentBranch:
5015
+ Description: 'Checks for places where conditional branch makes redundant self-assignment.'
5016
+ Enabled: pending
5017
+ VersionAdded: '1.19'
5018
+
4411
5019
  Style/RedundantSort:
4412
5020
  Description: >-
4413
5021
  Use `min` instead of `sort.first`,
4414
5022
  `max_by` instead of `sort_by...last`, etc.
4415
5023
  Enabled: true
4416
5024
  VersionAdded: '0.76'
5025
+ VersionChanged: '1.22'
5026
+ Safe: false
4417
5027
 
4418
5028
  Style/RedundantSortBy:
4419
5029
  Description: 'Use `sort` instead of `sort_by { |x| x }`.'
4420
5030
  Enabled: true
4421
5031
  VersionAdded: '0.36'
4422
5032
 
5033
+ Style/RedundantStringEscape:
5034
+ Description: 'Checks for redundant escapes in string literals.'
5035
+ Enabled: pending
5036
+ VersionAdded: '1.37'
5037
+
4423
5038
  Style/RegexpLiteral:
4424
5039
  Description: 'Use / or %r around regular expressions.'
4425
5040
  StyleGuide: '#percent-r'
@@ -4438,6 +5053,12 @@ Style/RegexpLiteral:
4438
5053
  # are found in the regexp string.
4439
5054
  AllowInnerSlashes: false
4440
5055
 
5056
+ Style/RequireOrder:
5057
+ Description: Sort `require` and `require_relative` in alphabetical order.
5058
+ Enabled: false
5059
+ SafeAutoCorrect: false
5060
+ VersionAdded: '1.40'
5061
+
4441
5062
  Style/RescueModifier:
4442
5063
  Description: 'Avoid using rescue in its modifier form.'
4443
5064
  StyleGuide: '#no-rescue-modifiers'
@@ -4465,16 +5086,25 @@ Style/ReturnNil:
4465
5086
  - return_nil
4466
5087
  VersionAdded: '0.50'
4467
5088
 
5089
+ Style/ReturnNilInPredicateMethodDefinition:
5090
+ Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
5091
+ StyleGuide: '#bool-methods-qmark'
5092
+ Enabled: pending
5093
+ SafeAutoCorrect: false
5094
+ AllowedMethods: []
5095
+ AllowedPatterns: []
5096
+ VersionAdded: '1.53'
5097
+
4468
5098
  Style/SafeNavigation:
4469
5099
  Description: >-
4470
- This cop transforms usages of a method call safeguarded by
5100
+ Transforms usages of a method call safeguarded by
4471
5101
  a check for the existence of the object to
4472
5102
  safe navigation (`&.`).
4473
- Auto-correction is unsafe as it assumes the object will
5103
+ Autocorrection is unsafe as it assumes the object will
4474
5104
  be `nil` or truthy, but never `false`.
4475
5105
  Enabled: true
4476
5106
  VersionAdded: '0.43'
4477
- VersionChanged: '0.77'
5107
+ VersionChanged: '1.27'
4478
5108
  # Safe navigation may cause a statement to start returning `nil` in addition
4479
5109
  # to whatever it used to return.
4480
5110
  ConvertCodeThatCanStartToReturnNil: false
@@ -4485,6 +5115,8 @@ Style/SafeNavigation:
4485
5115
  - try
4486
5116
  - try!
4487
5117
  SafeAutoCorrect: false
5118
+ # Maximum length of method chains for register an offense.
5119
+ MaxChainLength: 2
4488
5120
 
4489
5121
  Style/Sample:
4490
5122
  Description: >-
@@ -4494,6 +5126,12 @@ Style/Sample:
4494
5126
  Enabled: true
4495
5127
  VersionAdded: '0.30'
4496
5128
 
5129
+ Style/SelectByRegexp:
5130
+ Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
5131
+ Enabled: pending
5132
+ SafeAutoCorrect: false
5133
+ VersionAdded: '1.22'
5134
+
4497
5135
  Style/SelfAssignment:
4498
5136
  Description: >-
4499
5137
  Checks for places where self-assignment shorthand should have
@@ -4579,10 +5217,12 @@ Style/SpecialGlobalVars:
4579
5217
  VersionAdded: '0.13'
4580
5218
  VersionChanged: '0.36'
4581
5219
  SafeAutoCorrect: false
5220
+ RequireEnglish: true
4582
5221
  EnforcedStyle: use_english_names
4583
5222
  SupportedStyles:
4584
5223
  - use_perl_names
4585
5224
  - use_english_names
5225
+ - use_builtin_english_names
4586
5226
 
4587
5227
  Style/StabbyLambdaParentheses:
4588
5228
  Description: 'Check for the usage of parentheses around stabby lambda arguments.'
@@ -4679,11 +5319,12 @@ Style/StructInheritance:
4679
5319
  Description: 'Checks for inheritance from Struct.new.'
4680
5320
  StyleGuide: '#no-extend-struct-new'
4681
5321
  Enabled: true
5322
+ SafeAutoCorrect: false
4682
5323
  VersionAdded: '0.29'
4683
- VersionChanged: '0.86'
5324
+ VersionChanged: '1.20'
4684
5325
 
4685
5326
  Style/SwapValues:
4686
- Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
5327
+ Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
4687
5328
  StyleGuide: '#values-swapping'
4688
5329
  Enabled: pending
4689
5330
  VersionAdded: '1.1'
@@ -4711,13 +5352,14 @@ Style/SymbolProc:
4711
5352
  Enabled: true
4712
5353
  Safe: false
4713
5354
  VersionAdded: '0.26'
4714
- VersionChanged: '1.5'
5355
+ VersionChanged: '1.40'
4715
5356
  AllowMethodsWithArguments: false
4716
- # A list of method names to be ignored by the check.
5357
+ # A list of method names to be always allowed by the check.
4717
5358
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4718
- IgnoredMethods:
4719
- - respond_to
5359
+ AllowedMethods:
4720
5360
  - define_method
5361
+ AllowedPatterns: []
5362
+ AllowComments: false
4721
5363
 
4722
5364
  Style/TernaryParentheses:
4723
5365
  Description: 'Checks for use of parentheses around ternary conditions.'
@@ -4732,7 +5374,7 @@ Style/TernaryParentheses:
4732
5374
  AllowSafeAssignment: true
4733
5375
 
4734
5376
  Style/TopLevelMethodDefinition:
4735
- Description: 'This cop looks for top-level method definitions.'
5377
+ Description: 'Looks for top-level method definitions.'
4736
5378
  StyleGuide: '#top-level-methods'
4737
5379
  Enabled: false
4738
5380
  VersionAdded: '1.15'
@@ -4899,7 +5541,7 @@ Style/VariableInterpolation:
4899
5541
 
4900
5542
  Style/WhenThen:
4901
5543
  Description: 'Use when x then ... for one-line cases.'
4902
- StyleGuide: '#one-line-cases'
5544
+ StyleGuide: '#no-when-semicolons'
4903
5545
  Enabled: true
4904
5546
  VersionAdded: '0.9'
4905
5547
 
@@ -4923,7 +5565,7 @@ Style/WordArray:
4923
5565
  StyleGuide: '#percent-w'
4924
5566
  Enabled: true
4925
5567
  VersionAdded: '0.9'
4926
- VersionChanged: '0.36'
5568
+ VersionChanged: '1.19'
4927
5569
  EnforcedStyle: percent
4928
5570
  SupportedStyles:
4929
5571
  # percent style: %w(word1 word2)
@@ -4937,6 +5579,11 @@ Style/WordArray:
4937
5579
  # The regular expression `WordRegex` decides what is considered a word.
4938
5580
  WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
4939
5581
 
5582
+ Style/YAMLFileRead:
5583
+ Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
5584
+ Enabled: pending
5585
+ VersionAdded: '1.53'
5586
+
4940
5587
  Style/YodaCondition:
4941
5588
  Description: 'Forbid or enforce yoda conditions.'
4942
5589
  Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
@@ -4955,6 +5602,19 @@ Style/YodaCondition:
4955
5602
  VersionAdded: '0.49'
4956
5603
  VersionChanged: '0.75'
4957
5604
 
5605
+ Style/YodaExpression:
5606
+ Description: 'Forbid the use of yoda expressions.'
5607
+ Enabled: false
5608
+ Safe: false
5609
+ VersionAdded: '1.42'
5610
+ VersionChanged: '1.43'
5611
+ SupportedOperators:
5612
+ - '*'
5613
+ - '+'
5614
+ - '&'
5615
+ - '|'
5616
+ - '^'
5617
+
4958
5618
  Style/ZeroLengthPredicate:
4959
5619
  Description: 'Use #empty? when testing for objects of length 0.'
4960
5620
  Enabled: true