rubocop 1.46.0 → 1.47.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +7 -0
  4. data/lib/rubocop/cli/command/auto_generate_config.rb +7 -0
  5. data/lib/rubocop/comment_config.rb +2 -0
  6. data/lib/rubocop/cop/autocorrect_logic.rb +1 -1
  7. data/lib/rubocop/cop/base.rb +1 -1
  8. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  9. data/lib/rubocop/cop/corrector.rb +1 -1
  10. data/lib/rubocop/cop/correctors/alignment_corrector.rb +2 -2
  11. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +3 -3
  12. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +3 -3
  13. data/lib/rubocop/cop/correctors/line_break_corrector.rb +1 -1
  14. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +2 -2
  15. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -1
  16. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +1 -1
  17. data/lib/rubocop/cop/internal_affairs/cop_description.rb +4 -4
  18. data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +1 -1
  19. data/lib/rubocop/cop/internal_affairs/location_expression.rb +37 -0
  20. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -1
  21. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
  22. data/lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb +1 -1
  23. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
  24. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
  25. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +39 -0
  26. data/lib/rubocop/cop/internal_affairs.rb +2 -0
  27. data/lib/rubocop/cop/layout/block_end_newline.rb +4 -4
  28. data/lib/rubocop/cop/layout/class_structure.rb +5 -3
  29. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -1
  30. data/lib/rubocop/cop/layout/empty_comment.rb +3 -3
  31. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +1 -1
  32. data/lib/rubocop/cop/layout/first_argument_indentation.rb +1 -1
  33. data/lib/rubocop/cop/layout/heredoc_indentation.rb +2 -2
  34. data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
  35. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +1 -3
  36. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -2
  37. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +2 -2
  38. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
  39. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +1 -1
  40. data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
  41. data/lib/rubocop/cop/lint/constant_resolution.rb +1 -1
  42. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
  43. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +1 -1
  44. data/lib/rubocop/cop/lint/duplicate_methods.rb +2 -2
  45. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -3
  46. data/lib/rubocop/cop/lint/else_layout.rb +1 -1
  47. data/lib/rubocop/cop/lint/empty_block.rb +1 -1
  48. data/lib/rubocop/cop/lint/empty_conditional_body.rb +4 -2
  49. data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
  50. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
  51. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +46 -4
  52. data/lib/rubocop/cop/lint/missing_super.rb +31 -2
  53. data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
  54. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  55. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +3 -3
  56. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +5 -5
  57. data/lib/rubocop/cop/lint/redundant_require_statement.rb +1 -1
  58. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
  59. data/lib/rubocop/cop/lint/redundant_with_index.rb +1 -1
  60. data/lib/rubocop/cop/lint/redundant_with_object.rb +1 -1
  61. data/lib/rubocop/cop/lint/rescue_type.rb +3 -3
  62. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +1 -1
  63. data/lib/rubocop/cop/lint/script_permission.rb +1 -1
  64. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
  65. data/lib/rubocop/cop/lint/useless_times.rb +1 -1
  66. data/lib/rubocop/cop/metrics/collection_literal_length.rb +76 -0
  67. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +2 -2
  68. data/lib/rubocop/cop/migration/department_name.rb +1 -1
  69. data/lib/rubocop/cop/mixin/annotation_comment.rb +1 -1
  70. data/lib/rubocop/cop/mixin/code_length.rb +1 -1
  71. data/lib/rubocop/cop/mixin/comments_help.rb +2 -2
  72. data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
  73. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +1 -1
  74. data/lib/rubocop/cop/mixin/hash_transform_method.rb +3 -3
  75. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  76. data/lib/rubocop/cop/mixin/range_help.rb +1 -6
  77. data/lib/rubocop/cop/mixin/statement_modifier.rb +2 -2
  78. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  79. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
  80. data/lib/rubocop/cop/naming/method_name.rb +1 -1
  81. data/lib/rubocop/cop/naming/predicate_name.rb +1 -1
  82. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +1 -1
  83. data/lib/rubocop/cop/style/accessor_grouping.rb +10 -1
  84. data/lib/rubocop/cop/style/arguments_forwarding.rb +3 -3
  85. data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
  86. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +1 -1
  87. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  88. data/lib/rubocop/cop/style/block_delimiters.rb +2 -2
  89. data/lib/rubocop/cop/style/case_like_if.rb +1 -1
  90. data/lib/rubocop/cop/style/collection_compact.rb +1 -1
  91. data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
  92. data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
  93. data/lib/rubocop/cop/style/concat_array_literals.rb +10 -2
  94. data/lib/rubocop/cop/style/conditional_assignment.rb +6 -6
  95. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
  96. data/lib/rubocop/cop/style/documentation.rb +1 -1
  97. data/lib/rubocop/cop/style/each_with_object.rb +1 -1
  98. data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
  99. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
  100. data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
  101. data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -1
  102. data/lib/rubocop/cop/style/file_read.rb +1 -1
  103. data/lib/rubocop/cop/style/file_write.rb +1 -1
  104. data/lib/rubocop/cop/style/guard_clause.rb +1 -1
  105. data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
  106. data/lib/rubocop/cop/style/if_unless_modifier.rb +34 -0
  107. data/lib/rubocop/cop/style/inverse_methods.rb +5 -5
  108. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +2 -2
  109. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +1 -1
  110. data/lib/rubocop/cop/style/min_max.rb +3 -3
  111. data/lib/rubocop/cop/style/mixin_grouping.rb +4 -4
  112. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
  113. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -1
  114. data/lib/rubocop/cop/style/negated_if_else_condition.rb +1 -1
  115. data/lib/rubocop/cop/style/nil_lambda.rb +2 -2
  116. data/lib/rubocop/cop/style/redundant_condition.rb +2 -2
  117. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +2 -2
  118. data/lib/rubocop/cop/style/redundant_interpolation.rb +2 -2
  119. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +10 -3
  120. data/lib/rubocop/cop/style/redundant_sort.rb +3 -3
  121. data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -2
  122. data/lib/rubocop/cop/style/require_order.rb +1 -3
  123. data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
  124. data/lib/rubocop/cop/style/safe_navigation.rb +2 -2
  125. data/lib/rubocop/cop/style/sole_nested_conditional.rb +2 -2
  126. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  127. data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
  128. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -1
  129. data/lib/rubocop/cop/style/unpack_first.rb +3 -3
  130. data/lib/rubocop/cop/style/yoda_condition.rb +1 -1
  131. data/lib/rubocop/cop/style/zero_length_predicate.rb +9 -5
  132. data/lib/rubocop/cop/util.rb +1 -1
  133. data/lib/rubocop/cop/variable_force/variable.rb +5 -3
  134. data/lib/rubocop/directive_comment.rb +3 -3
  135. data/lib/rubocop/ext/comment.rb +18 -0
  136. data/lib/rubocop/version.rb +1 -1
  137. data/lib/rubocop.rb +2 -0
  138. metadata +7 -3
@@ -97,7 +97,7 @@ module RuboCop
97
97
  end
98
98
 
99
99
  def autocorrect_variable_interpolation(corrector, embedded_node, node)
100
- replacement = "#{embedded_node.loc.expression.source}.to_s"
100
+ replacement = "#{embedded_node.source}.to_s"
101
101
 
102
102
  corrector.replace(node, replacement)
103
103
  end
@@ -107,7 +107,7 @@ module RuboCop
107
107
 
108
108
  source = if require_parentheses?(embedded_var)
109
109
  receiver = range_between(
110
- embedded_var.loc.expression.begin_pos, embedded_var.loc.selector.end_pos
110
+ embedded_var.source_range.begin_pos, embedded_var.loc.selector.end_pos
111
111
  )
112
112
  arguments = embedded_var.arguments.map(&:source).join(', ')
113
113
 
@@ -74,11 +74,18 @@ module RuboCop
74
74
 
75
75
  def char_class_begins_or_ends_with_escaped_hyphen?(node, index)
76
76
  # The hyphen character is allowed to be escaped within a character class
77
- # but it's not necessry to escape hyphen if it's the first or last character
77
+ # but it's not necessary to escape hyphen if it's the first or last character
78
78
  # within the character class. This method checks if that's the case.
79
79
  # e.g. "[0-9\\-]" or "[\\-0-9]" would return true
80
- contents_range(node).source[index - 1] == '[' ||
81
- contents_range(node).source[index + 2] == ']'
80
+ content = contents_range(node).source
81
+
82
+ if content[index + 2] == ']'
83
+ true
84
+ elsif content[index - 1] == '['
85
+ index < 2 || content[index - 2] != '\\'
86
+ else
87
+ false
88
+ end
82
89
  end
83
90
 
84
91
  def delimiter?(node, char)
@@ -129,13 +129,13 @@ module RuboCop
129
129
  end
130
130
 
131
131
  def offense_range(sort_node, node)
132
- range_between(sort_node.loc.selector.begin_pos, node.loc.expression.end_pos)
132
+ range_between(sort_node.loc.selector.begin_pos, node.source_range.end_pos)
133
133
  end
134
134
 
135
135
  def message(node, sorter, accessor)
136
136
  accessor_source = range_between(
137
137
  node.loc.selector.begin_pos,
138
- node.loc.expression.end_pos
138
+ node.source_range.end_pos
139
139
  ).source
140
140
 
141
141
  format(MSG,
@@ -146,7 +146,7 @@ module RuboCop
146
146
 
147
147
  def autocorrect(corrector, node, sort_node, sorter, accessor)
148
148
  # Remove accessor, e.g. `first` or `[-1]`.
149
- corrector.remove(range_between(accessor_start(node), node.loc.expression.end_pos))
149
+ corrector.remove(range_between(accessor_start(node), node.source_range.end_pos))
150
150
  # Replace "sort" or "sort_by" with the appropriate min/max method.
151
151
  corrector.replace(sort_node.loc.selector, suggestion(sorter, accessor, arg_value(node)))
152
152
  # Replace to avoid syntax errors when followed by a logical operator.
@@ -67,7 +67,7 @@ module RuboCop
67
67
  elsif begin_loc_present?(node)
68
68
  contents_range(node)
69
69
  else
70
- node.loc.expression
70
+ node.source_range
71
71
  end
72
72
  end
73
73
 
@@ -139,7 +139,7 @@ module RuboCop
139
139
 
140
140
  def heredoc_with_disabled_interpolation?(node)
141
141
  if heredoc?(node)
142
- node.loc.expression.source.end_with?("'")
142
+ node.source.end_with?("'")
143
143
  elsif node.parent&.dstr_type?
144
144
  heredoc_with_disabled_interpolation?(node.parent)
145
145
  else
@@ -125,9 +125,7 @@ module RuboCop
125
125
  end
126
126
 
127
127
  def in_same_section?(node1, node2)
128
- !node1.location.expression.with(
129
- end_pos: node2.location.expression.end_pos
130
- ).source.include?("\n\n")
128
+ !node1.source_range.with(end_pos: node2.source_range.end_pos).source.include?("\n\n")
131
129
  end
132
130
  end
133
131
  end
@@ -105,11 +105,11 @@ module RuboCop
105
105
  private
106
106
 
107
107
  def offense_for_implicit_enforced_style(node, error)
108
- range = node.loc.keyword.join(error.loc.expression)
108
+ range = node.loc.keyword.join(error.source_range)
109
109
 
110
110
  add_offense(range, message: MSG_IMPLICIT) do |corrector|
111
111
  error = rescue_standard_error?(node)
112
- range = range_between(node.loc.keyword.end_pos, error.loc.expression.end_pos)
112
+ range = range_between(node.loc.keyword.end_pos, error.source_range.end_pos)
113
113
 
114
114
  corrector.remove(range)
115
115
  end
@@ -297,11 +297,11 @@ module RuboCop
297
297
  end
298
298
 
299
299
  def begin_range(node, method_call)
300
- range_between(node.loc.expression.begin_pos, method_call.loc.expression.begin_pos)
300
+ range_between(node.source_range.begin_pos, method_call.source_range.begin_pos)
301
301
  end
302
302
 
303
303
  def end_range(node, method_call)
304
- range_between(method_call.loc.expression.end_pos, node.loc.expression.end_pos)
304
+ range_between(method_call.source_range.end_pos, node.source_range.end_pos)
305
305
  end
306
306
 
307
307
  def add_safe_nav_to_all_methods_in_chain(corrector,
@@ -167,7 +167,7 @@ module RuboCop
167
167
  corrector.insert_before(condition,
168
168
  "#{'!' if node.unless?}#{replace_condition(node.condition)} && ")
169
169
 
170
- corrector.remove(node.condition.loc.expression)
170
+ corrector.remove(node.condition.source_range)
171
171
  corrector.remove(range_with_surrounding_space(node.loc.keyword, newlines: false))
172
172
  corrector.replace(if_branch.loc.keyword, 'if')
173
173
  end
@@ -240,7 +240,7 @@ module RuboCop
240
240
  end
241
241
 
242
242
  def outer_condition_modify_form?(node, if_branch)
243
- node.condition.loc.expression.begin_pos > if_branch.condition.loc.expression.begin_pos
243
+ node.condition.source_range.begin_pos > if_branch.condition.source_range.begin_pos
244
244
  end
245
245
  end
246
246
  end
@@ -49,7 +49,7 @@ module RuboCop
49
49
  end
50
50
 
51
51
  def stderr_puts_range(send)
52
- range_between(send.loc.expression.begin_pos, send.loc.selector.end_pos)
52
+ range_between(send.source_range.begin_pos, send.loc.selector.end_pos)
53
53
  end
54
54
  end
55
55
  end
@@ -55,7 +55,7 @@ module RuboCop
55
55
  elsif (class_node = parent.parent).body.nil?
56
56
  corrector.remove(range_for_empty_class_body(class_node, parent))
57
57
  else
58
- corrector.insert_after(parent.loc.expression, ' do')
58
+ corrector.insert_after(parent.source_range, ' do')
59
59
  end
60
60
  end
61
61
 
@@ -144,7 +144,7 @@ module RuboCop
144
144
  end
145
145
 
146
146
  def range_for_parentheses(offense, left)
147
- range_between(offense.source_range.begin_pos - 1, left.loc.expression.end_pos - 1)
147
+ range_between(offense.source_range.begin_pos - 1, left.source_range.end_pos - 1)
148
148
  end
149
149
  end
150
150
  end
@@ -52,9 +52,9 @@ module RuboCop
52
52
  private
53
53
 
54
54
  def first_element_range(node, unpack_call)
55
- Parser::Source::Range.new(node.loc.expression.source_buffer,
56
- unpack_call.loc.expression.end_pos,
57
- node.loc.expression.end_pos)
55
+ Parser::Source::Range.new(node.source_range.source_buffer,
56
+ unpack_call.source_range.end_pos,
57
+ node.source_range.end_pos)
58
58
  end
59
59
  end
60
60
  end
@@ -145,7 +145,7 @@ module RuboCop
145
145
  end
146
146
 
147
147
  def actual_code_range(node)
148
- range_between(node.loc.expression.begin_pos, node.loc.expression.end_pos)
148
+ range_between(node.source_range.begin_pos, node.source_range.end_pos)
149
149
  end
150
150
 
151
151
  def reverse_comparison(operator)
@@ -4,10 +4,13 @@ module RuboCop
4
4
  module Cop
5
5
  module Style
6
6
  # Checks for numeric comparisons that can be replaced
7
- # by a predicate method, such as receiver.length == 0,
8
- # receiver.length > 0, receiver.length != 0,
9
- # receiver.length < 1 and receiver.size == 0 that can be
10
- # replaced by receiver.empty? and !receiver.empty?.
7
+ # by a predicate method, such as `receiver.length == 0`,
8
+ # `receiver.length > 0`, and `receiver.length != 0`,
9
+ # `receiver.length < 1` and `receiver.size == 0` that can be
10
+ # replaced by `receiver.empty?` and `!receiver.empty?`.
11
+ #
12
+ # NOTE: `File`, `Tempfile`, and `StringIO` do not have `empty?`
13
+ # so allow `size == 0` and `size.zero?`.
11
14
  #
12
15
  # @safety
13
16
  # This cop is unsafe because it cannot be guaranteed that the receiver
@@ -49,6 +52,7 @@ module RuboCop
49
52
 
50
53
  def check_zero_length_predicate(node)
51
54
  return unless (length_method = zero_length_predicate(node.parent))
55
+ return if non_polymorphic_collection?(node.parent)
52
56
 
53
57
  offense = node.loc.selector.join(node.parent.source_range.end)
54
58
  message = format(ZERO_MSG, current: "#{length_method}.zero?")
@@ -134,7 +138,7 @@ module RuboCop
134
138
  # @!method non_polymorphic_collection?(node)
135
139
  def_node_matcher :non_polymorphic_collection?, <<~PATTERN
136
140
  {(send (send (send (const {nil? cbase} :File) :stat _) ...) ...)
137
- (send (send (send (const {nil? cbase} {:Tempfile :StringIO}) {:new :open} ...) ...) ...)}
141
+ (send (send (send (const {nil? cbase} {:File :Tempfile :StringIO}) {:new :open} ...) ...) ...)}
138
142
  PATTERN
139
143
  end
140
144
  end
@@ -81,7 +81,7 @@ module RuboCop
81
81
  end
82
82
 
83
83
  def args_end(node)
84
- node.loc.expression.end
84
+ node.source_range.end
85
85
  end
86
86
 
87
87
  def on_node(syms, sexp, excludes = [], &block)
@@ -52,7 +52,7 @@ module RuboCop
52
52
  # if/unless keyword. A preceding assignment is needed to put the
53
53
  # variable in scope. For this reason we skip to the next assignment
54
54
  # here.
55
- next if in_modifier_if?(assignment)
55
+ next if in_modifier_conditional?(assignment)
56
56
 
57
57
  break if !assignment.branch || assignment.branch == reference.branch
58
58
 
@@ -63,10 +63,12 @@ module RuboCop
63
63
  end
64
64
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
65
65
 
66
- def in_modifier_if?(assignment)
66
+ def in_modifier_conditional?(assignment)
67
67
  parent = assignment.node.parent
68
68
  parent = parent.parent if parent&.begin_type?
69
- parent&.if_type? && parent&.modifier_form?
69
+ return false if parent.nil?
70
+
71
+ (parent.if_type? || parent.while_type? || parent.until_type?) && parent.modifier_form?
70
72
  end
71
73
 
72
74
  def capture_with_block!
@@ -45,9 +45,9 @@ module RuboCop
45
45
 
46
46
  def range
47
47
  match = comment.text.match(DIRECTIVE_COMMENT_REGEXP)
48
- begin_pos = comment.loc.expression.begin_pos
48
+ begin_pos = comment.source_range.begin_pos
49
49
  Parser::Source::Range.new(
50
- comment.loc.expression.source_buffer, begin_pos + match.begin(0), begin_pos + match.end(0)
50
+ comment.source_range.source_buffer, begin_pos + match.begin(0), begin_pos + match.end(0)
51
51
  )
52
52
  end
53
53
 
@@ -108,7 +108,7 @@ module RuboCop
108
108
 
109
109
  # Returns line number for directive
110
110
  def line_number
111
- comment.loc.expression.line
111
+ comment.source_range.line
112
112
  end
113
113
 
114
114
  private
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Ext
5
+ # Extensions to `Parser::Source::Comment`.
6
+ module Comment
7
+ def source
8
+ loc.expression.source
9
+ end
10
+
11
+ def source_range
12
+ loc.expression
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ Parser::Source::Comment.include RuboCop::Ext::Comment
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.46.0'
6
+ STRING = '1.47.0'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, ' \
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
data/lib/rubocop.rb CHANGED
@@ -14,6 +14,7 @@ require_relative 'rubocop/version'
14
14
  require 'rubocop-ast'
15
15
 
16
16
  require_relative 'rubocop/ast_aliases'
17
+ require_relative 'rubocop/ext/comment'
17
18
  require_relative 'rubocop/ext/range'
18
19
  require_relative 'rubocop/ext/regexp_node'
19
20
  require_relative 'rubocop/ext/regexp_parser'
@@ -415,6 +416,7 @@ require_relative 'rubocop/cop/metrics/abc_size'
415
416
  require_relative 'rubocop/cop/metrics/block_length'
416
417
  require_relative 'rubocop/cop/metrics/block_nesting'
417
418
  require_relative 'rubocop/cop/metrics/class_length'
419
+ require_relative 'rubocop/cop/metrics/collection_literal_length'
418
420
  require_relative 'rubocop/cop/metrics/method_length'
419
421
  require_relative 'rubocop/cop/metrics/module_length'
420
422
  require_relative 'rubocop/cop/metrics/parameter_lists'
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: 1.46.0
4
+ version: 1.47.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-02-22 00:00:00.000000000 Z
13
+ date: 2023-03-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -273,6 +273,7 @@ files:
273
273
  - lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
274
274
  - lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
275
275
  - lib/rubocop/cop/internal_affairs/lambda_or_proc.rb
276
+ - lib/rubocop/cop/internal_affairs/location_expression.rb
276
277
  - lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb
277
278
  - lib/rubocop/cop/internal_affairs/method_name_end_with.rb
278
279
  - lib/rubocop/cop/internal_affairs/method_name_equal.rb
@@ -288,6 +289,7 @@ files:
288
289
  - lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
289
290
  - lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
290
291
  - lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
292
+ - lib/rubocop/cop/internal_affairs/redundant_source_range.rb
291
293
  - lib/rubocop/cop/internal_affairs/single_line_comparison.rb
292
294
  - lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
293
295
  - lib/rubocop/cop/internal_affairs/undefined_config.rb
@@ -531,6 +533,7 @@ files:
531
533
  - lib/rubocop/cop/metrics/block_length.rb
532
534
  - lib/rubocop/cop/metrics/block_nesting.rb
533
535
  - lib/rubocop/cop/metrics/class_length.rb
536
+ - lib/rubocop/cop/metrics/collection_literal_length.rb
534
537
  - lib/rubocop/cop/metrics/cyclomatic_complexity.rb
535
538
  - lib/rubocop/cop/metrics/method_length.rb
536
539
  - lib/rubocop/cop/metrics/module_length.rb
@@ -903,6 +906,7 @@ files:
903
906
  - lib/rubocop/core_ext/string.rb
904
907
  - lib/rubocop/directive_comment.rb
905
908
  - lib/rubocop/error.rb
909
+ - lib/rubocop/ext/comment.rb
906
910
  - lib/rubocop/ext/processed_source.rb
907
911
  - lib/rubocop/ext/range.rb
908
912
  - lib/rubocop/ext/regexp_node.rb
@@ -981,7 +985,7 @@ metadata:
981
985
  homepage_uri: https://rubocop.org/
982
986
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
983
987
  source_code_uri: https://github.com/rubocop/rubocop/
984
- documentation_uri: https://docs.rubocop.org/rubocop/1.46/
988
+ documentation_uri: https://docs.rubocop.org/rubocop/1.47/
985
989
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
986
990
  rubygems_mfa_required: 'true'
987
991
  post_install_message: