rubocop 0.82.0 → 0.86.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -19
  3. data/config/default.yml +111 -23
  4. data/lib/rubocop.rb +16 -59
  5. data/lib/rubocop/ast_aliases.rb +8 -0
  6. data/lib/rubocop/cli.rb +3 -3
  7. data/lib/rubocop/cli/command/auto_genenerate_config.rb +2 -2
  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 +6 -2
  12. data/lib/rubocop/config_loader.rb +19 -24
  13. data/lib/rubocop/config_loader_resolver.rb +45 -6
  14. data/lib/rubocop/config_store.rb +12 -2
  15. data/lib/rubocop/config_validator.rb +2 -1
  16. data/lib/rubocop/cop/autocorrect_logic.rb +1 -2
  17. data/lib/rubocop/cop/bundler/gem_comment.rb +70 -1
  18. data/lib/rubocop/cop/commissioner.rb +0 -21
  19. data/lib/rubocop/cop/cop.rb +36 -21
  20. data/lib/rubocop/cop/correctors/alignment_corrector.rb +2 -6
  21. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +1 -1
  22. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -3
  23. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -3
  24. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +1 -1
  25. data/lib/rubocop/cop/generator.rb +4 -3
  26. data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
  27. data/lib/rubocop/cop/ignored_node.rb +1 -3
  28. data/lib/rubocop/cop/layout/case_indentation.rb +3 -3
  29. data/lib/rubocop/cop/layout/class_structure.rb +19 -16
  30. data/lib/rubocop/cop/layout/comment_indentation.rb +3 -3
  31. data/lib/rubocop/cop/layout/condition_position.rb +12 -2
  32. data/lib/rubocop/cop/layout/empty_comment.rb +1 -1
  33. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +2 -6
  34. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +128 -0
  35. data/lib/rubocop/cop/layout/end_of_line.rb +3 -3
  36. data/lib/rubocop/cop/layout/first_argument_indentation.rb +2 -4
  37. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +1 -3
  38. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
  39. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -3
  40. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
  41. data/lib/rubocop/cop/layout/hash_alignment.rb +7 -7
  42. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +3 -7
  43. data/lib/rubocop/cop/layout/heredoc_indentation.rb +20 -103
  44. data/lib/rubocop/cop/layout/indentation_width.rb +1 -3
  45. data/lib/rubocop/cop/layout/line_length.rb +21 -18
  46. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
  47. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -3
  48. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +13 -4
  49. data/lib/rubocop/cop/layout/space_after_colon.rb +1 -1
  50. data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
  51. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -3
  52. data/lib/rubocop/cop/layout/space_around_operators.rb +19 -2
  53. data/lib/rubocop/cop/layout/space_before_block_braces.rb +14 -0
  54. data/lib/rubocop/cop/layout/space_before_comment.rb +1 -3
  55. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +2 -4
  56. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
  57. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
  58. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +1 -3
  59. data/lib/rubocop/cop/layout/trailing_whitespace.rb +2 -2
  60. data/lib/rubocop/cop/lint/ambiguous_operator.rb +41 -0
  61. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +14 -0
  62. data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
  63. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +137 -0
  64. data/lib/rubocop/cop/lint/duplicate_methods.rb +1 -5
  65. data/lib/rubocop/cop/lint/empty_when.rb +29 -6
  66. data/lib/rubocop/cop/lint/ensure_return.rb +19 -2
  67. data/lib/rubocop/cop/lint/erb_new_arguments.rb +1 -3
  68. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  69. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +38 -2
  70. data/lib/rubocop/cop/lint/literal_as_condition.rb +10 -13
  71. data/lib/rubocop/cop/lint/loop.rb +1 -1
  72. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +69 -0
  73. data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
  74. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +7 -7
  75. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +33 -11
  76. data/lib/rubocop/cop/lint/percent_string_array.rb +2 -4
  77. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  78. data/lib/rubocop/cop/lint/raise_exception.rb +12 -4
  79. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +5 -8
  80. data/lib/rubocop/cop/lint/redundant_require_statement.rb +3 -3
  81. data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -0
  82. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  83. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  84. data/lib/rubocop/cop/lint/suppressed_exception.rb +11 -4
  85. data/lib/rubocop/cop/lint/syntax.rb +1 -3
  86. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  87. data/lib/rubocop/cop/lint/useless_access_modifier.rb +13 -3
  88. data/lib/rubocop/cop/lint/useless_assignment.rb +3 -2
  89. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +6 -1
  90. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
  91. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +35 -3
  92. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
  93. data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
  94. data/lib/rubocop/cop/migration/department_name.rb +7 -7
  95. data/lib/rubocop/cop/mixin/alignment.rb +1 -3
  96. data/lib/rubocop/cop/mixin/array_min_size.rb +1 -3
  97. data/lib/rubocop/cop/mixin/check_line_breakable.rb +3 -9
  98. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +1 -3
  99. data/lib/rubocop/cop/mixin/configurable_formatting.rb +2 -4
  100. data/lib/rubocop/cop/mixin/configurable_naming.rb +1 -1
  101. data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -2
  102. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  103. data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
  104. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +10 -1
  105. data/lib/rubocop/cop/mixin/hash_transform_method.rb +8 -1
  106. data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
  107. data/lib/rubocop/cop/mixin/line_length_help.rb +3 -2
  108. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
  109. data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
  110. data/lib/rubocop/cop/mixin/parser_diagnostic.rb +1 -1
  111. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
  112. data/lib/rubocop/cop/mixin/range_help.rb +1 -1
  113. data/lib/rubocop/cop/mixin/regexp_literal_help.rb +43 -0
  114. data/lib/rubocop/cop/mixin/statement_modifier.rb +7 -23
  115. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
  116. data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -3
  117. data/lib/rubocop/cop/mixin/target_ruby_version.rb +5 -1
  118. data/lib/rubocop/cop/mixin/trailing_comma.rb +2 -4
  119. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +3 -3
  120. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  121. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +11 -1
  122. data/lib/rubocop/cop/naming/file_name.rb +28 -17
  123. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
  124. data/lib/rubocop/cop/naming/method_name.rb +1 -5
  125. data/lib/rubocop/cop/naming/predicate_name.rb +1 -1
  126. data/lib/rubocop/cop/registry.rb +63 -10
  127. data/lib/rubocop/cop/severity.rb +1 -3
  128. data/lib/rubocop/cop/style/and_or.rb +2 -2
  129. data/lib/rubocop/cop/style/array_join.rb +1 -1
  130. data/lib/rubocop/cop/style/attr.rb +1 -3
  131. data/lib/rubocop/cop/style/bare_percent_literals.rb +2 -2
  132. data/lib/rubocop/cop/style/block_delimiters.rb +4 -12
  133. data/lib/rubocop/cop/style/case_equality.rb +1 -1
  134. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  135. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  136. data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
  137. data/lib/rubocop/cop/style/conditional_assignment.rb +2 -4
  138. data/lib/rubocop/cop/style/copyright.rb +5 -5
  139. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +1 -1
  140. data/lib/rubocop/cop/style/documentation.rb +2 -2
  141. data/lib/rubocop/cop/style/double_negation.rb +41 -4
  142. data/lib/rubocop/cop/style/empty_case_condition.rb +8 -6
  143. data/lib/rubocop/cop/style/empty_literal.rb +1 -3
  144. data/lib/rubocop/cop/style/empty_method.rb +1 -5
  145. data/lib/rubocop/cop/style/encoding.rb +1 -1
  146. data/lib/rubocop/cop/style/exponential_notation.rb +5 -5
  147. data/lib/rubocop/cop/style/format_string_token.rb +2 -3
  148. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -6
  149. data/lib/rubocop/cop/style/guard_clause.rb +25 -2
  150. data/lib/rubocop/cop/style/hash_each_methods.rb +1 -1
  151. data/lib/rubocop/cop/style/hash_syntax.rb +16 -7
  152. data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
  153. data/lib/rubocop/cop/style/if_inside_else.rb +1 -1
  154. data/lib/rubocop/cop/style/if_with_semicolon.rb +16 -0
  155. data/lib/rubocop/cop/style/inline_comment.rb +1 -1
  156. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  157. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  158. data/lib/rubocop/cop/style/lambda_call.rb +0 -20
  159. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +1 -3
  160. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +1 -3
  161. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  162. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  163. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +17 -6
  164. data/lib/rubocop/cop/style/multiline_when_then.rb +16 -1
  165. data/lib/rubocop/cop/style/negated_if.rb +3 -3
  166. data/lib/rubocop/cop/style/negated_unless.rb +3 -3
  167. data/lib/rubocop/cop/style/nested_ternary_operator.rb +27 -0
  168. data/lib/rubocop/cop/style/next.rb +2 -2
  169. data/lib/rubocop/cop/style/non_nil_check.rb +1 -1
  170. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +2 -2
  171. data/lib/rubocop/cop/style/one_line_conditional.rb +2 -6
  172. data/lib/rubocop/cop/style/optional_arguments.rb +1 -1
  173. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  174. data/lib/rubocop/cop/style/redundant_conditional.rb +4 -3
  175. data/lib/rubocop/cop/style/redundant_fetch_block.rb +103 -0
  176. data/lib/rubocop/cop/style/redundant_parentheses.rb +3 -7
  177. data/lib/rubocop/cop/style/redundant_percent_q.rb +3 -3
  178. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +89 -0
  179. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +121 -0
  180. data/lib/rubocop/cop/style/redundant_self.rb +6 -9
  181. data/lib/rubocop/cop/style/safe_navigation.rb +2 -6
  182. data/lib/rubocop/cop/style/sample.rb +1 -1
  183. data/lib/rubocop/cop/style/semicolon.rb +1 -1
  184. data/lib/rubocop/cop/style/slicing_with_range.rb +39 -0
  185. data/lib/rubocop/cop/style/special_global_vars.rb +2 -6
  186. data/lib/rubocop/cop/style/struct_inheritance.rb +21 -0
  187. data/lib/rubocop/cop/style/symbol_array.rb +5 -5
  188. data/lib/rubocop/cop/style/ternary_parentheses.rb +2 -4
  189. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +3 -3
  190. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +3 -3
  191. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +13 -13
  192. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +3 -3
  193. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -3
  194. data/lib/rubocop/cop/style/unless_else.rb +1 -1
  195. data/lib/rubocop/cop/style/when_then.rb +1 -1
  196. data/lib/rubocop/cop/style/word_array.rb +1 -1
  197. data/lib/rubocop/cop/style/yoda_condition.rb +18 -1
  198. data/lib/rubocop/cop/team.rb +69 -25
  199. data/lib/rubocop/cop/util.rb +27 -3
  200. data/lib/rubocop/cop/utils/format_string.rb +18 -0
  201. data/lib/rubocop/cop/variable_force.rb +3 -9
  202. data/lib/rubocop/cop/variable_force/assignment.rb +1 -0
  203. data/lib/rubocop/cop/variable_force/branch.rb +1 -3
  204. data/lib/rubocop/cop/variable_force/scope.rb +1 -0
  205. data/lib/rubocop/cop/variable_force/variable.rb +3 -6
  206. data/lib/rubocop/ext/processed_source.rb +18 -0
  207. data/lib/rubocop/formatter/base_formatter.rb +0 -4
  208. data/lib/rubocop/formatter/disabled_config_formatter.rb +5 -13
  209. data/lib/rubocop/formatter/formatter_set.rb +2 -4
  210. data/lib/rubocop/formatter/junit_formatter.rb +14 -4
  211. data/lib/rubocop/magic_comment.rb +1 -1
  212. data/lib/rubocop/name_similarity.rb +18 -9
  213. data/lib/rubocop/options.rb +26 -11
  214. data/lib/rubocop/path_util.rb +2 -2
  215. data/lib/rubocop/platform.rb +1 -1
  216. data/lib/rubocop/remote_config.rb +1 -3
  217. data/lib/rubocop/result_cache.rb +5 -7
  218. data/lib/rubocop/rspec/cop_helper.rb +2 -25
  219. data/lib/rubocop/rspec/expect_offense.rb +58 -15
  220. data/lib/rubocop/rspec/shared_contexts.rb +54 -16
  221. data/lib/rubocop/runner.rb +20 -13
  222. data/lib/rubocop/target_finder.rb +8 -8
  223. data/lib/rubocop/target_ruby.rb +4 -1
  224. data/lib/rubocop/version.rb +5 -3
  225. metadata +51 -74
  226. data/lib/rubocop/ast/builder.rb +0 -85
  227. data/lib/rubocop/ast/node.rb +0 -637
  228. data/lib/rubocop/ast/node/alias_node.rb +0 -24
  229. data/lib/rubocop/ast/node/and_node.rb +0 -29
  230. data/lib/rubocop/ast/node/args_node.rb +0 -29
  231. data/lib/rubocop/ast/node/array_node.rb +0 -70
  232. data/lib/rubocop/ast/node/block_node.rb +0 -121
  233. data/lib/rubocop/ast/node/break_node.rb +0 -17
  234. data/lib/rubocop/ast/node/case_match_node.rb +0 -56
  235. data/lib/rubocop/ast/node/case_node.rb +0 -56
  236. data/lib/rubocop/ast/node/class_node.rb +0 -31
  237. data/lib/rubocop/ast/node/def_node.rb +0 -82
  238. data/lib/rubocop/ast/node/defined_node.rb +0 -17
  239. data/lib/rubocop/ast/node/ensure_node.rb +0 -17
  240. data/lib/rubocop/ast/node/float_node.rb +0 -12
  241. data/lib/rubocop/ast/node/for_node.rb +0 -53
  242. data/lib/rubocop/ast/node/forward_args_node.rb +0 -18
  243. data/lib/rubocop/ast/node/hash_node.rb +0 -109
  244. data/lib/rubocop/ast/node/if_node.rb +0 -175
  245. data/lib/rubocop/ast/node/int_node.rb +0 -12
  246. data/lib/rubocop/ast/node/keyword_splat_node.rb +0 -45
  247. data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +0 -16
  248. data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +0 -43
  249. data/lib/rubocop/ast/node/mixin/collection_node.rb +0 -15
  250. data/lib/rubocop/ast/node/mixin/conditional_node.rb +0 -45
  251. data/lib/rubocop/ast/node/mixin/hash_element_node.rb +0 -125
  252. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +0 -269
  253. data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +0 -114
  254. data/lib/rubocop/ast/node/mixin/modifier_node.rb +0 -17
  255. data/lib/rubocop/ast/node/mixin/numeric_node.rb +0 -21
  256. data/lib/rubocop/ast/node/mixin/parameterized_node.rb +0 -61
  257. data/lib/rubocop/ast/node/mixin/predicate_operator_node.rb +0 -35
  258. data/lib/rubocop/ast/node/module_node.rb +0 -24
  259. data/lib/rubocop/ast/node/or_node.rb +0 -29
  260. data/lib/rubocop/ast/node/pair_node.rb +0 -63
  261. data/lib/rubocop/ast/node/range_node.rb +0 -18
  262. data/lib/rubocop/ast/node/regexp_node.rb +0 -33
  263. data/lib/rubocop/ast/node/resbody_node.rb +0 -24
  264. data/lib/rubocop/ast/node/retry_node.rb +0 -17
  265. data/lib/rubocop/ast/node/return_node.rb +0 -24
  266. data/lib/rubocop/ast/node/self_class_node.rb +0 -24
  267. data/lib/rubocop/ast/node/send_node.rb +0 -13
  268. data/lib/rubocop/ast/node/str_node.rb +0 -16
  269. data/lib/rubocop/ast/node/super_node.rb +0 -21
  270. data/lib/rubocop/ast/node/symbol_node.rb +0 -12
  271. data/lib/rubocop/ast/node/until_node.rb +0 -35
  272. data/lib/rubocop/ast/node/when_node.rb +0 -53
  273. data/lib/rubocop/ast/node/while_node.rb +0 -35
  274. data/lib/rubocop/ast/node/yield_node.rb +0 -21
  275. data/lib/rubocop/ast/sexp.rb +0 -16
  276. data/lib/rubocop/ast/traversal.rb +0 -202
  277. data/lib/rubocop/node_pattern.rb +0 -887
  278. data/lib/rubocop/processed_source.rb +0 -213
  279. data/lib/rubocop/string_util.rb +0 -14
  280. data/lib/rubocop/token.rb +0 -114
@@ -71,9 +71,37 @@ module RuboCop
71
71
  # RUBY
72
72
  #
73
73
  # expect_no_corrections
74
+ #
75
+ # If your code has variables of different lengths, you can use `%{foo}`,
76
+ # `^{foo}`, and `_{foo}` to format your template:
77
+ #
78
+ # %w[raise fail].each do |keyword|
79
+ # expect_offense(<<~RUBY, keyword: keyword)
80
+ # %{keyword}(RuntimeError, msg)
81
+ # ^{keyword}^^^^^^^^^^^^^^^^^^^ Redundant `RuntimeError` argument can be removed.
82
+ # RUBY
83
+ #
84
+ # %w[has_one has_many].each do |type|
85
+ # expect_offense(<<~RUBY, type: type)
86
+ # class Book
87
+ # %{type} :chapter, foreign_key: 'book_id'
88
+ # _{type} ^^^^^^^^^^^^^^^^^^^^^^ Specifying the default value is redundant.
89
+ # end
90
+ # RUBY
91
+ # end
74
92
  module ExpectOffense
93
+ def format_offense(source, **replacements)
94
+ replacements.each do |keyword, value|
95
+ source = source.gsub("%{#{keyword}}", value)
96
+ .gsub("^{#{keyword}}", '^' * value.size)
97
+ .gsub("_{#{keyword}}", ' ' * value.size)
98
+ end
99
+ source
100
+ end
101
+
75
102
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
76
- def expect_offense(source, file = nil)
103
+ def expect_offense(source, file = nil, **replacements)
104
+ source = format_offense(source, **replacements)
77
105
  RuboCop::Formatter::DisabledConfigFormatter
78
106
  .config_to_allow_offenses = {}
79
107
  RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {}
@@ -88,9 +116,7 @@ module RuboCop
88
116
  @processed_source = parse_source(expected_annotations.plain_source,
89
117
  file)
90
118
 
91
- unless @processed_source.valid_syntax?
92
- raise 'Error parsing example code'
93
- end
119
+ raise 'Error parsing example code' unless @processed_source.valid_syntax?
94
120
 
95
121
  _investigate(cop, @processed_source)
96
122
  actual_annotations =
@@ -98,24 +124,41 @@ module RuboCop
98
124
 
99
125
  expect(actual_annotations.to_s).to eq(expected_annotations.to_s)
100
126
  end
101
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
102
127
 
103
- def expect_correction(correction)
104
- unless @processed_source
105
- raise '`expect_correction` must follow `expect_offense`'
106
- end
128
+ def expect_correction(correction, loop: true)
129
+ raise '`expect_correction` must follow `expect_offense`' unless @processed_source
107
130
 
108
- corrector =
109
- RuboCop::Cop::Corrector.new(@processed_source.buffer, cop.corrections)
110
- new_source = corrector.rewrite
131
+ iteration = 0
132
+ new_source = loop do
133
+ iteration += 1
134
+
135
+ corrector =
136
+ RuboCop::Cop::Corrector.new(@processed_source.buffer, cop.corrections)
137
+ corrected_source = corrector.rewrite
138
+
139
+ break corrected_source unless loop
140
+ break corrected_source if cop.corrections.empty?
141
+ break corrected_source if corrected_source == @processed_source.buffer.source
142
+
143
+ if iteration > RuboCop::Runner::MAX_ITERATIONS
144
+ raise RuboCop::Runner::InfiniteCorrectionLoop.new(@processed_source.path, [])
145
+ end
146
+
147
+ # Prepare for next loop
148
+ cop.instance_variable_set(:@corrections, [])
149
+ # Cache invalidation. This is bad!
150
+ cop.instance_variable_set(:@token_table, nil)
151
+ @processed_source = parse_source(corrected_source,
152
+ @processed_source.path)
153
+ _investigate(cop, @processed_source)
154
+ end
111
155
 
112
156
  expect(new_source).to eq(correction)
113
157
  end
158
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
114
159
 
115
160
  def expect_no_corrections
116
- unless @processed_source
117
- raise '`expect_no_corrections` must follow `expect_offense`'
118
- end
161
+ raise '`expect_no_corrections` must follow `expect_offense`' unless @processed_source
119
162
 
120
163
  return if cop.corrections.empty?
121
164
 
@@ -38,28 +38,66 @@ RSpec.shared_context 'isolated environment', :isolated_environment do
38
38
  end
39
39
  end
40
40
 
41
- # `cop_config` must be declared with #let.
42
- RSpec.shared_context 'config', :config do
43
- let(:config) do
44
- # Module#<
45
- unless described_class < RuboCop::Cop::Cop
46
- raise '`config` must be used in `describe SomeCopClass do .. end`'
47
- end
41
+ # This context assumes nothing and defines `cop`, among others.
42
+ RSpec.shared_context 'config', :config do # rubocop:disable Metrics/BlockLength
43
+ ### Meant to be overridden at will
44
+
45
+ let(:source) { 'code = {some: :ruby}' }
48
46
 
49
- hash = { 'AllCops' => { 'TargetRubyVersion' => ruby_version } }
50
- hash['AllCops']['TargetRailsVersion'] = rails_version if rails_version
51
- if respond_to?(:cop_config)
52
- cop_name = described_class.cop_name
53
- hash[cop_name] = RuboCop::ConfigLoader
54
- .default_configuration[cop_name]
55
- .merge('Enabled' => true) # in case it is 'pending'
56
- .merge(cop_config)
47
+ let(:cop_class) do
48
+ if described_class.is_a?(Class) && described_class < RuboCop::Cop::Cop
49
+ described_class
50
+ else
51
+ RuboCop::Cop::Cop
57
52
  end
53
+ end
54
+
55
+ let(:cop_config) { {} }
56
+
57
+ let(:other_cops) { {} }
58
+
59
+ let(:cop_options) { {} }
60
+
61
+ ### Utilities
62
+
63
+ def source_range(range, buffer: source_buffer)
64
+ Parser::Source::Range.new(buffer, range.begin,
65
+ range.exclude_end? ? range.end : range.end + 1)
66
+ end
58
67
 
59
- hash = other_cops.merge hash if respond_to?(:other_cops)
68
+ ### Useful intermediary steps (less likely to be overridden)
69
+
70
+ let(:processed_source) { parse_source(source, 'test') }
71
+
72
+ let(:source_buffer) { processed_source.buffer }
73
+
74
+ let(:all_cops_config) do
75
+ rails = { 'TargetRubyVersion' => ruby_version }
76
+ rails['TargetRailsVersion'] = rails_version if rails_version
77
+ rails
78
+ end
79
+
80
+ let(:cur_cop_config) do
81
+ RuboCop::ConfigLoader
82
+ .default_configuration.for_cop(cop_class)
83
+ .merge({
84
+ 'Enabled' => true, # in case it is 'pending'
85
+ 'AutoCorrect' => true # in case defaults set it to false
86
+ })
87
+ .merge(cop_config)
88
+ end
89
+
90
+ let(:config) do
91
+ hash = { 'AllCops' => all_cops_config,
92
+ cop_class.cop_name => cur_cop_config }.merge!(other_cops)
60
93
 
61
94
  RuboCop::Config.new(hash, "#{Dir.pwd}/.rubocop.yml")
62
95
  end
96
+
97
+ let(:cop) do
98
+ cop_class.new(config, cop_options)
99
+ .tap { |cop| cop.processed_source = processed_source }
100
+ end
63
101
  end
64
102
 
65
103
  RSpec.shared_context 'mock console output' do
@@ -61,7 +61,12 @@ module RuboCop
61
61
 
62
62
  def find_target_files(paths)
63
63
  target_finder = TargetFinder.new(@config_store, @options)
64
- target_files = target_finder.find(paths)
64
+ mode = if @options[:only_recognized_file_types]
65
+ :only_recognized_file_types
66
+ else
67
+ :all_file_types
68
+ end
69
+ target_files = target_finder.find(paths, mode)
65
70
  target_files.each(&:freeze).freeze
66
71
  end
67
72
 
@@ -75,9 +80,7 @@ module RuboCop
75
80
  # OPTIMIZE: Calling `ResultCache.cleanup` takes time. This optimization
76
81
  # mainly targets editors that integrates RuboCop. When RuboCop is run
77
82
  # by an editor, it should be inspecting only one file.
78
- if files.size > 1 && cached_run?
79
- ResultCache.cleanup(@config_store, @options[:debug])
80
- end
83
+ ResultCache.cleanup(@config_store, @options[:debug]) if files.size > 1 && cached_run?
81
84
  formatter_set.finished(inspected_files.freeze)
82
85
  formatter_set.close_output_files
83
86
  end
@@ -126,7 +129,7 @@ module RuboCop
126
129
  end
127
130
 
128
131
  def file_offense_cache(file)
129
- config = @config_store.for(file)
132
+ config = @config_store.for_file(file)
130
133
  cache = cached_result(file, standby_team(config)) if cached_run?
131
134
 
132
135
  if cache&.valid?
@@ -165,7 +168,7 @@ module RuboCop
165
168
  end
166
169
 
167
170
  def redundant_cop_disable_directive(file)
168
- config = @config_store.for(file)
171
+ config = @config_store.for_file(file)
169
172
  if config.for_cop(Cop::Lint::RedundantCopDisableDirective)
170
173
  .fetch('Enabled')
171
174
  cop = Cop::Lint::RedundantCopDisableDirective.new(config, @options)
@@ -180,7 +183,7 @@ module RuboCop
180
183
  def autocorrect_redundant_disables(file, source, cop, offenses)
181
184
  cop.processed_source = source
182
185
 
183
- team = Cop::Team.new(RuboCop::Cop::Registry.new, nil, @options)
186
+ team = Cop::Team.mobilize(RuboCop::Cop::Registry.new, nil, @options)
184
187
  team.autocorrect(source.buffer, [cop])
185
188
 
186
189
  return [] unless team.updated_source_file?
@@ -211,7 +214,7 @@ module RuboCop
211
214
  @cached_run ||=
212
215
  (@options[:cache] == 'true' ||
213
216
  @options[:cache] != 'false' &&
214
- @config_store.for(Dir.pwd).for_all_cops['UseCache']) &&
217
+ @config_store.for_dir(Dir.pwd).for_all_cops['UseCache']) &&
215
218
  # When running --auto-gen-config, there's some processing done in the
216
219
  # cops related to calculating the Max parameters for Metrics cops. We
217
220
  # need to do that processing and cannot use caching.
@@ -291,8 +294,8 @@ module RuboCop
291
294
  end
292
295
 
293
296
  def inspect_file(processed_source)
294
- config = @config_store.for(processed_source.path)
295
- team = Cop::Team.new(mobilized_cop_classes(config), config, @options)
297
+ config = @config_store.for_file(processed_source.path)
298
+ team = Cop::Team.mobilize(mobilized_cop_classes(config), config, @options)
296
299
  offenses = team.inspect_file(processed_source)
297
300
  @errors.concat(team.errors)
298
301
  @warnings.concat(team.warnings)
@@ -357,12 +360,16 @@ module RuboCop
357
360
  end
358
361
 
359
362
  def get_processed_source(file)
360
- ruby_version = @config_store.for(file).target_ruby_version
363
+ ruby_version = @config_store.for_file(file).target_ruby_version
361
364
 
362
365
  if @options[:stdin]
363
366
  ProcessedSource.new(@options[:stdin], ruby_version, file)
364
367
  else
365
- ProcessedSource.from_file(file, ruby_version)
368
+ begin
369
+ ProcessedSource.from_file(file, ruby_version)
370
+ rescue Errno::ENOENT
371
+ raise RuboCop::Error, "No such file or directory: #{file}"
372
+ end
366
373
  end
367
374
  end
368
375
 
@@ -373,7 +380,7 @@ module RuboCop
373
380
  def standby_team(config)
374
381
  @team_by_config ||= {}
375
382
  @team_by_config[config.object_id] ||=
376
- Cop::Team.new(mobilized_cop_classes(config), config, @options)
383
+ Cop::Team.mobilize(mobilized_cop_classes(config), config, @options)
377
384
  end
378
385
  end
379
386
  end
@@ -27,7 +27,7 @@ module RuboCop
27
27
  # (if any). If args is empty, recursively find all Ruby source
28
28
  # files under the current directory
29
29
  # @return [Array] array of file paths
30
- def find(args)
30
+ def find(args, mode)
31
31
  return target_files_in_dir if args.empty?
32
32
 
33
33
  files = []
@@ -36,7 +36,7 @@ module RuboCop
36
36
  files += if File.directory?(arg)
37
37
  target_files_in_dir(arg.chomp(File::SEPARATOR))
38
38
  else
39
- process_explicit_path(arg)
39
+ process_explicit_path(arg, mode)
40
40
  end
41
41
  end
42
42
 
@@ -54,9 +54,7 @@ module RuboCop
54
54
  # @return [Array] Array of filenames
55
55
  def target_files_in_dir(base_dir = Dir.pwd)
56
56
  # Support Windows: Backslashes from command-line -> forward slashes
57
- if File::ALT_SEPARATOR
58
- base_dir = base_dir.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
59
- end
57
+ base_dir = base_dir.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
60
58
  all_files = find_files(base_dir, File::FNM_DOTMATCH)
61
59
  hidden_files = Set.new(all_files - find_files(base_dir, 0))
62
60
  base_dir_config = @config_store.for(base_dir)
@@ -141,7 +139,7 @@ module RuboCop
141
139
  return false unless File.extname(file).empty? && File.exist?(file)
142
140
 
143
141
  first_line = File.open(file, &:readline)
144
- !(first_line =~ /#!.*(#{ruby_interpreters(file).join('|')})/).nil?
142
+ /#!.*(#{ruby_interpreters(file).join('|')})/.match?(first_line)
145
143
  rescue EOFError, ArgumentError => e
146
144
  warn("Unprocessable file #{file}: #{e.class}, #{e.message}") if debug?
147
145
 
@@ -169,10 +167,12 @@ module RuboCop
169
167
  ruby_file?(file) || configured_include?(file)
170
168
  end
171
169
 
172
- def process_explicit_path(path)
170
+ def process_explicit_path(path, mode)
173
171
  files = path.include?('*') ? Dir[path] : [path]
174
172
 
175
- files.select! { |file| included_file?(file) }
173
+ if mode == :only_recognized_file_types || force_exclusion?
174
+ files.select! { |file| included_file?(file) }
175
+ end
176
176
 
177
177
  return files unless force_exclusion?
178
178
 
@@ -7,7 +7,7 @@ module RuboCop
7
7
  DEFAULT_VERSION = KNOWN_RUBIES.first
8
8
 
9
9
  OBSOLETE_RUBIES = {
10
- 1.9 => '0.50', 2.0 => '0.50', 2.1 => '0.58', 2.2 => '0.69', 2.3 => '0.82'
10
+ 1.9 => '0.41', 2.0 => '0.50', 2.1 => '0.57', 2.2 => '0.68', 2.3 => '0.81'
11
11
  }.freeze
12
12
  private_constant :KNOWN_RUBIES, :OBSOLETE_RUBIES
13
13
 
@@ -52,7 +52,10 @@ module RuboCop
52
52
  file = ruby_version_file
53
53
  return unless file && File.file?(file)
54
54
 
55
+ # rubocop:disable Lint/MixedRegexpCaptureTypes
56
+ # `(ruby-)` is not a capture type.
55
57
  File.read(file).match(/\A(ruby-)?(?<version>\d+\.\d+)/) do |md|
58
+ # rubocop:enable Lint/MixedRegexpCaptureTypes
56
59
  md[:version].to_f
57
60
  end
58
61
  end
@@ -3,14 +3,16 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '0.82.0'
6
+ STRING = '0.86.0'
7
7
 
8
- MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
9
- '%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'
8
+ MSG = '%<version>s (using Parser %<parser_version>s, '\
9
+ 'rubocop-ast %<rubocop_ast_version>s, ' \
10
+ 'running on %<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'
10
11
 
11
12
  def self.version(debug = false)
12
13
  if debug
13
14
  format(MSG, version: STRING, parser_version: Parser::VERSION,
15
+ rubocop_ast_version: RuboCop::AST::Version::STRING,
14
16
  ruby_engine: RUBY_ENGINE, ruby_version: RUBY_VERSION,
15
17
  ruby_platform: RUBY_PLATFORM)
16
18
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.82.0
4
+ version: 0.86.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,22 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-04-16 00:00:00.000000000 Z
13
+ date: 2020-06-22 00:00:00.000000000 Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: jaro_winkler
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: 1.5.1
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: 1.5.1
29
15
  - !ruby/object:Gem::Dependency
30
16
  name: parallel
31
17
  requirement: !ruby/object:Gem::Requirement
@@ -74,6 +60,20 @@ dependencies:
74
60
  - - "<"
75
61
  - !ruby/object:Gem::Version
76
62
  version: '4.0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: regexp_parser
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '1.7'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '1.7'
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: rexml
79
79
  requirement: !ruby/object:Gem::Requirement
@@ -88,6 +88,26 @@ dependencies:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
+ - !ruby/object:Gem::Dependency
92
+ name: rubocop-ast
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 0.0.3
98
+ - - "<"
99
+ - !ruby/object:Gem::Version
100
+ version: '1.0'
101
+ type: :runtime
102
+ prerelease: false
103
+ version_requirements: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: 0.0.3
108
+ - - "<"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
91
111
  - !ruby/object:Gem::Dependency
92
112
  name: ruby-progressbar
93
113
  requirement: !ruby/object:Gem::Requirement
@@ -143,8 +163,8 @@ dependencies:
143
163
  - !ruby/object:Gem::Version
144
164
  version: '3.0'
145
165
  description: |2
146
- Automatic Ruby code style checking tool.
147
- Aims to enforce the community-driven Ruby Style Guide.
166
+ RuboCop is a Ruby code style checking and code formatting tool.
167
+ It aims to enforce the community-driven Ruby Style Guide.
148
168
  email: rubocop@googlegroups.com
149
169
  executables:
150
170
  - rubocop
@@ -162,57 +182,7 @@ files:
162
182
  - config/default.yml
163
183
  - exe/rubocop
164
184
  - lib/rubocop.rb
165
- - lib/rubocop/ast/builder.rb
166
- - lib/rubocop/ast/node.rb
167
- - lib/rubocop/ast/node/alias_node.rb
168
- - lib/rubocop/ast/node/and_node.rb
169
- - lib/rubocop/ast/node/args_node.rb
170
- - lib/rubocop/ast/node/array_node.rb
171
- - lib/rubocop/ast/node/block_node.rb
172
- - lib/rubocop/ast/node/break_node.rb
173
- - lib/rubocop/ast/node/case_match_node.rb
174
- - lib/rubocop/ast/node/case_node.rb
175
- - lib/rubocop/ast/node/class_node.rb
176
- - lib/rubocop/ast/node/def_node.rb
177
- - lib/rubocop/ast/node/defined_node.rb
178
- - lib/rubocop/ast/node/ensure_node.rb
179
- - lib/rubocop/ast/node/float_node.rb
180
- - lib/rubocop/ast/node/for_node.rb
181
- - lib/rubocop/ast/node/forward_args_node.rb
182
- - lib/rubocop/ast/node/hash_node.rb
183
- - lib/rubocop/ast/node/if_node.rb
184
- - lib/rubocop/ast/node/int_node.rb
185
- - lib/rubocop/ast/node/keyword_splat_node.rb
186
- - lib/rubocop/ast/node/mixin/basic_literal_node.rb
187
- - lib/rubocop/ast/node/mixin/binary_operator_node.rb
188
- - lib/rubocop/ast/node/mixin/collection_node.rb
189
- - lib/rubocop/ast/node/mixin/conditional_node.rb
190
- - lib/rubocop/ast/node/mixin/hash_element_node.rb
191
- - lib/rubocop/ast/node/mixin/method_dispatch_node.rb
192
- - lib/rubocop/ast/node/mixin/method_identifier_predicates.rb
193
- - lib/rubocop/ast/node/mixin/modifier_node.rb
194
- - lib/rubocop/ast/node/mixin/numeric_node.rb
195
- - lib/rubocop/ast/node/mixin/parameterized_node.rb
196
- - lib/rubocop/ast/node/mixin/predicate_operator_node.rb
197
- - lib/rubocop/ast/node/module_node.rb
198
- - lib/rubocop/ast/node/or_node.rb
199
- - lib/rubocop/ast/node/pair_node.rb
200
- - lib/rubocop/ast/node/range_node.rb
201
- - lib/rubocop/ast/node/regexp_node.rb
202
- - lib/rubocop/ast/node/resbody_node.rb
203
- - lib/rubocop/ast/node/retry_node.rb
204
- - lib/rubocop/ast/node/return_node.rb
205
- - lib/rubocop/ast/node/self_class_node.rb
206
- - lib/rubocop/ast/node/send_node.rb
207
- - lib/rubocop/ast/node/str_node.rb
208
- - lib/rubocop/ast/node/super_node.rb
209
- - lib/rubocop/ast/node/symbol_node.rb
210
- - lib/rubocop/ast/node/until_node.rb
211
- - lib/rubocop/ast/node/when_node.rb
212
- - lib/rubocop/ast/node/while_node.rb
213
- - lib/rubocop/ast/node/yield_node.rb
214
- - lib/rubocop/ast/sexp.rb
215
- - lib/rubocop/ast/traversal.rb
185
+ - lib/rubocop/ast_aliases.rb
216
186
  - lib/rubocop/cached_data.rb
217
187
  - lib/rubocop/cli.rb
218
188
  - lib/rubocop/cli/command.rb
@@ -293,6 +263,7 @@ files:
293
263
  - lib/rubocop/cop/layout/empty_lines.rb
294
264
  - lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb
295
265
  - lib/rubocop/cop/layout/empty_lines_around_arguments.rb
266
+ - lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb
296
267
  - lib/rubocop/cop/layout/empty_lines_around_begin_body.rb
297
268
  - lib/rubocop/cop/layout/empty_lines_around_block_body.rb
298
269
  - lib/rubocop/cop/layout/empty_lines_around_class_body.rb
@@ -367,8 +338,10 @@ files:
367
338
  - lib/rubocop/cop/lint/big_decimal_new.rb
368
339
  - lib/rubocop/cop/lint/boolean_symbol.rb
369
340
  - lib/rubocop/cop/lint/circular_argument_reference.rb
341
+ - lib/rubocop/cop/lint/constant_resolution.rb
370
342
  - lib/rubocop/cop/lint/debugger.rb
371
343
  - lib/rubocop/cop/lint/deprecated_class_methods.rb
344
+ - lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb
372
345
  - lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb
373
346
  - lib/rubocop/cop/lint/duplicate_case_condition.rb
374
347
  - lib/rubocop/cop/lint/duplicate_hash_key.rb
@@ -393,6 +366,7 @@ files:
393
366
  - lib/rubocop/cop/lint/literal_in_interpolation.rb
394
367
  - lib/rubocop/cop/lint/loop.rb
395
368
  - lib/rubocop/cop/lint/missing_cop_enable_directive.rb
369
+ - lib/rubocop/cop/lint/mixed_regexp_capture_types.rb
396
370
  - lib/rubocop/cop/lint/multiple_comparison.rb
397
371
  - lib/rubocop/cop/lint/nested_method_definition.rb
398
372
  - lib/rubocop/cop/lint/nested_percent_literal.rb
@@ -454,6 +428,7 @@ files:
454
428
  - lib/rubocop/cop/metrics/parameter_lists.rb
455
429
  - lib/rubocop/cop/metrics/perceived_complexity.rb
456
430
  - lib/rubocop/cop/metrics/utils/abc_size_calculator.rb
431
+ - lib/rubocop/cop/metrics/utils/iterating_block.rb
457
432
  - lib/rubocop/cop/migration/department_name.rb
458
433
  - lib/rubocop/cop/mixin/alignment.rb
459
434
  - lib/rubocop/cop/mixin/annotation_comment.rb
@@ -505,6 +480,7 @@ files:
505
480
  - lib/rubocop/cop/mixin/preferred_delimiters.rb
506
481
  - lib/rubocop/cop/mixin/range_help.rb
507
482
  - lib/rubocop/cop/mixin/rational_literal.rb
483
+ - lib/rubocop/cop/mixin/regexp_literal_help.rb
508
484
  - lib/rubocop/cop/mixin/rescue_node.rb
509
485
  - lib/rubocop/cop/mixin/safe_assignment.rb
510
486
  - lib/rubocop/cop/mixin/space_after_punctuation.rb
@@ -668,10 +644,13 @@ files:
668
644
  - lib/rubocop/cop/style/redundant_condition.rb
669
645
  - lib/rubocop/cop/style/redundant_conditional.rb
670
646
  - lib/rubocop/cop/style/redundant_exception.rb
647
+ - lib/rubocop/cop/style/redundant_fetch_block.rb
671
648
  - lib/rubocop/cop/style/redundant_freeze.rb
672
649
  - lib/rubocop/cop/style/redundant_interpolation.rb
673
650
  - lib/rubocop/cop/style/redundant_parentheses.rb
674
651
  - lib/rubocop/cop/style/redundant_percent_q.rb
652
+ - lib/rubocop/cop/style/redundant_regexp_character_class.rb
653
+ - lib/rubocop/cop/style/redundant_regexp_escape.rb
675
654
  - lib/rubocop/cop/style/redundant_return.rb
676
655
  - lib/rubocop/cop/style/redundant_self.rb
677
656
  - lib/rubocop/cop/style/redundant_sort.rb
@@ -688,6 +667,7 @@ files:
688
667
  - lib/rubocop/cop/style/signal_exception.rb
689
668
  - lib/rubocop/cop/style/single_line_block_params.rb
690
669
  - lib/rubocop/cop/style/single_line_methods.rb
670
+ - lib/rubocop/cop/style/slicing_with_range.rb
691
671
  - lib/rubocop/cop/style/special_global_vars.rb
692
672
  - lib/rubocop/cop/style/stabby_lambda_parentheses.rb
693
673
  - lib/rubocop/cop/style/stderr_puts.rb
@@ -733,6 +713,7 @@ files:
733
713
  - lib/rubocop/cop/variable_force/variable_table.rb
734
714
  - lib/rubocop/core_ext/string.rb
735
715
  - lib/rubocop/error.rb
716
+ - lib/rubocop/ext/processed_source.rb
736
717
  - lib/rubocop/file_finder.rb
737
718
  - lib/rubocop/formatter/auto_gen_config_formatter.rb
738
719
  - lib/rubocop/formatter/base_formatter.rb
@@ -756,11 +737,9 @@ files:
756
737
  - lib/rubocop/formatter/worst_offenders_formatter.rb
757
738
  - lib/rubocop/magic_comment.rb
758
739
  - lib/rubocop/name_similarity.rb
759
- - lib/rubocop/node_pattern.rb
760
740
  - lib/rubocop/options.rb
761
741
  - lib/rubocop/path_util.rb
762
742
  - lib/rubocop/platform.rb
763
- - lib/rubocop/processed_source.rb
764
743
  - lib/rubocop/rake_task.rb
765
744
  - lib/rubocop/remote_config.rb
766
745
  - lib/rubocop/result_cache.rb
@@ -771,10 +750,8 @@ files:
771
750
  - lib/rubocop/rspec/support.rb
772
751
  - lib/rubocop/runner.rb
773
752
  - lib/rubocop/string_interpreter.rb
774
- - lib/rubocop/string_util.rb
775
753
  - lib/rubocop/target_finder.rb
776
754
  - lib/rubocop/target_ruby.rb
777
- - lib/rubocop/token.rb
778
755
  - lib/rubocop/version.rb
779
756
  - lib/rubocop/warning.rb
780
757
  - lib/rubocop/yaml_duplication_checker.rb
@@ -782,7 +759,7 @@ homepage: https://github.com/rubocop-hq/rubocop
782
759
  licenses:
783
760
  - MIT
784
761
  metadata:
785
- homepage_uri: https://www.rubocop.org/
762
+ homepage_uri: https://rubocop.org/
786
763
  changelog_uri: https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md
787
764
  source_code_uri: https://github.com/rubocop-hq/rubocop/
788
765
  documentation_uri: https://docs.rubocop.org/