rubocop 0.80.1 → 0.85.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (324) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/config/default.yml +202 -49
  4. data/lib/rubocop.rb +20 -61
  5. data/lib/rubocop/ast_aliases.rb +8 -0
  6. data/lib/rubocop/cli.rb +13 -7
  7. data/lib/rubocop/cli/command/auto_genenerate_config.rb +2 -2
  8. data/lib/rubocop/cli/command/show_cops.rb +2 -6
  9. data/lib/rubocop/comment_config.rb +1 -1
  10. data/lib/rubocop/config.rb +14 -2
  11. data/lib/rubocop/config_loader.rb +37 -33
  12. data/lib/rubocop/config_loader_resolver.rb +45 -6
  13. data/lib/rubocop/config_obsoletion.rb +2 -0
  14. data/lib/rubocop/config_store.rb +12 -2
  15. data/lib/rubocop/config_validator.rb +18 -1
  16. data/lib/rubocop/cop/autocorrect_logic.rb +1 -2
  17. data/lib/rubocop/cop/badge.rb +5 -5
  18. data/lib/rubocop/cop/bundler/gem_comment.rb +70 -1
  19. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +1 -1
  20. data/lib/rubocop/cop/commissioner.rb +0 -21
  21. data/lib/rubocop/cop/cop.rb +14 -6
  22. data/lib/rubocop/cop/corrector.rb +48 -24
  23. data/lib/rubocop/cop/correctors/alignment_corrector.rb +4 -8
  24. data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -2
  25. data/lib/rubocop/cop/correctors/empty_line_corrector.rb +1 -1
  26. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +4 -4
  27. data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -2
  28. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
  29. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -3
  30. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +2 -2
  31. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -3
  32. data/lib/rubocop/cop/generator.rb +4 -3
  33. data/lib/rubocop/cop/ignored_node.rb +1 -3
  34. data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +1 -1
  35. data/lib/rubocop/cop/layout/array_alignment.rb +53 -10
  36. data/lib/rubocop/cop/layout/block_end_newline.rb +5 -3
  37. data/lib/rubocop/cop/layout/case_indentation.rb +3 -3
  38. data/lib/rubocop/cop/layout/class_structure.rb +19 -16
  39. data/lib/rubocop/cop/layout/condition_position.rb +12 -2
  40. data/lib/rubocop/cop/layout/dot_position.rb +1 -1
  41. data/lib/rubocop/cop/layout/else_alignment.rb +8 -0
  42. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +2 -6
  43. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +126 -0
  44. data/lib/rubocop/cop/layout/end_of_line.rb +2 -2
  45. data/lib/rubocop/cop/layout/first_argument_indentation.rb +1 -3
  46. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +14 -10
  47. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
  48. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +1 -1
  49. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -3
  50. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
  51. data/lib/rubocop/cop/layout/hash_alignment.rb +6 -6
  52. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +5 -9
  53. data/lib/rubocop/cop/layout/heredoc_indentation.rb +20 -103
  54. data/lib/rubocop/cop/layout/{tab.rb → indentation_style.rb} +48 -6
  55. data/lib/rubocop/cop/layout/indentation_width.rb +1 -3
  56. data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
  57. data/lib/rubocop/cop/layout/line_length.rb +23 -20
  58. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
  59. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -3
  60. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +1 -1
  61. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +13 -4
  62. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +3 -3
  63. data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
  64. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +131 -0
  65. data/lib/rubocop/cop/layout/space_around_operators.rb +19 -2
  66. data/lib/rubocop/cop/layout/space_before_comment.rb +1 -3
  67. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +1 -1
  68. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +1 -3
  69. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +2 -2
  70. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +2 -2
  71. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +1 -3
  72. data/lib/rubocop/cop/layout/trailing_whitespace.rb +2 -2
  73. data/lib/rubocop/cop/lint/ambiguous_operator.rb +41 -0
  74. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +14 -0
  75. data/lib/rubocop/cop/lint/boolean_symbol.rb +12 -0
  76. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  77. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +137 -0
  78. data/lib/rubocop/cop/lint/duplicate_methods.rb +1 -5
  79. data/lib/rubocop/cop/lint/empty_when.rb +29 -6
  80. data/lib/rubocop/cop/lint/ensure_return.rb +19 -2
  81. data/lib/rubocop/cop/lint/erb_new_arguments.rb +2 -4
  82. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
  83. data/lib/rubocop/cop/lint/inherit_exception.rb +1 -1
  84. data/lib/rubocop/cop/lint/interpolation_check.rb +1 -1
  85. data/lib/rubocop/cop/lint/literal_as_condition.rb +10 -13
  86. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +1 -1
  87. data/lib/rubocop/cop/lint/loop.rb +7 -5
  88. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +62 -0
  89. data/lib/rubocop/cop/lint/multiple_comparison.rb +1 -1
  90. data/lib/rubocop/cop/lint/nested_method_definition.rb +2 -2
  91. data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
  92. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +2 -2
  93. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +7 -7
  94. data/lib/rubocop/cop/lint/number_conversion.rb +1 -1
  95. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +33 -11
  96. data/lib/rubocop/cop/lint/percent_string_array.rb +2 -4
  97. data/lib/rubocop/cop/lint/raise_exception.rb +75 -0
  98. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +1 -6
  99. data/lib/rubocop/cop/lint/redundant_require_statement.rb +3 -3
  100. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -1
  101. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  102. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +1 -1
  103. data/lib/rubocop/cop/lint/struct_new_override.rb +58 -0
  104. data/lib/rubocop/cop/lint/suppressed_exception.rb +23 -26
  105. data/lib/rubocop/cop/lint/syntax.rb +1 -3
  106. data/lib/rubocop/cop/lint/unified_integer.rb +0 -2
  107. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  108. data/lib/rubocop/cop/lint/unused_method_argument.rb +32 -6
  109. data/lib/rubocop/cop/lint/uri_regexp.rb +4 -4
  110. data/lib/rubocop/cop/lint/useless_access_modifier.rb +13 -3
  111. data/lib/rubocop/cop/lint/useless_assignment.rb +3 -2
  112. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +6 -1
  113. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
  114. data/lib/rubocop/cop/migration/department_name.rb +22 -9
  115. data/lib/rubocop/cop/mixin/alignment.rb +1 -3
  116. data/lib/rubocop/cop/mixin/array_min_size.rb +1 -3
  117. data/lib/rubocop/cop/mixin/check_line_breakable.rb +3 -9
  118. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +1 -3
  119. data/lib/rubocop/cop/mixin/configurable_formatting.rb +2 -4
  120. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +6 -1
  121. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +10 -1
  122. data/lib/rubocop/cop/mixin/hash_transform_method.rb +9 -2
  123. data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
  124. data/lib/rubocop/cop/mixin/line_length_help.rb +3 -2
  125. data/lib/rubocop/cop/mixin/method_complexity.rb +5 -0
  126. data/lib/rubocop/cop/mixin/parser_diagnostic.rb +1 -1
  127. data/lib/rubocop/cop/mixin/regexp_literal_help.rb +16 -0
  128. data/lib/rubocop/cop/mixin/statement_modifier.rb +7 -22
  129. data/lib/rubocop/cop/mixin/target_ruby_version.rb +5 -1
  130. data/lib/rubocop/cop/mixin/trailing_comma.rb +2 -4
  131. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +1 -1
  132. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +11 -1
  133. data/lib/rubocop/cop/naming/constant_name.rb +2 -1
  134. data/lib/rubocop/cop/naming/file_name.rb +27 -14
  135. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
  136. data/lib/rubocop/cop/naming/method_name.rb +26 -0
  137. data/lib/rubocop/cop/naming/predicate_name.rb +1 -1
  138. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +1 -1
  139. data/lib/rubocop/cop/registry.rb +12 -7
  140. data/lib/rubocop/cop/severity.rb +1 -3
  141. data/lib/rubocop/cop/style/access_modifier_declarations.rb +26 -6
  142. data/lib/rubocop/cop/style/alias.rb +4 -4
  143. data/lib/rubocop/cop/style/and_or.rb +7 -8
  144. data/lib/rubocop/cop/style/array_join.rb +2 -2
  145. data/lib/rubocop/cop/style/attr.rb +1 -3
  146. data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
  147. data/lib/rubocop/cop/style/block_delimiters.rb +2 -8
  148. data/lib/rubocop/cop/style/case_equality.rb +24 -1
  149. data/lib/rubocop/cop/style/character_literal.rb +2 -2
  150. data/lib/rubocop/cop/style/collection_methods.rb +2 -0
  151. data/lib/rubocop/cop/style/conditional_assignment.rb +9 -11
  152. data/lib/rubocop/cop/style/copyright.rb +3 -3
  153. data/lib/rubocop/cop/style/dir.rb +1 -1
  154. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +49 -0
  155. data/lib/rubocop/cop/style/documentation.rb +43 -5
  156. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +1 -1
  157. data/lib/rubocop/cop/style/double_negation.rb +41 -4
  158. data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -1
  159. data/lib/rubocop/cop/style/each_with_object.rb +3 -3
  160. data/lib/rubocop/cop/style/empty_literal.rb +1 -3
  161. data/lib/rubocop/cop/style/empty_method.rb +2 -6
  162. data/lib/rubocop/cop/style/end_block.rb +6 -0
  163. data/lib/rubocop/cop/style/even_odd.rb +1 -1
  164. data/lib/rubocop/cop/style/expand_path_arguments.rb +3 -3
  165. data/lib/rubocop/cop/style/exponential_notation.rb +119 -0
  166. data/lib/rubocop/cop/style/format_string.rb +2 -2
  167. data/lib/rubocop/cop/style/format_string_token.rb +2 -3
  168. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -6
  169. data/lib/rubocop/cop/style/guard_clause.rb +25 -2
  170. data/lib/rubocop/cop/style/hash_each_methods.rb +6 -4
  171. data/lib/rubocop/cop/style/hash_syntax.rb +19 -12
  172. data/lib/rubocop/cop/style/hash_transform_keys.rb +6 -2
  173. data/lib/rubocop/cop/style/hash_transform_values.rb +6 -5
  174. data/lib/rubocop/cop/style/if_unless_modifier.rb +23 -3
  175. data/lib/rubocop/cop/style/if_with_semicolon.rb +16 -0
  176. data/lib/rubocop/cop/style/inline_comment.rb +1 -1
  177. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  178. data/lib/rubocop/cop/style/lambda.rb +3 -2
  179. data/lib/rubocop/cop/style/lambda_call.rb +1 -21
  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/mixin_grouping.rb +1 -1
  183. data/lib/rubocop/cop/style/module_function.rb +58 -12
  184. data/lib/rubocop/cop/style/multiline_if_modifier.rb +1 -1
  185. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  186. data/lib/rubocop/cop/style/multiline_when_then.rb +16 -1
  187. data/lib/rubocop/cop/style/mutable_constant.rb +2 -4
  188. data/lib/rubocop/cop/style/negated_if.rb +3 -3
  189. data/lib/rubocop/cop/style/negated_unless.rb +3 -3
  190. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +2 -2
  191. data/lib/rubocop/cop/style/next.rb +2 -2
  192. data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
  193. data/lib/rubocop/cop/style/non_nil_check.rb +5 -5
  194. data/lib/rubocop/cop/style/not.rb +1 -1
  195. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
  196. data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
  197. data/lib/rubocop/cop/style/numeric_predicate.rb +1 -1
  198. data/lib/rubocop/cop/style/one_line_conditional.rb +6 -9
  199. data/lib/rubocop/cop/style/optional_arguments.rb +1 -1
  200. data/lib/rubocop/cop/style/or_assignment.rb +1 -1
  201. data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
  202. data/lib/rubocop/cop/style/perl_backrefs.rb +2 -2
  203. data/lib/rubocop/cop/style/proc.rb +1 -1
  204. data/lib/rubocop/cop/style/raise_args.rb +1 -1
  205. data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
  206. data/lib/rubocop/cop/style/redundant_condition.rb +3 -4
  207. data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
  208. data/lib/rubocop/cop/style/redundant_exception.rb +3 -3
  209. data/lib/rubocop/cop/style/redundant_interpolation.rb +2 -2
  210. data/lib/rubocop/cop/style/redundant_parentheses.rb +2 -6
  211. data/lib/rubocop/cop/style/redundant_percent_q.rb +3 -3
  212. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +89 -0
  213. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +130 -0
  214. data/lib/rubocop/cop/style/redundant_return.rb +5 -7
  215. data/lib/rubocop/cop/style/redundant_self.rb +1 -1
  216. data/lib/rubocop/cop/style/redundant_sort.rb +2 -2
  217. data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
  218. data/lib/rubocop/cop/style/return_nil.rb +1 -1
  219. data/lib/rubocop/cop/style/safe_navigation.rb +3 -7
  220. data/lib/rubocop/cop/style/self_assignment.rb +1 -1
  221. data/lib/rubocop/cop/style/slicing_with_range.rb +39 -0
  222. data/lib/rubocop/cop/style/special_global_vars.rb +3 -7
  223. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -4
  224. data/lib/rubocop/cop/style/string_hash_keys.rb +1 -1
  225. data/lib/rubocop/cop/style/symbol_array.rb +2 -2
  226. data/lib/rubocop/cop/style/symbol_literal.rb +2 -2
  227. data/lib/rubocop/cop/style/ternary_parentheses.rb +2 -5
  228. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +35 -0
  229. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +41 -0
  230. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +88 -0
  231. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +44 -0
  232. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -3
  233. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  234. data/lib/rubocop/cop/style/unless_else.rb +1 -1
  235. data/lib/rubocop/cop/style/unpack_first.rb +0 -4
  236. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
  237. data/lib/rubocop/cop/style/when_then.rb +1 -1
  238. data/lib/rubocop/cop/style/while_until_modifier.rb +1 -1
  239. data/lib/rubocop/cop/style/word_array.rb +1 -1
  240. data/lib/rubocop/cop/style/zero_length_predicate.rb +1 -1
  241. data/lib/rubocop/cop/team.rb +61 -25
  242. data/lib/rubocop/cop/util.rb +25 -1
  243. data/lib/rubocop/cop/variable_force.rb +3 -9
  244. data/lib/rubocop/cop/variable_force/assignment.rb +1 -0
  245. data/lib/rubocop/cop/variable_force/branch.rb +1 -3
  246. data/lib/rubocop/cop/variable_force/scope.rb +1 -0
  247. data/lib/rubocop/cop/variable_force/variable.rb +3 -6
  248. data/lib/rubocop/ext/processed_source.rb +18 -0
  249. data/lib/rubocop/formatter/base_formatter.rb +0 -4
  250. data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
  251. data/lib/rubocop/formatter/disabled_config_formatter.rb +4 -12
  252. data/lib/rubocop/formatter/formatter_set.rb +1 -4
  253. data/lib/rubocop/formatter/junit_formatter.rb +27 -6
  254. data/lib/rubocop/formatter/pacman_formatter.rb +1 -1
  255. data/lib/rubocop/formatter/tap_formatter.rb +1 -1
  256. data/lib/rubocop/magic_comment.rb +1 -1
  257. data/lib/rubocop/name_similarity.rb +12 -9
  258. data/lib/rubocop/options.rb +33 -12
  259. data/lib/rubocop/remote_config.rb +1 -3
  260. data/lib/rubocop/result_cache.rb +5 -7
  261. data/lib/rubocop/rspec/cop_helper.rb +3 -26
  262. data/lib/rubocop/rspec/expect_offense.rb +46 -16
  263. data/lib/rubocop/rspec/shared_contexts.rb +54 -20
  264. data/lib/rubocop/runner.rb +21 -14
  265. data/lib/rubocop/target_finder.rb +7 -7
  266. data/lib/rubocop/target_ruby.rb +5 -2
  267. data/lib/rubocop/version.rb +5 -3
  268. metadata +50 -77
  269. data/lib/rubocop/ast/builder.rb +0 -83
  270. data/lib/rubocop/ast/node.rb +0 -632
  271. data/lib/rubocop/ast/node/alias_node.rb +0 -24
  272. data/lib/rubocop/ast/node/and_node.rb +0 -29
  273. data/lib/rubocop/ast/node/args_node.rb +0 -29
  274. data/lib/rubocop/ast/node/array_node.rb +0 -57
  275. data/lib/rubocop/ast/node/block_node.rb +0 -117
  276. data/lib/rubocop/ast/node/break_node.rb +0 -17
  277. data/lib/rubocop/ast/node/case_node.rb +0 -56
  278. data/lib/rubocop/ast/node/class_node.rb +0 -31
  279. data/lib/rubocop/ast/node/def_node.rb +0 -82
  280. data/lib/rubocop/ast/node/defined_node.rb +0 -17
  281. data/lib/rubocop/ast/node/ensure_node.rb +0 -17
  282. data/lib/rubocop/ast/node/float_node.rb +0 -12
  283. data/lib/rubocop/ast/node/for_node.rb +0 -53
  284. data/lib/rubocop/ast/node/forward_args_node.rb +0 -18
  285. data/lib/rubocop/ast/node/hash_node.rb +0 -109
  286. data/lib/rubocop/ast/node/if_node.rb +0 -175
  287. data/lib/rubocop/ast/node/int_node.rb +0 -12
  288. data/lib/rubocop/ast/node/keyword_splat_node.rb +0 -45
  289. data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +0 -16
  290. data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +0 -43
  291. data/lib/rubocop/ast/node/mixin/collection_node.rb +0 -15
  292. data/lib/rubocop/ast/node/mixin/conditional_node.rb +0 -45
  293. data/lib/rubocop/ast/node/mixin/hash_element_node.rb +0 -125
  294. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +0 -261
  295. data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +0 -114
  296. data/lib/rubocop/ast/node/mixin/modifier_node.rb +0 -17
  297. data/lib/rubocop/ast/node/mixin/numeric_node.rb +0 -21
  298. data/lib/rubocop/ast/node/mixin/parameterized_node.rb +0 -61
  299. data/lib/rubocop/ast/node/mixin/predicate_operator_node.rb +0 -35
  300. data/lib/rubocop/ast/node/module_node.rb +0 -24
  301. data/lib/rubocop/ast/node/or_node.rb +0 -29
  302. data/lib/rubocop/ast/node/pair_node.rb +0 -63
  303. data/lib/rubocop/ast/node/range_node.rb +0 -18
  304. data/lib/rubocop/ast/node/regexp_node.rb +0 -33
  305. data/lib/rubocop/ast/node/resbody_node.rb +0 -24
  306. data/lib/rubocop/ast/node/retry_node.rb +0 -17
  307. data/lib/rubocop/ast/node/return_node.rb +0 -24
  308. data/lib/rubocop/ast/node/self_class_node.rb +0 -24
  309. data/lib/rubocop/ast/node/send_node.rb +0 -13
  310. data/lib/rubocop/ast/node/str_node.rb +0 -16
  311. data/lib/rubocop/ast/node/super_node.rb +0 -21
  312. data/lib/rubocop/ast/node/symbol_node.rb +0 -12
  313. data/lib/rubocop/ast/node/until_node.rb +0 -35
  314. data/lib/rubocop/ast/node/when_node.rb +0 -53
  315. data/lib/rubocop/ast/node/while_node.rb +0 -35
  316. data/lib/rubocop/ast/node/yield_node.rb +0 -21
  317. data/lib/rubocop/ast/sexp.rb +0 -16
  318. data/lib/rubocop/ast/traversal.rb +0 -200
  319. data/lib/rubocop/cop/lint/end_in_method.rb +0 -40
  320. data/lib/rubocop/formatter/disabled_lines_formatter.rb +0 -57
  321. data/lib/rubocop/node_pattern.rb +0 -887
  322. data/lib/rubocop/processed_source.rb +0 -216
  323. data/lib/rubocop/string_util.rb +0 -14
  324. data/lib/rubocop/token.rb +0 -114
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4837832a6eb4686ba49145b2668aea7b94d85f3b23d24eb49c05ff9b456393b4
4
- data.tar.gz: 1d72140d3461ddf8f64eb1218a78f76603b400e09cb902f1bed6e036650c0d86
3
+ metadata.gz: edfaa1a180e5c318e672651ae7e4c75625a41a4c247d3ce378f6e25e809a4277
4
+ data.tar.gz: 8ce15a32ddd8181b7b5117214d00a795f8824cbd13282120545fc7dd58548137
5
5
  SHA512:
6
- metadata.gz: 4637362ae937c8e659c62d5d4e305342f9580652551356a5178ae3861fa680ac3a7ba27a8eaf0869c73de5c66c16a3ed53d1377aba4d1ad9616dd3e69ce2f761
7
- data.tar.gz: aada4e63308932e7847e94de67565942cbc4b12ae41663a1cb1984228988580e7322612c8c3a73337ae54baa0af9dc0b133f627c44c54a39994f86c0c588b976
6
+ metadata.gz: 57f80040236ae265d1478fecbbe20ebfd27905d52cd2c06d83202d2a8d7fe426feb774d63788fd38942872a12c18c247896e89f21c7010259ab1902cb5034177
7
+ data.tar.gz: b86dcfcaa1839b9f3a7d532d87c1574e712df8018bfb3f85f06e4d2ecc1bb174018458fd2ee5f853def55f2312da8ab8b3037ea3be0defff4c16f4bbbeb6cf5d
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
2
2
  [![CircleCI Status](https://circleci.com/gh/rubocop-hq/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop/tree/master)
3
- [![AppVeyor Status](https://ci.appveyor.com/api/projects/status/sj3ye7n5690d0nvg?svg=true)](https://ci.appveyor.com/project/bbatsov/rubocop)
3
+ [![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
4
  [![Coverage Status](https://api.codeclimate.com/v1/badges/ad6e76460499c8c99697/test_coverage)](https://codeclimate.com/github/bbatsov/rubocop)
5
5
  [![Code Climate](https://codeclimate.com/github/bbatsov/rubocop/badges/gpa.svg)](https://codeclimate.com/github/bbatsov/rubocop)
6
6
  [![Inline docs](https://inch-ci.org/github/bbatsov/rubocop.svg)](https://inch-ci.org/github/bbatsov/rubocop)
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
53
53
  might want to use a conservative version lock in your `Gemfile`:
54
54
 
55
55
  ```rb
56
- gem 'rubocop', '~> 0.80.1', require: false
56
+ gem 'rubocop', '~> 0.85.0', require: false
57
57
  ```
58
58
 
59
59
  ## Quickstart
@@ -73,7 +73,7 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
73
73
 
74
74
  RuboCop supports the following Ruby implementations:
75
75
 
76
- * MRI 2.3+
76
+ * MRI 2.4+
77
77
  * JRuby 9.2+
78
78
 
79
79
  ## Team
@@ -132,7 +132,7 @@ If you're working in a company that's making significant use of RuboCop we'd app
132
132
  to become a RuboCop sponsor.
133
133
 
134
134
  You can support the development of RuboCop via
135
- [Salt](https://salt.bountysource.com/teams/rubocop),
135
+ [GitHub Sponsors](https://github.com/sponsors/bbatsov),
136
136
  [Patreon](https://www.patreon.com/bbatsov),
137
137
  [PayPal](https://paypal.me/bbatsov)
138
138
  and [Open Collective](https://opencollective.com/rubocop).
@@ -35,6 +35,7 @@ AllCops:
35
35
  - '**/*.watchr'
36
36
  - '**/.irbrc'
37
37
  - '**/.pryrc'
38
+ - '**/.simplecov'
38
39
  - '**/buildfile'
39
40
  - '**/Appraisals'
40
41
  - '**/Berksfile'
@@ -53,6 +54,7 @@ AllCops:
53
54
  - '**/Podfile'
54
55
  - '**/Puppetfile'
55
56
  - '**/Rakefile'
57
+ - '**/rakefile'
56
58
  - '**/Snapfile'
57
59
  - '**/Steepfile'
58
60
  - '**/Thorfile'
@@ -97,6 +99,14 @@ AllCops:
97
99
  # to true in the same configuration.
98
100
  EnabledByDefault: false
99
101
  DisabledByDefault: false
102
+ # New cops introduced between major versions are set to a special pending status
103
+ # and are not enabled by default with warning message.
104
+ # Change this behavior by overriding either `NewCops: enable` or `NewCops: disable`.
105
+ # When `NewCops` is `enable`, pending cops are enabled in bulk. Can be overridden by
106
+ # the `--enable-pending-cops` command-line option.
107
+ # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
108
+ # the `--disable-pending-cops` command-line option.
109
+ NewCops: pending
100
110
  # Enables the result cache if `true`. Can be overridden by the `--cache` command
101
111
  # line option.
102
112
  UseCache: true
@@ -125,7 +135,7 @@ AllCops:
125
135
  # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
126
136
  # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
127
137
  # from the lock file.) If the Ruby version is still unresolved, RuboCop will
128
- # use the oldest officially supported Ruby version (currently Ruby 2.3).
138
+ # use the oldest officially supported Ruby version (currently Ruby 2.4).
129
139
  TargetRubyVersion: ~
130
140
 
131
141
  #################### Bundler ###############################
@@ -143,12 +153,13 @@ Bundler/GemComment:
143
153
  Description: 'Add a comment describing each gem.'
144
154
  Enabled: false
145
155
  VersionAdded: '0.59'
146
- VersionChanged: '0.77'
156
+ VersionChanged: '0.85'
147
157
  Include:
148
158
  - '**/*.gemfile'
149
159
  - '**/Gemfile'
150
160
  - '**/gems.rb'
151
161
  IgnoredGems: []
162
+ OnlyFor: []
152
163
 
153
164
  Bundler/InsecureProtocolSource:
154
165
  Description: >-
@@ -255,10 +266,30 @@ Layout/ArrayAlignment:
255
266
  Description: >-
256
267
  Align the elements of an array literal if they span more than
257
268
  one line.
258
- StyleGuide: '#align-multiline-arrays'
269
+ StyleGuide: '#no-double-indent'
259
270
  Enabled: true
260
271
  VersionAdded: '0.49'
261
272
  VersionChanged: '0.77'
273
+ # Alignment of elements of a multi-line array.
274
+ #
275
+ # The `with_first_parameter` style aligns the following lines along the same
276
+ # column as the first element.
277
+ #
278
+ # array = [1, 2, 3,
279
+ # 4, 5, 6]
280
+ #
281
+ # The `with_fixed_indentation` style aligns the following lines with one
282
+ # level of indentation relative to the start of the line with start of array.
283
+ #
284
+ # array = [1, 2, 3,
285
+ # 4, 5, 6]
286
+ EnforcedStyle: with_first_element
287
+ SupportedStyles:
288
+ - with_first_element
289
+ - with_fixed_indentation
290
+ # By default, the indentation width from Layout/IndentationWidth is used
291
+ # But it can be overridden by setting this parameter
292
+ IndentationWidth: ~
262
293
 
263
294
  Layout/AssignmentIndentation:
264
295
  Description: >-
@@ -347,6 +378,7 @@ Layout/ConditionPosition:
347
378
  StyleGuide: '#same-line-condition'
348
379
  Enabled: true
349
380
  VersionAdded: '0.53'
381
+ VersionChanged: '0.83'
350
382
 
351
383
  Layout/DefEndAlignment:
352
384
  Description: 'Align ends corresponding to defs correctly.'
@@ -432,6 +464,19 @@ Layout/EmptyLinesAroundArguments:
432
464
  Enabled: true
433
465
  VersionAdded: '0.52'
434
466
 
467
+ Layout/EmptyLinesAroundAttributeAccessor:
468
+ Description: "Keep blank lines around attribute accessors."
469
+ StyleGuide: '#empty-lines-around-attribute-accessor'
470
+ Enabled: pending
471
+ VersionAdded: '0.83'
472
+ VersionChanged: '0.84'
473
+ AllowAliasSyntax: true
474
+ AllowedMethods:
475
+ - alias_method
476
+ - public
477
+ - protected
478
+ - private
479
+
435
480
  Layout/EmptyLinesAroundBeginBody:
436
481
  Description: "Keeps track of empty lines around begin-end bodies."
437
482
  StyleGuide: '#empty-lines-around-bodies'
@@ -746,13 +791,7 @@ Layout/HeredocIndentation:
746
791
  StyleGuide: '#squiggly-heredocs'
747
792
  Enabled: true
748
793
  VersionAdded: '0.49'
749
- VersionChanged: '0.77'
750
- EnforcedStyle: squiggly
751
- SupportedStyles:
752
- - squiggly
753
- - active_support
754
- - powerpack
755
- - unindent
794
+ VersionChanged: '0.85'
756
795
 
757
796
  Layout/IndentationConsistency:
758
797
  Description: 'Keep indentation straight.'
@@ -773,6 +812,22 @@ Layout/IndentationConsistency:
773
812
  # A reference to `EnforcedStyle: indented_internal_methods`.
774
813
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
775
814
 
815
+ Layout/IndentationStyle:
816
+ Description: 'Consistent indentation either with tabs only or spaces only.'
817
+ StyleGuide: '#spaces-indentation'
818
+ Enabled: true
819
+ VersionAdded: '0.49'
820
+ VersionChanged: '0.82'
821
+ # By default, the indentation width from Layout/IndentationWidth is used
822
+ # But it can be overridden by setting this parameter
823
+ # It is used during auto-correction to determine how many spaces should
824
+ # replace each tab.
825
+ IndentationWidth: ~
826
+ EnforcedStyle: spaces
827
+ SupportedStyles:
828
+ - spaces
829
+ - tabs
830
+
776
831
  Layout/IndentationWidth:
777
832
  Description: 'Use 2 spaces for indentation.'
778
833
  StyleGuide: '#spaces-indentation'
@@ -804,13 +859,13 @@ Layout/LeadingEmptyLines:
804
859
  VersionChanged: '0.77'
805
860
 
806
861
  Layout/LineLength:
807
- Description: 'Limit lines to 80 characters.'
808
- StyleGuide: '#80-character-limits'
862
+ Description: 'Checks that line length does not exceed the configured limit.'
863
+ StyleGuide: '#max-line-length'
809
864
  Enabled: true
810
865
  VersionAdded: '0.25'
811
- VersionChanged: '0.78'
866
+ VersionChanged: '0.84'
812
867
  AutoCorrect: false
813
- Max: 80
868
+ Max: 120
814
869
  # To make it possible to copy or click on URIs in the code, we allow lines
815
870
  # containing a URI to be longer than Max.
816
871
  AllowHeredoc: true
@@ -1060,6 +1115,11 @@ Layout/SpaceAroundKeyword:
1060
1115
  Enabled: true
1061
1116
  VersionAdded: '0.49'
1062
1117
 
1118
+ Layout/SpaceAroundMethodCallOperator:
1119
+ Description: 'Checks method call operators to not have spaces around them.'
1120
+ Enabled: pending
1121
+ VersionAdded: '0.82'
1122
+
1063
1123
  Layout/SpaceAroundOperators:
1064
1124
  Description: 'Use a single space around operators.'
1065
1125
  StyleGuide: '#spaces-operators'
@@ -1230,18 +1290,6 @@ Layout/SpaceInsideStringInterpolation:
1230
1290
  - space
1231
1291
  - no_space
1232
1292
 
1233
- Layout/Tab:
1234
- Description: 'No hard tabs.'
1235
- StyleGuide: '#spaces-indentation'
1236
- Enabled: true
1237
- VersionAdded: '0.49'
1238
- VersionChanged: '0.51'
1239
- # By default, the indentation width from Layout/IndentationWidth is used
1240
- # But it can be overridden by setting this parameter
1241
- # It is used during auto-correction to determine how many spaces should
1242
- # replace each tab.
1243
- IndentationWidth: ~
1244
-
1245
1293
  Layout/TrailingEmptyLines:
1246
1294
  Description: 'Checks trailing blank lines and final newline.'
1247
1295
  StyleGuide: '#newline-eof'
@@ -1258,8 +1306,8 @@ Layout/TrailingWhitespace:
1258
1306
  StyleGuide: '#no-trailing-whitespace'
1259
1307
  Enabled: true
1260
1308
  VersionAdded: '0.49'
1261
- VersionChanged: '0.55'
1262
- AllowInHeredoc: false
1309
+ VersionChanged: '0.83'
1310
+ AllowInHeredoc: true
1263
1311
 
1264
1312
  #################### Lint ##################################
1265
1313
  ### Warnings
@@ -1279,6 +1327,7 @@ Lint/AmbiguousOperator:
1279
1327
  StyleGuide: '#method-invocation-parens'
1280
1328
  Enabled: true
1281
1329
  VersionAdded: '0.17'
1330
+ VersionChanged: '0.83'
1282
1331
 
1283
1332
  Lint/AmbiguousRegexpLiteral:
1284
1333
  Description: >-
@@ -1286,6 +1335,7 @@ Lint/AmbiguousRegexpLiteral:
1286
1335
  a method invocation without parentheses.
1287
1336
  Enabled: true
1288
1337
  VersionAdded: '0.17'
1338
+ VersionChanged: '0.83'
1289
1339
 
1290
1340
  Lint/AssignmentInCondition:
1291
1341
  Description: "Don't use assignment in conditions."
@@ -1302,7 +1352,9 @@ Lint/BigDecimalNew:
1302
1352
  Lint/BooleanSymbol:
1303
1353
  Description: 'Check for `:true` and `:false` symbols.'
1304
1354
  Enabled: true
1355
+ Safe: false
1305
1356
  VersionAdded: '0.50'
1357
+ VersionChanged: '0.83'
1306
1358
 
1307
1359
  Lint/CircularArgumentReference:
1308
1360
  Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
@@ -1320,6 +1372,11 @@ Lint/DeprecatedClassMethods:
1320
1372
  Enabled: true
1321
1373
  VersionAdded: '0.19'
1322
1374
 
1375
+ Lint/DeprecatedOpenSSLConstant:
1376
+ Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1377
+ Enabled: pending
1378
+ VersionAdded: '0.84'
1379
+
1323
1380
  Lint/DisjunctiveAssignmentInConstructor:
1324
1381
  Description: 'In constructor, plain assignment is preferred over disjunctive.'
1325
1382
  Enabled: true
@@ -1373,18 +1430,16 @@ Lint/EmptyInterpolation:
1373
1430
  Lint/EmptyWhen:
1374
1431
  Description: 'Checks for `when` branches with empty bodies.'
1375
1432
  Enabled: true
1433
+ AllowComments: true
1376
1434
  VersionAdded: '0.45'
1377
-
1378
- Lint/EndInMethod:
1379
- Description: 'END blocks should not be placed inside method definitions.'
1380
- Enabled: true
1381
- VersionAdded: '0.9'
1435
+ VersionChanged: '0.83'
1382
1436
 
1383
1437
  Lint/EnsureReturn:
1384
1438
  Description: 'Do not use return in an ensure block.'
1385
1439
  StyleGuide: '#no-return-ensure'
1386
1440
  Enabled: true
1387
1441
  VersionAdded: '0.9'
1442
+ VersionChanged: '0.83'
1388
1443
 
1389
1444
  Lint/ErbNewArguments:
1390
1445
  Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
@@ -1478,6 +1533,11 @@ Lint/MissingCopEnableDirective:
1478
1533
  # .inf for any size
1479
1534
  MaximumRangeSize: .inf
1480
1535
 
1536
+ Lint/MixedRegexpCaptureTypes:
1537
+ Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1538
+ Enabled: pending
1539
+ VersionAdded: '0.85'
1540
+
1481
1541
  Lint/MultipleComparison:
1482
1542
  Description: "Use `&&` operator to compare multiple values."
1483
1543
  Enabled: true
@@ -1532,6 +1592,7 @@ Lint/ParenthesesAsGroupedExpression:
1532
1592
  StyleGuide: '#parens-no-spaces'
1533
1593
  Enabled: true
1534
1594
  VersionAdded: '0.12'
1595
+ VersionChanged: '0.83'
1535
1596
 
1536
1597
  Lint/PercentStringArray:
1537
1598
  Description: >-
@@ -1546,6 +1607,14 @@ Lint/PercentSymbolArray:
1546
1607
  Enabled: true
1547
1608
  VersionAdded: '0.41'
1548
1609
 
1610
+ Lint/RaiseException:
1611
+ Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1612
+ StyleGuide: '#raise-exception'
1613
+ Enabled: pending
1614
+ VersionAdded: '0.81'
1615
+ AllowedImplicitNamespaces:
1616
+ - 'Gem'
1617
+
1549
1618
  Lint/RandOne:
1550
1619
  Description: >-
1551
1620
  Checks for `rand(1)` calls. Such calls always return `0`
@@ -1574,7 +1643,7 @@ Lint/RedundantRequireStatement:
1574
1643
  Lint/RedundantSplatExpansion:
1575
1644
  Description: 'Checks for splat unnecessarily being called on literals.'
1576
1645
  Enabled: true
1577
- VersionChanged: '0.76'
1646
+ VersionAdded: '0.76'
1578
1647
 
1579
1648
  Lint/RedundantStringCoercion:
1580
1649
  Description: 'Checks for Object#to_s usage in string interpolation.'
@@ -1688,13 +1757,18 @@ Lint/ShadowingOuterLocalVariable:
1688
1757
  Enabled: true
1689
1758
  VersionAdded: '0.9'
1690
1759
 
1760
+ Lint/StructNewOverride:
1761
+ Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
1762
+ Enabled: pending
1763
+ VersionAdded: '0.81'
1764
+
1691
1765
  Lint/SuppressedException:
1692
1766
  Description: "Don't suppress exceptions."
1693
1767
  StyleGuide: '#dont-hide-exceptions'
1694
1768
  Enabled: true
1695
- AllowComments: false
1769
+ AllowComments: true
1696
1770
  VersionAdded: '0.9'
1697
- VersionChanged: '0.77'
1771
+ VersionChanged: '0.81'
1698
1772
 
1699
1773
  Lint/Syntax:
1700
1774
  Description: 'Checks syntax error.'
@@ -1705,6 +1779,7 @@ Lint/Syntax:
1705
1779
  Lint/ToJSON:
1706
1780
  Description: 'Ensure #to_json includes an optional argument.'
1707
1781
  Enabled: true
1782
+ VersionAdded: '0.66'
1708
1783
 
1709
1784
  Lint/UnderscorePrefixedVariableName:
1710
1785
  Description: 'Do not use prefix `_` for a variable that is used.'
@@ -1736,9 +1811,10 @@ Lint/UnusedMethodArgument:
1736
1811
  StyleGuide: '#underscore-unused-vars'
1737
1812
  Enabled: true
1738
1813
  VersionAdded: '0.21'
1739
- VersionChanged: '0.35'
1814
+ VersionChanged: '0.81'
1740
1815
  AllowUnusedKeywordArguments: false
1741
1816
  IgnoreEmptyMethods: true
1817
+ IgnoreNotImplementedMethods: true
1742
1818
 
1743
1819
  Lint/UriEscapeUnescape:
1744
1820
  Description: >-
@@ -1760,7 +1836,7 @@ Lint/UselessAccessModifier:
1760
1836
  Description: 'Checks for useless access modifiers.'
1761
1837
  Enabled: true
1762
1838
  VersionAdded: '0.20'
1763
- VersionChanged: '0.47'
1839
+ VersionChanged: '0.83'
1764
1840
  ContextCreatingMethods: []
1765
1841
  MethodCreatingMethods: []
1766
1842
 
@@ -1804,9 +1880,10 @@ Metrics/AbcSize:
1804
1880
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
1805
1881
  Enabled: true
1806
1882
  VersionAdded: '0.27'
1807
- VersionChanged: '0.66'
1883
+ VersionChanged: '0.81'
1808
1884
  # The ABC size is a calculated magnitude, so this number can be an Integer or
1809
1885
  # a Float.
1886
+ IgnoredMethods: []
1810
1887
  Max: 15
1811
1888
 
1812
1889
  Metrics/BlockLength:
@@ -1846,6 +1923,8 @@ Metrics/CyclomaticComplexity:
1846
1923
  of test cases needed to validate a method.
1847
1924
  Enabled: true
1848
1925
  VersionAdded: '0.25'
1926
+ VersionChanged: '0.81'
1927
+ IgnoredMethods: []
1849
1928
  Max: 6
1850
1929
 
1851
1930
  Metrics/MethodLength:
@@ -1879,6 +1958,8 @@ Metrics/PerceivedComplexity:
1879
1958
  human reader.
1880
1959
  Enabled: true
1881
1960
  VersionAdded: '0.25'
1961
+ VersionChanged: '0.81'
1962
+ IgnoredMethods: []
1882
1963
  Max: 7
1883
1964
 
1884
1965
  ################## Migration #############################
@@ -1888,6 +1969,7 @@ Migration/DepartmentName:
1888
1969
  Check that cop names in rubocop:disable (etc) comments are
1889
1970
  given with department name.
1890
1971
  Enabled: true
1972
+ VersionAdded: '0.75'
1891
1973
 
1892
1974
  #################### Naming ##############################
1893
1975
 
@@ -1929,6 +2011,11 @@ Naming/ClassAndModuleCamelCase:
1929
2011
  StyleGuide: '#camelcase-classes'
1930
2012
  Enabled: true
1931
2013
  VersionAdded: '0.50'
2014
+ VersionChanged: '0.85'
2015
+ # Allowed class/module names can be specified here.
2016
+ # These can be full or part of the name.
2017
+ AllowedNames:
2018
+ - module_parent
1932
2019
 
1933
2020
  Naming/ConstantName:
1934
2021
  Description: 'Constants should use SCREAMING_SNAKE_CASE.'
@@ -1949,6 +2036,10 @@ Naming/FileName:
1949
2036
  # It further expects it to be nested inside modules which match the names
1950
2037
  # of subdirectories in its path.
1951
2038
  ExpectMatchingDefinition: false
2039
+ # When `false`, changes the behavior of ExpectMatchingDefinition to match only
2040
+ # whether each source file's class or module name matches the file name --
2041
+ # not whether the nested module hierarchy matches the subdirectory path.
2042
+ CheckDefinitionPathHierarchy: true
1952
2043
  # If non-`nil`, expect all source file names to match the following regex.
1953
2044
  # Only the file name itself is matched, not the entire file path.
1954
2045
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2140,7 +2231,7 @@ Security/JSONLoad:
2140
2231
  Description: >-
2141
2232
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
2142
2233
  security issues. See reference for more information.
2143
- Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2234
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2144
2235
  Enabled: true
2145
2236
  VersionAdded: '0.43'
2146
2237
  VersionChanged: '0.44'
@@ -2153,7 +2244,7 @@ Security/MarshalLoad:
2153
2244
  Description: >-
2154
2245
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2155
2246
  security issues. See reference for more information.
2156
- Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2247
+ Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
2157
2248
  Enabled: true
2158
2249
  VersionAdded: '0.47'
2159
2250
 
@@ -2167,7 +2258,7 @@ Security/YAMLLoad:
2167
2258
  Description: >-
2168
2259
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2169
2260
  security issues. See reference for more information.
2170
- Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2261
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2171
2262
  Enabled: true
2172
2263
  VersionAdded: '0.47'
2173
2264
  SafeAutoCorrect: false
@@ -2178,10 +2269,12 @@ Style/AccessModifierDeclarations:
2178
2269
  Description: 'Checks style of how access modifiers are used.'
2179
2270
  Enabled: true
2180
2271
  VersionAdded: '0.57'
2272
+ VersionChanged: '0.81'
2181
2273
  EnforcedStyle: group
2182
2274
  SupportedStyles:
2183
2275
  - inline
2184
2276
  - group
2277
+ AllowModifiersOnSymbols: true
2185
2278
 
2186
2279
  Style/Alias:
2187
2280
  Description: 'Use alias instead of alias_method.'
@@ -2202,7 +2295,7 @@ Style/AndOr:
2202
2295
  VersionChanged: '0.25'
2203
2296
  # Whether `and` and `or` are banned only in conditionals (conditionals)
2204
2297
  # or completely (always).
2205
- EnforcedStyle: always
2298
+ EnforcedStyle: conditionals
2206
2299
  SupportedStyles:
2207
2300
  - always
2208
2301
  - conditionals
@@ -2372,6 +2465,15 @@ Style/CaseEquality:
2372
2465
  StyleGuide: '#no-case-equality'
2373
2466
  Enabled: true
2374
2467
  VersionAdded: '0.9'
2468
+ # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
2469
+ # the case equality operator is a constant.
2470
+ #
2471
+ # # bad
2472
+ # /string/ === "string"
2473
+ #
2474
+ # # good
2475
+ # String === "string"
2476
+ AllowOnConstant: false
2375
2477
 
2376
2478
  Style/CharacterLiteral:
2377
2479
  Description: 'Checks for uses of character literals.'
@@ -2412,6 +2514,7 @@ Style/ClassAndModuleChildren:
2412
2514
 
2413
2515
  Style/ClassCheck:
2414
2516
  Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
2517
+ StyleGuide: '#is-a-vs-kind-of'
2415
2518
  Enabled: true
2416
2519
  VersionAdded: '0.24'
2417
2520
  EnforcedStyle: is_a?
@@ -2435,7 +2538,7 @@ Style/ClassVars:
2435
2538
  # Align with the style guide.
2436
2539
  Style/CollectionMethods:
2437
2540
  Description: 'Preferred collection methods.'
2438
- StyleGuide: '#map-find-select-reduce-size'
2541
+ StyleGuide: '#map-find-select-reduce-include-size'
2439
2542
  Enabled: false
2440
2543
  VersionAdded: '0.9'
2441
2544
  VersionChanged: '0.27'
@@ -2452,6 +2555,7 @@ Style/CollectionMethods:
2452
2555
  inject: 'reduce'
2453
2556
  detect: 'find'
2454
2557
  find_all: 'select'
2558
+ member?: 'include?'
2455
2559
 
2456
2560
  Style/ColonMethodCall:
2457
2561
  Description: 'Do not use :: for method call.'
@@ -2578,6 +2682,12 @@ Style/Dir:
2578
2682
  Enabled: true
2579
2683
  VersionAdded: '0.50'
2580
2684
 
2685
+ Style/DisableCopsWithinSourceCodeDirective:
2686
+ Description: >-
2687
+ Forbids disabling/enabling cops within source code.
2688
+ Enabled: false
2689
+ VersionAdded: '0.82'
2690
+
2581
2691
  Style/Documentation:
2582
2692
  Description: 'Document classes and non-namespace modules.'
2583
2693
  Enabled: true
@@ -2605,6 +2715,11 @@ Style/DoubleNegation:
2605
2715
  StyleGuide: '#no-bang-bang'
2606
2716
  Enabled: true
2607
2717
  VersionAdded: '0.19'
2718
+ VersionChanged: '0.84'
2719
+ EnforcedStyle: allowed_in_returns
2720
+ SupportedStyles:
2721
+ - allowed_in_returns
2722
+ - forbidden
2608
2723
 
2609
2724
  Style/EachForSimpleLoop:
2610
2725
  Description: >-
@@ -2677,6 +2792,7 @@ Style/EndBlock:
2677
2792
  StyleGuide: '#no-END-blocks'
2678
2793
  Enabled: true
2679
2794
  VersionAdded: '0.9'
2795
+ VersionChanged: '0.81'
2680
2796
 
2681
2797
  Style/EvalWithLocation:
2682
2798
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
@@ -2695,6 +2811,17 @@ Style/ExpandPathArguments:
2695
2811
  Enabled: true
2696
2812
  VersionAdded: '0.53'
2697
2813
 
2814
+ Style/ExponentialNotation:
2815
+ Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
2816
+ StyleGuide: '#exponential-notation'
2817
+ Enabled: pending
2818
+ VersionAdded: '0.82'
2819
+ EnforcedStyle: scientific
2820
+ SupportedStyles:
2821
+ - scientific
2822
+ - engineering
2823
+ - integral
2824
+
2698
2825
  Style/FloatDivision:
2699
2826
  Description: 'For performing float division, coerce one side only.'
2700
2827
  StyleGuide: '#float-division'
@@ -2756,8 +2883,7 @@ Style/FrozenStringLiteralComment:
2756
2883
  SupportedStyles:
2757
2884
  # `always` will always add the frozen string literal comment to a file
2758
2885
  # regardless of the Ruby version or if `freeze` or `<<` are called on a
2759
- # string literal. If you run code against multiple versions of Ruby, it is
2760
- # possible that this will create errors in Ruby 2.3.0+.
2886
+ # string literal. It is possible that this will create errors.
2761
2887
  - always
2762
2888
  # `always_true` will add the frozen string literal comment to a file,
2763
2889
  # similarly to the `always` style, but will also change any disabled
@@ -2863,6 +2989,7 @@ Style/IfWithSemicolon:
2863
2989
  StyleGuide: '#no-semicolon-ifs'
2864
2990
  Enabled: true
2865
2991
  VersionAdded: '0.9'
2992
+ VersionChanged: '0.83'
2866
2993
 
2867
2994
  Style/ImplicitRuntimeError:
2868
2995
  Description: >-
@@ -2937,7 +3064,7 @@ Style/LambdaCall:
2937
3064
  Description: 'Use lambda.call(...) instead of lambda.(...).'
2938
3065
  StyleGuide: '#proc-call'
2939
3066
  Enabled: true
2940
- VersionAdded: '0.13.1'
3067
+ VersionAdded: '0.13'
2941
3068
  VersionChanged: '0.14'
2942
3069
  EnforcedStyle: call
2943
3070
  SupportedStyles:
@@ -3067,6 +3194,7 @@ Style/ModuleFunction:
3067
3194
  SupportedStyles:
3068
3195
  - module_function
3069
3196
  - extend_self
3197
+ - forbidden
3070
3198
  Autocorrect: false
3071
3199
  SafeAutoCorrect: false
3072
3200
 
@@ -3339,7 +3467,9 @@ Style/OptionalArguments:
3339
3467
  of the argument list.
3340
3468
  StyleGuide: '#optional-arguments'
3341
3469
  Enabled: true
3470
+ Safe: false
3342
3471
  VersionAdded: '0.33'
3472
+ VersionChanged: '0.83'
3343
3473
 
3344
3474
  Style/OrAssignment:
3345
3475
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3488,6 +3618,16 @@ Style/RedundantPercentQ:
3488
3618
  Enabled: true
3489
3619
  VersionAdded: '0.76'
3490
3620
 
3621
+ Style/RedundantRegexpCharacterClass:
3622
+ Description: 'Checks for unnecessary single-element Regexp character classes.'
3623
+ Enabled: pending
3624
+ VersionAdded: '0.85'
3625
+
3626
+ Style/RedundantRegexpEscape:
3627
+ Description: 'Checks for redundant escapes in Regexps.'
3628
+ Enabled: pending
3629
+ VersionAdded: '0.85'
3630
+
3491
3631
  Style/RedundantReturn:
3492
3632
  Description: "Don't use return where it's not required."
3493
3633
  StyleGuide: '#no-explicit-return'
@@ -3644,6 +3784,12 @@ Style/SingleLineMethods:
3644
3784
  VersionChanged: '0.19'
3645
3785
  AllowIfMethodIsEmpty: true
3646
3786
 
3787
+ Style/SlicingWithRange:
3788
+ Description: 'Checks array slicing is done with endless ranges when suitable.'
3789
+ Enabled: pending
3790
+ VersionAdded: '0.83'
3791
+ Safe: false
3792
+
3647
3793
  Style/SpecialGlobalVars:
3648
3794
  Description: 'Avoid Perl-style global variables.'
3649
3795
  StyleGuide: '#no-cryptic-perlisms'
@@ -3806,22 +3952,29 @@ Style/TrailingCommaInArrayLiteral:
3806
3952
  StyleGuide: '#no-trailing-array-commas'
3807
3953
  Enabled: true
3808
3954
  VersionAdded: '0.53'
3955
+ # If `comma`, the cop requires a comma after the last item in an array,
3809
3956
  # but only when each item is on its own line.
3810
3957
  # If `consistent_comma`, the cop requires a comma after the last item of all
3811
- # non-empty array literals.
3958
+ # non-empty, multiline array literals.
3812
3959
  EnforcedStyleForMultiline: no_comma
3813
3960
  SupportedStylesForMultiline:
3814
3961
  - comma
3815
3962
  - consistent_comma
3816
3963
  - no_comma
3817
3964
 
3965
+ Style/TrailingCommaInBlockArgs:
3966
+ Description: 'Checks for useless trailing commas in block arguments.'
3967
+ Enabled: false
3968
+ Safe: false
3969
+ VersionAdded: '0.81'
3970
+
3818
3971
  Style/TrailingCommaInHashLiteral:
3819
3972
  Description: 'Checks for trailing comma in hash literals.'
3820
3973
  Enabled: true
3821
3974
  # If `comma`, the cop requires a comma after the last item in a hash,
3822
3975
  # but only when each item is on its own line.
3823
3976
  # If `consistent_comma`, the cop requires a comma after the last item of all
3824
- # non-empty hash literals.
3977
+ # non-empty, multiline hash literals.
3825
3978
  EnforcedStyleForMultiline: no_comma
3826
3979
  SupportedStylesForMultiline:
3827
3980
  - comma