rubocop 1.46.0 → 1.48.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +24 -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/or_assignment_to_constant.rb +2 -0
  54. data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
  55. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  56. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +3 -3
  57. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +5 -5
  58. data/lib/rubocop/cop/lint/redundant_require_statement.rb +1 -1
  59. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
  60. data/lib/rubocop/cop/lint/redundant_with_index.rb +1 -1
  61. data/lib/rubocop/cop/lint/redundant_with_object.rb +1 -1
  62. data/lib/rubocop/cop/lint/rescue_type.rb +3 -3
  63. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +1 -1
  64. data/lib/rubocop/cop/lint/script_permission.rb +1 -1
  65. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
  66. data/lib/rubocop/cop/lint/useless_access_modifier.rb +9 -1
  67. data/lib/rubocop/cop/lint/useless_times.rb +1 -1
  68. data/lib/rubocop/cop/metrics/collection_literal_length.rb +76 -0
  69. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +2 -2
  70. data/lib/rubocop/cop/migration/department_name.rb +1 -1
  71. data/lib/rubocop/cop/mixin/annotation_comment.rb +1 -1
  72. data/lib/rubocop/cop/mixin/code_length.rb +1 -1
  73. data/lib/rubocop/cop/mixin/comments_help.rb +2 -2
  74. data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
  75. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +1 -1
  76. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +3 -2
  77. data/lib/rubocop/cop/mixin/hash_transform_method.rb +3 -3
  78. data/lib/rubocop/cop/mixin/min_branches_count.rb +40 -0
  79. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  80. data/lib/rubocop/cop/mixin/range_help.rb +1 -6
  81. data/lib/rubocop/cop/mixin/statement_modifier.rb +2 -2
  82. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  83. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
  84. data/lib/rubocop/cop/naming/method_name.rb +1 -1
  85. data/lib/rubocop/cop/naming/predicate_name.rb +1 -1
  86. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +1 -1
  87. data/lib/rubocop/cop/registry.rb +3 -1
  88. data/lib/rubocop/cop/style/accessor_grouping.rb +23 -2
  89. data/lib/rubocop/cop/style/arguments_forwarding.rb +3 -3
  90. data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
  91. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +1 -1
  92. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  93. data/lib/rubocop/cop/style/block_delimiters.rb +11 -2
  94. data/lib/rubocop/cop/style/case_like_if.rb +20 -3
  95. data/lib/rubocop/cop/style/collection_compact.rb +1 -1
  96. data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
  97. data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
  98. data/lib/rubocop/cop/style/concat_array_literals.rb +10 -2
  99. data/lib/rubocop/cop/style/conditional_assignment.rb +6 -6
  100. data/lib/rubocop/cop/style/dir_empty.rb +60 -0
  101. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
  102. data/lib/rubocop/cop/style/documentation.rb +10 -4
  103. data/lib/rubocop/cop/style/each_with_object.rb +1 -1
  104. data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
  105. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
  106. data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
  107. data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -1
  108. data/lib/rubocop/cop/style/file_empty.rb +71 -0
  109. data/lib/rubocop/cop/style/file_read.rb +1 -1
  110. data/lib/rubocop/cop/style/file_write.rb +1 -1
  111. data/lib/rubocop/cop/style/guard_clause.rb +1 -1
  112. data/lib/rubocop/cop/style/hash_like_case.rb +3 -9
  113. data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
  114. data/lib/rubocop/cop/style/if_unless_modifier.rb +76 -9
  115. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +2 -0
  116. data/lib/rubocop/cop/style/inverse_methods.rb +5 -5
  117. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +2 -2
  118. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +1 -1
  119. data/lib/rubocop/cop/style/min_max.rb +3 -3
  120. data/lib/rubocop/cop/style/mixin_grouping.rb +4 -4
  121. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
  122. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -1
  123. data/lib/rubocop/cop/style/negated_if_else_condition.rb +12 -7
  124. data/lib/rubocop/cop/style/nil_lambda.rb +2 -2
  125. data/lib/rubocop/cop/style/redundant_condition.rb +2 -2
  126. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +2 -2
  127. data/lib/rubocop/cop/style/redundant_interpolation.rb +2 -2
  128. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +10 -3
  129. data/lib/rubocop/cop/style/redundant_sort.rb +3 -3
  130. data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -2
  131. data/lib/rubocop/cop/style/require_order.rb +1 -3
  132. data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
  133. data/lib/rubocop/cop/style/safe_navigation.rb +2 -2
  134. data/lib/rubocop/cop/style/sole_nested_conditional.rb +2 -2
  135. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  136. data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
  137. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -1
  138. data/lib/rubocop/cop/style/unpack_first.rb +3 -3
  139. data/lib/rubocop/cop/style/yoda_condition.rb +1 -1
  140. data/lib/rubocop/cop/style/zero_length_predicate.rb +9 -5
  141. data/lib/rubocop/cop/team.rb +1 -1
  142. data/lib/rubocop/cop/util.rb +1 -1
  143. data/lib/rubocop/cop/variable_force/variable.rb +5 -3
  144. data/lib/rubocop/directive_comment.rb +3 -3
  145. data/lib/rubocop/ext/comment.rb +18 -0
  146. data/lib/rubocop/formatter/junit_formatter.rb +4 -1
  147. data/lib/rubocop/server/core.rb +1 -1
  148. data/lib/rubocop/version.rb +1 -1
  149. data/lib/rubocop.rb +5 -0
  150. metadata +10 -3
@@ -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
@@ -160,8 +160,8 @@ module RuboCop
160
160
  def roundup_relevant_cops(processed_source)
161
161
  cops.select do |cop|
162
162
  next true if processed_source.comment_config.cop_opted_in?(cop)
163
- next false unless @registry.enabled?(cop, @config)
164
163
  next false if cop.excluded_file?(processed_source.file_path)
164
+ next false unless @registry.enabled?(cop, @config)
165
165
 
166
166
  support_target_ruby_version?(cop) && support_target_rails_version?(cop)
167
167
  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
@@ -62,7 +62,10 @@ module RuboCop
62
62
  end
63
63
 
64
64
  def classname_attribute_value(file)
65
- file.gsub(/\.rb\Z/, '').gsub("#{Dir.pwd}/", '').tr('/', '.')
65
+ @classname_attribute_value_cache ||= Hash.new do |hash, key|
66
+ hash[key] = key.gsub(/\.rb\Z/, '').gsub("#{Dir.pwd}/", '').tr('/', '.')
67
+ end
68
+ @classname_attribute_value_cache[file]
66
69
  end
67
70
 
68
71
  def finished(_inspected_files)
@@ -100,7 +100,7 @@ module RuboCop
100
100
 
101
101
  def use_json_format?
102
102
  return true if ARGV.include?('--format=json') || ARGV.include?('--format=j')
103
- return false unless (index = ARGV.index('--format'))
103
+ return false unless (index = ARGV.index('--format') || ARGV.index('-f'))
104
104
 
105
105
  format = ARGV[index + 1]
106
106
 
@@ -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.48.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'
@@ -101,6 +102,7 @@ require_relative 'rubocop/cop/mixin/hash_shorthand_syntax'
101
102
  require_relative 'rubocop/cop/mixin/method_complexity'
102
103
  require_relative 'rubocop/cop/mixin/method_preference'
103
104
  require_relative 'rubocop/cop/mixin/min_body_length'
105
+ require_relative 'rubocop/cop/mixin/min_branches_count'
104
106
  require_relative 'rubocop/cop/mixin/multiline_element_indentation'
105
107
  require_relative 'rubocop/cop/mixin/multiline_element_line_breaks'
106
108
  require_relative 'rubocop/cop/mixin/multiline_expression_indentation'
@@ -415,6 +417,7 @@ require_relative 'rubocop/cop/metrics/abc_size'
415
417
  require_relative 'rubocop/cop/metrics/block_length'
416
418
  require_relative 'rubocop/cop/metrics/block_nesting'
417
419
  require_relative 'rubocop/cop/metrics/class_length'
420
+ require_relative 'rubocop/cop/metrics/collection_literal_length'
418
421
  require_relative 'rubocop/cop/metrics/method_length'
419
422
  require_relative 'rubocop/cop/metrics/module_length'
420
423
  require_relative 'rubocop/cop/metrics/parameter_lists'
@@ -480,6 +483,7 @@ require_relative 'rubocop/cop/style/copyright'
480
483
  require_relative 'rubocop/cop/style/date_time'
481
484
  require_relative 'rubocop/cop/style/def_with_parentheses'
482
485
  require_relative 'rubocop/cop/style/dir'
486
+ require_relative 'rubocop/cop/style/dir_empty'
483
487
  require_relative 'rubocop/cop/style/disable_cops_within_source_code_directive'
484
488
  require_relative 'rubocop/cop/style/documentation_method'
485
489
  require_relative 'rubocop/cop/style/documentation'
@@ -505,6 +509,7 @@ require_relative 'rubocop/cop/style/expand_path_arguments'
505
509
  require_relative 'rubocop/cop/style/explicit_block_argument'
506
510
  require_relative 'rubocop/cop/style/exponential_notation'
507
511
  require_relative 'rubocop/cop/style/fetch_env_var'
512
+ require_relative 'rubocop/cop/style/file_empty'
508
513
  require_relative 'rubocop/cop/style/file_read'
509
514
  require_relative 'rubocop/cop/style/file_write'
510
515
  require_relative 'rubocop/cop/style/float_division'
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.48.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-06 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
@@ -581,6 +584,7 @@ files:
581
584
  - lib/rubocop/cop/mixin/method_complexity.rb
582
585
  - lib/rubocop/cop/mixin/method_preference.rb
583
586
  - lib/rubocop/cop/mixin/min_body_length.rb
587
+ - lib/rubocop/cop/mixin/min_branches_count.rb
584
588
  - lib/rubocop/cop/mixin/multiline_element_indentation.rb
585
589
  - lib/rubocop/cop/mixin/multiline_element_line_breaks.rb
586
590
  - lib/rubocop/cop/mixin/multiline_expression_indentation.rb
@@ -682,6 +686,7 @@ files:
682
686
  - lib/rubocop/cop/style/date_time.rb
683
687
  - lib/rubocop/cop/style/def_with_parentheses.rb
684
688
  - lib/rubocop/cop/style/dir.rb
689
+ - lib/rubocop/cop/style/dir_empty.rb
685
690
  - lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb
686
691
  - lib/rubocop/cop/style/document_dynamic_eval_definition.rb
687
692
  - lib/rubocop/cop/style/documentation.rb
@@ -707,6 +712,7 @@ files:
707
712
  - lib/rubocop/cop/style/explicit_block_argument.rb
708
713
  - lib/rubocop/cop/style/exponential_notation.rb
709
714
  - lib/rubocop/cop/style/fetch_env_var.rb
715
+ - lib/rubocop/cop/style/file_empty.rb
710
716
  - lib/rubocop/cop/style/file_read.rb
711
717
  - lib/rubocop/cop/style/file_write.rb
712
718
  - lib/rubocop/cop/style/float_division.rb
@@ -903,6 +909,7 @@ files:
903
909
  - lib/rubocop/core_ext/string.rb
904
910
  - lib/rubocop/directive_comment.rb
905
911
  - lib/rubocop/error.rb
912
+ - lib/rubocop/ext/comment.rb
906
913
  - lib/rubocop/ext/processed_source.rb
907
914
  - lib/rubocop/ext/range.rb
908
915
  - lib/rubocop/ext/regexp_node.rb
@@ -981,7 +988,7 @@ metadata:
981
988
  homepage_uri: https://rubocop.org/
982
989
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
983
990
  source_code_uri: https://github.com/rubocop/rubocop/
984
- documentation_uri: https://docs.rubocop.org/rubocop/1.46/
991
+ documentation_uri: https://docs.rubocop.org/rubocop/1.48/
985
992
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
986
993
  rubygems_mfa_required: 'true'
987
994
  post_install_message: