rubocop 0.83.0 → 0.87.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (312) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -18
  3. data/config/default.yml +128 -23
  4. data/lib/rubocop.rb +21 -59
  5. data/lib/rubocop/ast_aliases.rb +8 -0
  6. data/lib/rubocop/cli.rb +2 -4
  7. data/lib/rubocop/cli/command/auto_genenerate_config.rb +42 -7
  8. data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
  9. data/lib/rubocop/cli/command/show_cops.rb +2 -6
  10. data/lib/rubocop/comment_config.rb +1 -1
  11. data/lib/rubocop/config.rb +1 -1
  12. data/lib/rubocop/config_loader.rb +24 -70
  13. data/lib/rubocop/config_loader_resolver.rb +21 -9
  14. data/lib/rubocop/config_obsoletion.rb +0 -1
  15. data/lib/rubocop/config_store.rb +12 -2
  16. data/lib/rubocop/cop/autocorrect_logic.rb +14 -25
  17. data/lib/rubocop/cop/base.rb +399 -0
  18. data/lib/rubocop/cop/bundler/gem_comment.rb +70 -1
  19. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +10 -20
  20. data/lib/rubocop/cop/commissioner.rb +48 -71
  21. data/lib/rubocop/cop/cop.rb +91 -227
  22. data/lib/rubocop/cop/corrector.rb +38 -115
  23. data/lib/rubocop/cop/correctors/alignment_corrector.rb +2 -6
  24. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +1 -1
  25. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -3
  26. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -3
  27. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +1 -1
  28. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +1 -1
  29. data/lib/rubocop/cop/generator.rb +2 -2
  30. data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
  31. data/lib/rubocop/cop/ignored_node.rb +1 -3
  32. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +11 -14
  33. data/lib/rubocop/cop/layout/case_indentation.rb +21 -22
  34. data/lib/rubocop/cop/layout/class_structure.rb +19 -16
  35. data/lib/rubocop/cop/layout/comment_indentation.rb +3 -3
  36. data/lib/rubocop/cop/layout/empty_comment.rb +1 -1
  37. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +2 -6
  38. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +57 -4
  39. data/lib/rubocop/cop/layout/end_of_line.rb +3 -3
  40. data/lib/rubocop/cop/layout/first_argument_indentation.rb +6 -4
  41. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +1 -3
  42. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
  43. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -3
  44. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
  45. data/lib/rubocop/cop/layout/hash_alignment.rb +8 -9
  46. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +3 -7
  47. data/lib/rubocop/cop/layout/heredoc_indentation.rb +20 -103
  48. data/lib/rubocop/cop/layout/indentation_width.rb +1 -3
  49. data/lib/rubocop/cop/layout/line_length.rb +17 -17
  50. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -2
  51. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -3
  52. data/lib/rubocop/cop/layout/space_after_colon.rb +1 -1
  53. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +19 -25
  54. data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
  55. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -3
  56. data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
  57. data/lib/rubocop/cop/layout/space_before_block_braces.rb +14 -0
  58. data/lib/rubocop/cop/layout/space_before_comment.rb +1 -3
  59. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +2 -4
  60. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
  61. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
  62. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +1 -3
  63. data/lib/rubocop/cop/legacy/corrections_proxy.rb +49 -0
  64. data/lib/rubocop/cop/legacy/corrector.rb +29 -0
  65. data/lib/rubocop/cop/lint/ambiguous_operator.rb +5 -2
  66. data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
  67. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +137 -0
  68. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  69. data/lib/rubocop/cop/lint/erb_new_arguments.rb +1 -3
  70. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  71. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +38 -2
  72. data/lib/rubocop/cop/lint/interpolation_check.rb +13 -0
  73. data/lib/rubocop/cop/lint/loop.rb +1 -1
  74. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +69 -0
  75. data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -1
  76. data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
  77. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +2 -2
  78. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +7 -7
  79. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +20 -5
  80. data/lib/rubocop/cop/lint/percent_string_array.rb +2 -4
  81. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  82. data/lib/rubocop/cop/lint/raise_exception.rb +12 -4
  83. data/lib/rubocop/cop/lint/rand_one.rb +1 -1
  84. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +31 -25
  85. data/lib/rubocop/cop/lint/redundant_require_statement.rb +3 -3
  86. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +2 -2
  87. data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -0
  88. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  89. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +9 -1
  90. data/lib/rubocop/cop/lint/suppressed_exception.rb +15 -2
  91. data/lib/rubocop/cop/lint/syntax.rb +11 -28
  92. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  93. data/lib/rubocop/cop/lint/unused_method_argument.rb +1 -1
  94. data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -4
  95. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +1 -1
  96. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
  97. data/lib/rubocop/cop/metrics/block_length.rb +22 -0
  98. data/lib/rubocop/cop/metrics/class_length.rb +25 -2
  99. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +35 -3
  100. data/lib/rubocop/cop/metrics/method_length.rb +23 -0
  101. data/lib/rubocop/cop/metrics/module_length.rb +25 -2
  102. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
  103. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +129 -0
  104. data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
  105. data/lib/rubocop/cop/migration/department_name.rb +7 -7
  106. data/lib/rubocop/cop/mixin/alignment.rb +1 -3
  107. data/lib/rubocop/cop/mixin/allowed_methods.rb +19 -0
  108. data/lib/rubocop/cop/mixin/array_min_size.rb +1 -3
  109. data/lib/rubocop/cop/mixin/auto_corrector.rb +12 -0
  110. data/lib/rubocop/cop/mixin/check_line_breakable.rb +3 -9
  111. data/lib/rubocop/cop/mixin/code_length.rb +4 -0
  112. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +1 -3
  113. data/lib/rubocop/cop/mixin/configurable_formatting.rb +3 -5
  114. data/lib/rubocop/cop/mixin/configurable_naming.rb +1 -1
  115. data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -2
  116. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  117. data/lib/rubocop/cop/mixin/enforce_superclass.rb +3 -1
  118. data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
  119. data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
  120. data/lib/rubocop/cop/mixin/line_length_help.rb +1 -1
  121. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
  122. data/lib/rubocop/cop/mixin/nil_methods.rb +3 -5
  123. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +6 -1
  124. data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
  125. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
  126. data/lib/rubocop/cop/mixin/range_help.rb +1 -1
  127. data/lib/rubocop/cop/mixin/regexp_literal_help.rb +43 -0
  128. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
  129. data/lib/rubocop/cop/mixin/surrounding_space.rb +10 -5
  130. data/lib/rubocop/cop/mixin/too_many_lines.rb +3 -13
  131. data/lib/rubocop/cop/mixin/trailing_comma.rb +2 -4
  132. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +7 -5
  133. data/lib/rubocop/cop/naming/ascii_identifiers.rb +27 -4
  134. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +3 -3
  135. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +11 -1
  136. data/lib/rubocop/cop/naming/file_name.rb +28 -17
  137. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
  138. data/lib/rubocop/cop/naming/method_name.rb +1 -1
  139. data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
  140. data/lib/rubocop/cop/naming/predicate_name.rb +4 -6
  141. data/lib/rubocop/cop/naming/variable_name.rb +1 -1
  142. data/lib/rubocop/cop/naming/variable_number.rb +1 -1
  143. data/lib/rubocop/cop/offense.rb +16 -2
  144. data/lib/rubocop/cop/registry.rb +63 -10
  145. data/lib/rubocop/cop/severity.rb +1 -3
  146. data/lib/rubocop/cop/style/accessor_grouping.rb +136 -0
  147. data/lib/rubocop/cop/style/and_or.rb +2 -2
  148. data/lib/rubocop/cop/style/array_join.rb +1 -1
  149. data/lib/rubocop/cop/style/attr.rb +1 -3
  150. data/lib/rubocop/cop/style/bare_percent_literals.rb +2 -2
  151. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +121 -0
  152. data/lib/rubocop/cop/style/block_delimiters.rb +4 -12
  153. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  154. data/lib/rubocop/cop/style/class_vars.rb +21 -0
  155. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  156. data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
  157. data/lib/rubocop/cop/style/conditional_assignment.rb +2 -4
  158. data/lib/rubocop/cop/style/copyright.rb +5 -5
  159. data/lib/rubocop/cop/style/date_time.rb +1 -1
  160. data/lib/rubocop/cop/style/dir.rb +2 -2
  161. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +1 -1
  162. data/lib/rubocop/cop/style/documentation.rb +2 -2
  163. data/lib/rubocop/cop/style/double_negation.rb +41 -4
  164. data/lib/rubocop/cop/style/empty_case_condition.rb +8 -6
  165. data/lib/rubocop/cop/style/empty_literal.rb +6 -8
  166. data/lib/rubocop/cop/style/empty_method.rb +1 -1
  167. data/lib/rubocop/cop/style/encoding.rb +1 -1
  168. data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -2
  169. data/lib/rubocop/cop/style/exponential_notation.rb +5 -5
  170. data/lib/rubocop/cop/style/format_string_token.rb +2 -3
  171. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -6
  172. data/lib/rubocop/cop/style/hash_each_methods.rb +1 -1
  173. data/lib/rubocop/cop/style/hash_syntax.rb +16 -7
  174. data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
  175. data/lib/rubocop/cop/style/if_inside_else.rb +1 -1
  176. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +12 -0
  177. data/lib/rubocop/cop/style/inline_comment.rb +1 -1
  178. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  179. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  180. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +1 -3
  181. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +1 -3
  182. data/lib/rubocop/cop/style/multiline_block_chain.rb +10 -1
  183. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  184. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  185. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +17 -6
  186. data/lib/rubocop/cop/style/mutable_constant.rb +4 -4
  187. data/lib/rubocop/cop/style/negated_if.rb +3 -3
  188. data/lib/rubocop/cop/style/negated_unless.rb +3 -3
  189. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +2 -5
  190. data/lib/rubocop/cop/style/nested_ternary_operator.rb +27 -0
  191. data/lib/rubocop/cop/style/next.rb +2 -2
  192. data/lib/rubocop/cop/style/non_nil_check.rb +1 -1
  193. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +2 -2
  194. data/lib/rubocop/cop/style/one_line_conditional.rb +2 -6
  195. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  196. data/lib/rubocop/cop/style/proc.rb +1 -1
  197. data/lib/rubocop/cop/style/random_with_offset.rb +4 -10
  198. data/lib/rubocop/cop/style/redundant_assignment.rb +117 -0
  199. data/lib/rubocop/cop/style/redundant_conditional.rb +4 -3
  200. data/lib/rubocop/cop/style/redundant_exception.rb +14 -10
  201. data/lib/rubocop/cop/style/redundant_fetch_block.rb +122 -0
  202. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  203. data/lib/rubocop/cop/style/redundant_parentheses.rb +10 -8
  204. data/lib/rubocop/cop/style/redundant_percent_q.rb +3 -3
  205. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +90 -0
  206. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +121 -0
  207. data/lib/rubocop/cop/style/redundant_self.rb +6 -9
  208. data/lib/rubocop/cop/style/rescue_standard_error.rb +1 -1
  209. data/lib/rubocop/cop/style/safe_navigation.rb +2 -6
  210. data/lib/rubocop/cop/style/sample.rb +1 -1
  211. data/lib/rubocop/cop/style/semicolon.rb +1 -1
  212. data/lib/rubocop/cop/style/signal_exception.rb +1 -1
  213. data/lib/rubocop/cop/style/slicing_with_range.rb +1 -1
  214. data/lib/rubocop/cop/style/special_global_vars.rb +2 -6
  215. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  216. data/lib/rubocop/cop/style/struct_inheritance.rb +23 -2
  217. data/lib/rubocop/cop/style/symbol_array.rb +5 -5
  218. data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
  219. data/lib/rubocop/cop/style/ternary_parentheses.rb +2 -4
  220. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +3 -3
  221. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +3 -3
  222. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +13 -13
  223. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +3 -3
  224. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -3
  225. data/lib/rubocop/cop/style/trivial_accessors.rb +8 -7
  226. data/lib/rubocop/cop/style/unless_else.rb +1 -1
  227. data/lib/rubocop/cop/style/when_then.rb +1 -1
  228. data/lib/rubocop/cop/style/word_array.rb +1 -1
  229. data/lib/rubocop/cop/style/yoda_condition.rb +18 -1
  230. data/lib/rubocop/cop/style/zero_length_predicate.rb +2 -2
  231. data/lib/rubocop/cop/team.rb +141 -81
  232. data/lib/rubocop/cop/util.rb +3 -3
  233. data/lib/rubocop/cop/utils/format_string.rb +19 -2
  234. data/lib/rubocop/cop/variable_force.rb +3 -9
  235. data/lib/rubocop/cop/variable_force/branch.rb +1 -3
  236. data/lib/rubocop/cop/variable_force/variable.rb +2 -6
  237. data/lib/rubocop/ext/processed_source.rb +18 -0
  238. data/lib/rubocop/formatter/base_formatter.rb +0 -4
  239. data/lib/rubocop/formatter/disabled_config_formatter.rb +5 -13
  240. data/lib/rubocop/formatter/formatter_set.rb +2 -4
  241. data/lib/rubocop/formatter/junit_formatter.rb +14 -4
  242. data/lib/rubocop/magic_comment.rb +1 -1
  243. data/lib/rubocop/name_similarity.rb +7 -3
  244. data/lib/rubocop/options.rb +30 -15
  245. data/lib/rubocop/path_util.rb +2 -2
  246. data/lib/rubocop/platform.rb +1 -1
  247. data/lib/rubocop/rake_task.rb +6 -9
  248. data/lib/rubocop/remote_config.rb +1 -3
  249. data/lib/rubocop/result_cache.rb +5 -7
  250. data/lib/rubocop/rspec/cop_helper.rb +5 -28
  251. data/lib/rubocop/rspec/expect_offense.rb +60 -23
  252. data/lib/rubocop/rspec/shared_contexts.rb +55 -17
  253. data/lib/rubocop/runner.rb +42 -38
  254. data/lib/rubocop/target_finder.rb +2 -4
  255. data/lib/rubocop/target_ruby.rb +5 -2
  256. data/lib/rubocop/version.rb +5 -3
  257. metadata +60 -62
  258. data/lib/rubocop/ast/builder.rb +0 -85
  259. data/lib/rubocop/ast/node.rb +0 -637
  260. data/lib/rubocop/ast/node/alias_node.rb +0 -24
  261. data/lib/rubocop/ast/node/and_node.rb +0 -29
  262. data/lib/rubocop/ast/node/args_node.rb +0 -29
  263. data/lib/rubocop/ast/node/array_node.rb +0 -70
  264. data/lib/rubocop/ast/node/block_node.rb +0 -121
  265. data/lib/rubocop/ast/node/break_node.rb +0 -17
  266. data/lib/rubocop/ast/node/case_match_node.rb +0 -56
  267. data/lib/rubocop/ast/node/case_node.rb +0 -56
  268. data/lib/rubocop/ast/node/class_node.rb +0 -31
  269. data/lib/rubocop/ast/node/def_node.rb +0 -82
  270. data/lib/rubocop/ast/node/defined_node.rb +0 -17
  271. data/lib/rubocop/ast/node/ensure_node.rb +0 -17
  272. data/lib/rubocop/ast/node/float_node.rb +0 -12
  273. data/lib/rubocop/ast/node/for_node.rb +0 -53
  274. data/lib/rubocop/ast/node/forward_args_node.rb +0 -18
  275. data/lib/rubocop/ast/node/hash_node.rb +0 -109
  276. data/lib/rubocop/ast/node/if_node.rb +0 -175
  277. data/lib/rubocop/ast/node/int_node.rb +0 -12
  278. data/lib/rubocop/ast/node/keyword_splat_node.rb +0 -45
  279. data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +0 -16
  280. data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +0 -43
  281. data/lib/rubocop/ast/node/mixin/collection_node.rb +0 -15
  282. data/lib/rubocop/ast/node/mixin/conditional_node.rb +0 -45
  283. data/lib/rubocop/ast/node/mixin/hash_element_node.rb +0 -125
  284. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +0 -269
  285. data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +0 -114
  286. data/lib/rubocop/ast/node/mixin/modifier_node.rb +0 -17
  287. data/lib/rubocop/ast/node/mixin/numeric_node.rb +0 -21
  288. data/lib/rubocop/ast/node/mixin/parameterized_node.rb +0 -61
  289. data/lib/rubocop/ast/node/mixin/predicate_operator_node.rb +0 -35
  290. data/lib/rubocop/ast/node/module_node.rb +0 -24
  291. data/lib/rubocop/ast/node/or_node.rb +0 -29
  292. data/lib/rubocop/ast/node/pair_node.rb +0 -63
  293. data/lib/rubocop/ast/node/range_node.rb +0 -18
  294. data/lib/rubocop/ast/node/regexp_node.rb +0 -33
  295. data/lib/rubocop/ast/node/resbody_node.rb +0 -24
  296. data/lib/rubocop/ast/node/retry_node.rb +0 -17
  297. data/lib/rubocop/ast/node/return_node.rb +0 -24
  298. data/lib/rubocop/ast/node/self_class_node.rb +0 -24
  299. data/lib/rubocop/ast/node/send_node.rb +0 -17
  300. data/lib/rubocop/ast/node/str_node.rb +0 -16
  301. data/lib/rubocop/ast/node/super_node.rb +0 -21
  302. data/lib/rubocop/ast/node/symbol_node.rb +0 -12
  303. data/lib/rubocop/ast/node/until_node.rb +0 -35
  304. data/lib/rubocop/ast/node/when_node.rb +0 -53
  305. data/lib/rubocop/ast/node/while_node.rb +0 -35
  306. data/lib/rubocop/ast/node/yield_node.rb +0 -21
  307. data/lib/rubocop/ast/sexp.rb +0 -16
  308. data/lib/rubocop/ast/traversal.rb +0 -202
  309. data/lib/rubocop/cop/mixin/classish_length.rb +0 -37
  310. data/lib/rubocop/node_pattern.rb +0 -887
  311. data/lib/rubocop/processed_source.rb +0 -213
  312. data/lib/rubocop/token.rb +0 -114
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02ede8c9af1fb47b66ac79a0d93d577a5384f82f5076e1e64631ca761c4d3f6b
4
- data.tar.gz: 2f22e7716a7068013b131636217a77189f2ca506e53c8613c407c18f8028600e
3
+ metadata.gz: b4ab19d9feaaa55fc107e42860eb4fe6a6f0106350edcfee8095b689845106d1
4
+ data.tar.gz: b096ab80d7f1c3e1e3ea5b4e32f74f0ce23dc5bf34c06b2fb80893c53cd058dc
5
5
  SHA512:
6
- metadata.gz: 936fdee12ea43542b66ab1cccc0514f1a7076dbd671386cccf376e61633b12e51c88feba3e652e77c925a2f5df4e0646bf568af453032bd2cb6eafdd9ea66d48
7
- data.tar.gz: 23ec3628be52fd219206cd866c7e46757cdae9c8bd5c29334a7471c856f19becb03af7da2dd6f12a12c1f876f4eb900d10f9c8fdd7ad669c1bf2dea4cb333145
6
+ metadata.gz: d9db7c5ac245ecc290c75144ca7baf37d3f8a39911238f4d8d2866ce019c91b0c0dc2a9cc296c71e2f49d972d16773de3c077734ecef7e5b01f7d693de51a001
7
+ data.tar.gz: b9a3b18f4a95be71f2518ef6a2a4946f05079f0239a41c11230e7f60ba509b9d511c160edb0fe288663d41432d1e82aba6b721f6c27604a23a64b0bac674216f
data/README.md CHANGED
@@ -1,9 +1,14 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/rubocop-hq/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
3
+ </p>
4
+
5
+ ----------
6
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
1
7
  [![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
2
8
  [![CircleCI Status](https://circleci.com/gh/rubocop-hq/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop/tree/master)
3
9
  [![Actions Status](https://github.com/rubocop-hq/rubocop/workflows/CI/badge.svg?branch=master)](https://github.com/rubocop-hq/rubocop/actions?query=workflow%3ACI)
4
- [![Coverage Status](https://api.codeclimate.com/v1/badges/ad6e76460499c8c99697/test_coverage)](https://codeclimate.com/github/bbatsov/rubocop)
5
- [![Code Climate](https://codeclimate.com/github/bbatsov/rubocop/badges/gpa.svg)](https://codeclimate.com/github/bbatsov/rubocop)
6
- [![Inline docs](https://inch-ci.org/github/bbatsov/rubocop.svg)](https://inch-ci.org/github/bbatsov/rubocop)
10
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/test_coverage)](https://codeclimate.com/github/rubocop-hq/rubocop/test_coverage)
11
+ [![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop-hq/rubocop/maintainability)
7
12
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
8
13
 
9
14
  [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
@@ -11,26 +16,17 @@
11
16
  [![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
12
17
  [![Tidelift](https://tidelift.com/badges/package/rubygems/rubocop)](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
13
18
 
14
- <p align="center">
15
- <img src="https://raw.githubusercontent.com/rubocop-hq/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
16
- </p>
17
-
18
19
  > Role models are important. <br/>
19
20
  > -- Officer Alex J. Murphy / RoboCop
20
21
 
21
- **RuboCop** is a Ruby static code analyzer and code formatter. Out of
22
- the box it will enforce many of the guidelines outlined in the
23
- community [Ruby Style
24
- Guide](https://rubystyle.guide).
22
+ **RuboCop** is a Ruby static code analyzer (a.k.a. `linter`) and code formatter. Out of the box it
23
+ will enforce many of the guidelines outlined in the community [Ruby Style
24
+ Guide](https://rubystyle.guide). Apart from reporting the problems discovered in your code,
25
+ RuboCop can also automatically fix many of them you.
25
26
 
26
27
  RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
27
28
  [configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
28
29
 
29
- Apart from reporting problems in your code, RuboCop can also
30
- automatically fix some of the problems for you.
31
-
32
- [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bbatsov/rubocop?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
33
-
34
30
  **Please consider [financially supporting its ongoing development](#funding).**
35
31
 
36
32
  ## Installation
@@ -53,7 +49,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
53
49
  might want to use a conservative version lock in your `Gemfile`:
54
50
 
55
51
  ```rb
56
- gem 'rubocop', '~> 0.83.0', require: false
52
+ gem 'rubocop', '~> 0.87.0', require: false
57
53
  ```
58
54
 
59
55
  ## Quickstart
@@ -76,6 +72,16 @@ RuboCop supports the following Ruby implementations:
76
72
  * MRI 2.4+
77
73
  * JRuby 9.2+
78
74
 
75
+ See [compatibility](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
76
+
77
+ ## Readme Badge
78
+
79
+ If you use RuboCop in your project, you can include one of these badges in your readme to let people know that your code is written following the community Ruby Style Guide.
80
+
81
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
82
+
83
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
84
+
79
85
  ## Team
80
86
 
81
87
  Here's a list of RuboCop's core developers:
@@ -88,6 +94,8 @@ Here's a list of RuboCop's core developers:
88
94
  * [Masataka Kuwabara](https://github.com/pocke)
89
95
  * [Koichi Ito](https://github.com/koic)
90
96
  * [Maxim Krizhanovski](https://github.com/darhazer)
97
+ * [Benjamin Quorning](https://github.com/bquorning)
98
+ * [Marc-André Lafortune](https://github.com/marcandre)
91
99
 
92
100
  ## Logo
93
101
 
@@ -132,7 +140,7 @@ If you're working in a company that's making significant use of RuboCop we'd app
132
140
  to become a RuboCop sponsor.
133
141
 
134
142
  You can support the development of RuboCop via
135
- [Salt](https://salt.bountysource.com/teams/rubocop),
143
+ [GitHub Sponsors](https://github.com/sponsors/bbatsov),
136
144
  [Patreon](https://www.patreon.com/bbatsov),
137
145
  [PayPal](https://paypal.me/bbatsov)
138
146
  and [Open Collective](https://opencollective.com/rubocop).
@@ -153,12 +153,13 @@ Bundler/GemComment:
153
153
  Description: 'Add a comment describing each gem.'
154
154
  Enabled: false
155
155
  VersionAdded: '0.59'
156
- VersionChanged: '0.77'
156
+ VersionChanged: '0.85'
157
157
  Include:
158
158
  - '**/*.gemfile'
159
159
  - '**/Gemfile'
160
160
  - '**/gems.rb'
161
161
  IgnoredGems: []
162
+ OnlyFor: []
162
163
 
163
164
  Bundler/InsecureProtocolSource:
164
165
  Description: >-
@@ -179,6 +180,9 @@ Bundler/OrderedGems:
179
180
  VersionAdded: '0.46'
180
181
  VersionChanged: '0.47'
181
182
  TreatCommentsAsGroupSeparators: true
183
+ # By default, "-" and "_" are ignored for order purposes.
184
+ # This can be overridden by setting this parameter to true.
185
+ ConsiderPunctuation: false
182
186
  Include:
183
187
  - '**/*.gemfile'
184
188
  - '**/Gemfile'
@@ -199,6 +203,9 @@ Gemspec/OrderedDependencies:
199
203
  Enabled: true
200
204
  VersionAdded: '0.51'
201
205
  TreatCommentsAsGroupSeparators: true
206
+ # By default, "-" and "_" are ignored for order purposes.
207
+ # This can be overridden by setting this parameter to true.
208
+ ConsiderPunctuation: false
202
209
  Include:
203
210
  - '**/*.gemspec'
204
211
 
@@ -468,6 +475,13 @@ Layout/EmptyLinesAroundAttributeAccessor:
468
475
  StyleGuide: '#empty-lines-around-attribute-accessor'
469
476
  Enabled: pending
470
477
  VersionAdded: '0.83'
478
+ VersionChanged: '0.84'
479
+ AllowAliasSyntax: true
480
+ AllowedMethods:
481
+ - alias_method
482
+ - public
483
+ - protected
484
+ - private
471
485
 
472
486
  Layout/EmptyLinesAroundBeginBody:
473
487
  Description: "Keeps track of empty lines around begin-end bodies."
@@ -783,13 +797,7 @@ Layout/HeredocIndentation:
783
797
  StyleGuide: '#squiggly-heredocs'
784
798
  Enabled: true
785
799
  VersionAdded: '0.49'
786
- VersionChanged: '0.77'
787
- EnforcedStyle: squiggly
788
- SupportedStyles:
789
- - squiggly
790
- - active_support
791
- - powerpack
792
- - unindent
800
+ VersionChanged: '0.85'
793
801
 
794
802
  Layout/IndentationConsistency:
795
803
  Description: 'Keep indentation straight.'
@@ -857,13 +865,13 @@ Layout/LeadingEmptyLines:
857
865
  VersionChanged: '0.77'
858
866
 
859
867
  Layout/LineLength:
860
- Description: 'Limit lines to 80 characters.'
861
- StyleGuide: '#80-character-limits'
868
+ Description: 'Checks that line length does not exceed the configured limit.'
869
+ StyleGuide: '#max-line-length'
862
870
  Enabled: true
863
871
  VersionAdded: '0.25'
864
- VersionChanged: '0.78'
872
+ VersionChanged: '0.84'
865
873
  AutoCorrect: false
866
- Max: 80
874
+ Max: 120
867
875
  # To make it possible to copy or click on URIs in the code, we allow lines
868
876
  # containing a URI to be longer than Max.
869
877
  AllowHeredoc: true
@@ -1359,6 +1367,15 @@ Lint/CircularArgumentReference:
1359
1367
  Enabled: true
1360
1368
  VersionAdded: '0.33'
1361
1369
 
1370
+ Lint/ConstantResolution:
1371
+ Description: 'Check that constants are fully qualified with `::`.'
1372
+ Enabled: false
1373
+ VersionAdded: '0.86'
1374
+ # Restrict this cop to only looking at certain names
1375
+ Only: []
1376
+ # Restrict this cop from only looking at certain names
1377
+ Ignore: []
1378
+
1362
1379
  Lint/Debugger:
1363
1380
  Description: 'Check for debugger calls.'
1364
1381
  Enabled: true
@@ -1370,6 +1387,11 @@ Lint/DeprecatedClassMethods:
1370
1387
  Enabled: true
1371
1388
  VersionAdded: '0.19'
1372
1389
 
1390
+ Lint/DeprecatedOpenSSLConstant:
1391
+ Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1392
+ Enabled: pending
1393
+ VersionAdded: '0.84'
1394
+
1373
1395
  Lint/DisjunctiveAssignmentInConstructor:
1374
1396
  Description: 'In constructor, plain assignment is preferred over disjunctive.'
1375
1397
  Enabled: true
@@ -1492,7 +1514,9 @@ Lint/InheritException:
1492
1514
  Lint/InterpolationCheck:
1493
1515
  Description: 'Raise warning for interpolation in single q strs.'
1494
1516
  Enabled: true
1517
+ SafeAutoCorrect: false
1495
1518
  VersionAdded: '0.50'
1519
+ VersionChanged: '0.87'
1496
1520
 
1497
1521
  Lint/LiteralAsCondition:
1498
1522
  Description: 'Checks of literals used in conditions.'
@@ -1526,6 +1550,11 @@ Lint/MissingCopEnableDirective:
1526
1550
  # .inf for any size
1527
1551
  MaximumRangeSize: .inf
1528
1552
 
1553
+ Lint/MixedRegexpCaptureTypes:
1554
+ Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1555
+ Enabled: pending
1556
+ VersionAdded: '0.85'
1557
+
1529
1558
  Lint/MultipleComparison:
1530
1559
  Description: "Use `&&` operator to compare multiple values."
1531
1560
  Enabled: true
@@ -1599,7 +1628,9 @@ Lint/RaiseException:
1599
1628
  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1600
1629
  StyleGuide: '#raise-exception'
1601
1630
  Enabled: pending
1631
+ Safe: false
1602
1632
  VersionAdded: '0.81'
1633
+ VersionChanged: '0.86'
1603
1634
  AllowedImplicitNamespaces:
1604
1635
  - 'Gem'
1605
1636
 
@@ -1656,6 +1687,7 @@ Lint/RegexpAsCondition:
1656
1687
  The regexp literal matches `$_` implicitly.
1657
1688
  Enabled: true
1658
1689
  VersionAdded: '0.51'
1690
+ VersionChanged: '0.86'
1659
1691
 
1660
1692
  Lint/RequireParentheses:
1661
1693
  Description: >-
@@ -1712,6 +1744,7 @@ Lint/SafeNavigationWithEmpty:
1712
1744
  Description: 'Avoid `foo&.empty?` in conditionals.'
1713
1745
  Enabled: true
1714
1746
  VersionAdded: '0.62'
1747
+ VersionChanged: '0.87'
1715
1748
 
1716
1749
  Lint/ScriptPermission:
1717
1750
  Description: 'Grant script file execute permission.'
@@ -1878,9 +1911,10 @@ Metrics/BlockLength:
1878
1911
  Description: 'Avoid long blocks with many lines.'
1879
1912
  Enabled: true
1880
1913
  VersionAdded: '0.44'
1881
- VersionChanged: '0.66'
1914
+ VersionChanged: '0.87'
1882
1915
  CountComments: false # count full line comments?
1883
1916
  Max: 25
1917
+ CountAsOne: []
1884
1918
  ExcludedMethods:
1885
1919
  # By default, exclude the `#refine` method, as it tends to have larger
1886
1920
  # associated blocks.
@@ -1901,8 +1935,10 @@ Metrics/ClassLength:
1901
1935
  Description: 'Avoid classes longer than 100 lines of code.'
1902
1936
  Enabled: true
1903
1937
  VersionAdded: '0.25'
1938
+ VersionChanged: '0.87'
1904
1939
  CountComments: false # count full line comments?
1905
1940
  Max: 100
1941
+ CountAsOne: []
1906
1942
 
1907
1943
  # Avoid complex methods.
1908
1944
  Metrics/CyclomaticComplexity:
@@ -1913,24 +1949,27 @@ Metrics/CyclomaticComplexity:
1913
1949
  VersionAdded: '0.25'
1914
1950
  VersionChanged: '0.81'
1915
1951
  IgnoredMethods: []
1916
- Max: 6
1952
+ Max: 7
1917
1953
 
1918
1954
  Metrics/MethodLength:
1919
1955
  Description: 'Avoid methods longer than 10 lines of code.'
1920
1956
  StyleGuide: '#short-methods'
1921
1957
  Enabled: true
1922
1958
  VersionAdded: '0.25'
1923
- VersionChanged: '0.59.2'
1959
+ VersionChanged: '0.87'
1924
1960
  CountComments: false # count full line comments?
1925
1961
  Max: 10
1962
+ CountAsOne: []
1926
1963
  ExcludedMethods: []
1927
1964
 
1928
1965
  Metrics/ModuleLength:
1929
1966
  Description: 'Avoid modules longer than 100 lines of code.'
1930
1967
  Enabled: true
1931
1968
  VersionAdded: '0.31'
1969
+ VersionChanged: '0.87'
1932
1970
  CountComments: false # count full line comments?
1933
1971
  Max: 100
1972
+ CountAsOne: []
1934
1973
 
1935
1974
  Metrics/ParameterLists:
1936
1975
  Description: 'Avoid parameter lists longer than three or four parameters.'
@@ -1968,10 +2007,12 @@ Naming/AccessorMethodName:
1968
2007
  VersionAdded: '0.50'
1969
2008
 
1970
2009
  Naming/AsciiIdentifiers:
1971
- Description: 'Use only ascii symbols in identifiers.'
2010
+ Description: 'Use only ascii symbols in identifiers and constants.'
1972
2011
  StyleGuide: '#english-identifiers'
1973
2012
  Enabled: true
1974
2013
  VersionAdded: '0.50'
2014
+ VersionChanged: '0.87'
2015
+ AsciiConstants: true
1975
2016
 
1976
2017
  Naming/BinaryOperatorParameterName:
1977
2018
  Description: 'When defining binary operators, name the argument other.'
@@ -1999,6 +2040,11 @@ Naming/ClassAndModuleCamelCase:
1999
2040
  StyleGuide: '#camelcase-classes'
2000
2041
  Enabled: true
2001
2042
  VersionAdded: '0.50'
2043
+ VersionChanged: '0.85'
2044
+ # Allowed class/module names can be specified here.
2045
+ # These can be full or part of the name.
2046
+ AllowedNames:
2047
+ - module_parent
2002
2048
 
2003
2049
  Naming/ConstantName:
2004
2050
  Description: 'Constants should use SCREAMING_SNAKE_CASE.'
@@ -2019,6 +2065,10 @@ Naming/FileName:
2019
2065
  # It further expects it to be nested inside modules which match the names
2020
2066
  # of subdirectories in its path.
2021
2067
  ExpectMatchingDefinition: false
2068
+ # When `false`, changes the behavior of ExpectMatchingDefinition to match only
2069
+ # whether each source file's class or module name matches the file name --
2070
+ # not whether the nested module hierarchy matches the subdirectory path.
2071
+ CheckDefinitionPathHierarchy: true
2022
2072
  # If non-`nil`, expect all source file names to match the following regex.
2023
2073
  # Only the file name itself is matched, not the entire file path.
2024
2074
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2210,7 +2260,7 @@ Security/JSONLoad:
2210
2260
  Description: >-
2211
2261
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
2212
2262
  security issues. See reference for more information.
2213
- Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2263
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2214
2264
  Enabled: true
2215
2265
  VersionAdded: '0.43'
2216
2266
  VersionChanged: '0.44'
@@ -2223,7 +2273,7 @@ Security/MarshalLoad:
2223
2273
  Description: >-
2224
2274
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2225
2275
  security issues. See reference for more information.
2226
- Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2276
+ Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
2227
2277
  Enabled: true
2228
2278
  VersionAdded: '0.47'
2229
2279
 
@@ -2237,7 +2287,7 @@ Security/YAMLLoad:
2237
2287
  Description: >-
2238
2288
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2239
2289
  security issues. See reference for more information.
2240
- Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2290
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2241
2291
  Enabled: true
2242
2292
  VersionAdded: '0.47'
2243
2293
  SafeAutoCorrect: false
@@ -2255,6 +2305,17 @@ Style/AccessModifierDeclarations:
2255
2305
  - group
2256
2306
  AllowModifiersOnSymbols: true
2257
2307
 
2308
+ Style/AccessorGrouping:
2309
+ Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2310
+ Enabled: 'pending'
2311
+ VersionAdded: '0.87'
2312
+ EnforcedStyle: grouped
2313
+ SupportedStyles:
2314
+ # separated: each accessor goes in a separate statement.
2315
+ # grouped: accessors are grouped into a single statement.
2316
+ - separated
2317
+ - grouped
2318
+
2258
2319
  Style/Alias:
2259
2320
  Description: 'Use alias instead of alias_method.'
2260
2321
  StyleGuide: '#alias-method-lexically'
@@ -2274,7 +2335,7 @@ Style/AndOr:
2274
2335
  VersionChanged: '0.25'
2275
2336
  # Whether `and` and `or` are banned only in conditionals (conditionals)
2276
2337
  # or completely (always).
2277
- EnforcedStyle: always
2338
+ EnforcedStyle: conditionals
2278
2339
  SupportedStyles:
2279
2340
  - always
2280
2341
  - conditionals
@@ -2322,6 +2383,13 @@ Style/BeginBlock:
2322
2383
  Enabled: true
2323
2384
  VersionAdded: '0.9'
2324
2385
 
2386
+ Style/BisectedAttrAccessor:
2387
+ Description: >-
2388
+ Checks for places where `attr_reader` and `attr_writer`
2389
+ for the same method can be combined into single `attr_accessor`.
2390
+ Enabled: 'pending'
2391
+ VersionAdded: '0.87'
2392
+
2325
2393
  Style/BlockComments:
2326
2394
  Description: 'Do not use block comments.'
2327
2395
  StyleGuide: '#no-block-comments'
@@ -2694,6 +2762,12 @@ Style/DoubleNegation:
2694
2762
  StyleGuide: '#no-bang-bang'
2695
2763
  Enabled: true
2696
2764
  VersionAdded: '0.19'
2765
+ VersionChanged: '0.84'
2766
+ EnforcedStyle: allowed_in_returns
2767
+ SafeAutoCorrect: false
2768
+ SupportedStyles:
2769
+ - allowed_in_returns
2770
+ - forbidden
2697
2771
 
2698
2772
  Style/EachForSimpleLoop:
2699
2773
  Description: >-
@@ -2857,8 +2931,7 @@ Style/FrozenStringLiteralComment:
2857
2931
  SupportedStyles:
2858
2932
  # `always` will always add the frozen string literal comment to a file
2859
2933
  # regardless of the Ruby version or if `freeze` or `<<` are called on a
2860
- # string literal. If you run code against multiple versions of Ruby, it is
2861
- # possible that this will create errors in Ruby 2.3.0+.
2934
+ # string literal. It is possible that this will create errors.
2862
2935
  - always
2863
2936
  # `always_true` will add the frozen string literal comment to a file,
2864
2937
  # similarly to the `always` style, but will also change any disabled
@@ -2958,6 +3031,7 @@ Style/IfUnlessModifierOfIfUnless:
2958
3031
  Avoid modifier if/unless usage on conditionals.
2959
3032
  Enabled: true
2960
3033
  VersionAdded: '0.39'
3034
+ VersionChanged: '0.87'
2961
3035
 
2962
3036
  Style/IfWithSemicolon:
2963
3037
  Description: 'Do not use if x; .... Use the ternary operator instead.'
@@ -3214,6 +3288,7 @@ Style/MultilineTernaryOperator:
3214
3288
  StyleGuide: '#no-multiline-ternary'
3215
3289
  Enabled: true
3216
3290
  VersionAdded: '0.9'
3291
+ VersionChanged: '0.86'
3217
3292
 
3218
3293
  Style/MultilineWhenThen:
3219
3294
  Description: 'Do not use then for multi-line when statement.'
@@ -3318,6 +3393,7 @@ Style/NestedTernaryOperator:
3318
3393
  StyleGuide: '#no-nested-ternary'
3319
3394
  Enabled: true
3320
3395
  VersionAdded: '0.9'
3396
+ VersionChanged: '0.86'
3321
3397
 
3322
3398
  Style/Next:
3323
3399
  Description: 'Use `next` to skip iteration instead of a condition at the end.'
@@ -3542,6 +3618,11 @@ Style/RandomWithOffset:
3542
3618
  Enabled: true
3543
3619
  VersionAdded: '0.52'
3544
3620
 
3621
+ Style/RedundantAssignment:
3622
+ Description: 'Checks for redundant assignment before returning.'
3623
+ Enabled: 'pending'
3624
+ VersionAdded: '0.87'
3625
+
3545
3626
  Style/RedundantBegin:
3546
3627
  Description: "Don't use begin blocks when they are not needed."
3547
3628
  StyleGuide: '#begin-implicit'
@@ -3571,6 +3652,19 @@ Style/RedundantException:
3571
3652
  VersionAdded: '0.14'
3572
3653
  VersionChanged: '0.29'
3573
3654
 
3655
+ Style/RedundantFetchBlock:
3656
+ Description: >-
3657
+ Use `fetch(key, value)` instead of `fetch(key) { value }`
3658
+ when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
3659
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
3660
+ Enabled: 'pending'
3661
+ Safe: false
3662
+ # If enabled, this cop will autocorrect usages of
3663
+ # `fetch` being called with block returning a constant.
3664
+ # This can be dangerous since constants will not be defined at that moment.
3665
+ SafeForConstants: false
3666
+ VersionAdded: '0.86'
3667
+
3574
3668
  Style/RedundantFreeze:
3575
3669
  Description: "Checks usages of Object#freeze on immutable objects."
3576
3670
  Enabled: true
@@ -3593,6 +3687,16 @@ Style/RedundantPercentQ:
3593
3687
  Enabled: true
3594
3688
  VersionAdded: '0.76'
3595
3689
 
3690
+ Style/RedundantRegexpCharacterClass:
3691
+ Description: 'Checks for unnecessary single-element Regexp character classes.'
3692
+ Enabled: pending
3693
+ VersionAdded: '0.85'
3694
+
3695
+ Style/RedundantRegexpEscape:
3696
+ Description: 'Checks for redundant escapes in Regexps.'
3697
+ Enabled: pending
3698
+ VersionAdded: '0.85'
3699
+
3596
3700
  Style/RedundantReturn:
3597
3701
  Description: "Don't use return where it's not required."
3598
3702
  StyleGuide: '#no-explicit-return'
@@ -3840,6 +3944,7 @@ Style/StructInheritance:
3840
3944
  StyleGuide: '#no-extend-struct-new'
3841
3945
  Enabled: true
3842
3946
  VersionAdded: '0.29'
3947
+ VersionChanged: '0.86'
3843
3948
 
3844
3949
  Style/SymbolArray:
3845
3950
  Description: 'Use %i or %I for arrays of symbols.'
@@ -3861,7 +3966,7 @@ Style/SymbolLiteral:
3861
3966
  Style/SymbolProc:
3862
3967
  Description: 'Use symbols as procs instead of blocks when possible.'
3863
3968
  Enabled: true
3864
- SafeAutoCorrect: false
3969
+ Safe: false
3865
3970
  VersionAdded: '0.26'
3866
3971
  VersionChanged: '0.64'
3867
3972
  # A list of method names to be ignored by the check.