rubocop 1.45.1 → 1.50.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +46 -15
  4. data/lib/rubocop/cli/command/auto_generate_config.rb +7 -0
  5. data/lib/rubocop/cli/command/execute_runner.rb +7 -2
  6. data/lib/rubocop/cli.rb +6 -6
  7. data/lib/rubocop/comment_config.rb +19 -0
  8. data/lib/rubocop/config.rb +3 -3
  9. data/lib/rubocop/config_loader.rb +8 -8
  10. data/lib/rubocop/cop/autocorrect_logic.rb +29 -13
  11. data/lib/rubocop/cop/base.rb +1 -1
  12. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  13. data/lib/rubocop/cop/cop.rb +2 -2
  14. data/lib/rubocop/cop/corrector.rb +1 -1
  15. data/lib/rubocop/cop/correctors/alignment_corrector.rb +2 -2
  16. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +3 -3
  17. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +3 -3
  18. data/lib/rubocop/cop/correctors/line_break_corrector.rb +1 -1
  19. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +2 -2
  20. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -1
  21. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +1 -1
  22. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -2
  23. data/lib/rubocop/cop/gemspec/dependency_version.rb +1 -1
  24. data/lib/rubocop/cop/internal_affairs/cop_description.rb +5 -5
  25. data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +3 -3
  26. data/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb +1 -1
  27. data/lib/rubocop/cop/internal_affairs/location_expression.rb +37 -0
  28. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -1
  29. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
  30. data/lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb +42 -0
  31. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
  32. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
  33. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +66 -0
  34. data/lib/rubocop/cop/internal_affairs.rb +3 -0
  35. data/lib/rubocop/cop/layout/block_end_newline.rb +7 -21
  36. data/lib/rubocop/cop/layout/class_structure.rb +6 -3
  37. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -1
  38. data/lib/rubocop/cop/layout/empty_comment.rb +3 -3
  39. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +1 -1
  40. data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
  41. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +2 -0
  42. data/lib/rubocop/cop/layout/end_alignment.rb +9 -1
  43. data/lib/rubocop/cop/layout/extra_spacing.rb +6 -1
  44. data/lib/rubocop/cop/layout/first_argument_indentation.rb +7 -2
  45. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +8 -2
  46. data/lib/rubocop/cop/layout/heredoc_indentation.rb +2 -2
  47. data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
  48. data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
  49. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +1 -3
  50. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +11 -7
  51. data/lib/rubocop/cop/layout/redundant_line_break.rb +6 -7
  52. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -2
  53. data/lib/rubocop/cop/layout/space_before_first_arg.rb +1 -1
  54. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +2 -2
  55. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
  56. data/lib/rubocop/cop/layout/space_inside_parens.rb +2 -2
  57. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +1 -1
  58. data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
  59. data/lib/rubocop/cop/lint/constant_resolution.rb +1 -1
  60. data/lib/rubocop/cop/lint/debugger.rb +3 -0
  61. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +4 -4
  62. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +1 -1
  63. data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +122 -0
  64. data/lib/rubocop/cop/lint/duplicate_methods.rb +2 -2
  65. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -3
  66. data/lib/rubocop/cop/lint/else_layout.rb +1 -1
  67. data/lib/rubocop/cop/lint/empty_block.rb +1 -1
  68. data/lib/rubocop/cop/lint/empty_conditional_body.rb +4 -2
  69. data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
  70. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
  71. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +46 -4
  72. data/lib/rubocop/cop/lint/missing_super.rb +31 -2
  73. data/lib/rubocop/cop/lint/nested_method_definition.rb +3 -11
  74. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -0
  75. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +6 -10
  76. data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
  77. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  78. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +11 -5
  79. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +5 -5
  80. data/lib/rubocop/cop/lint/redundant_require_statement.rb +1 -1
  81. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
  82. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +35 -15
  83. data/lib/rubocop/cop/lint/redundant_with_index.rb +1 -1
  84. data/lib/rubocop/cop/lint/redundant_with_object.rb +1 -1
  85. data/lib/rubocop/cop/lint/refinement_import_methods.rb +2 -1
  86. data/lib/rubocop/cop/lint/rescue_type.rb +3 -3
  87. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +1 -1
  88. data/lib/rubocop/cop/lint/script_permission.rb +1 -1
  89. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
  90. data/lib/rubocop/cop/lint/syntax.rb +4 -0
  91. data/lib/rubocop/cop/lint/to_enum_arguments.rb +13 -3
  92. data/lib/rubocop/cop/lint/unreachable_loop.rb +3 -3
  93. data/lib/rubocop/cop/lint/useless_access_modifier.rb +10 -10
  94. data/lib/rubocop/cop/lint/useless_method_definition.rb +10 -2
  95. data/lib/rubocop/cop/lint/useless_rescue.rb +6 -2
  96. data/lib/rubocop/cop/lint/useless_times.rb +1 -1
  97. data/lib/rubocop/cop/lint/void.rb +7 -3
  98. data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
  99. data/lib/rubocop/cop/metrics/class_length.rb +1 -0
  100. data/lib/rubocop/cop/metrics/collection_literal_length.rb +76 -0
  101. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +3 -3
  102. data/lib/rubocop/cop/migration/department_name.rb +1 -1
  103. data/lib/rubocop/cop/mixin/annotation_comment.rb +1 -1
  104. data/lib/rubocop/cop/mixin/code_length.rb +1 -1
  105. data/lib/rubocop/cop/mixin/comments_help.rb +3 -3
  106. data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
  107. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +1 -1
  108. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +10 -5
  109. data/lib/rubocop/cop/mixin/hash_transform_method.rb +3 -3
  110. data/lib/rubocop/cop/mixin/min_branches_count.rb +40 -0
  111. data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +0 -3
  112. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
  113. data/lib/rubocop/cop/mixin/range_help.rb +1 -6
  114. data/lib/rubocop/cop/mixin/statement_modifier.rb +3 -3
  115. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  116. data/lib/rubocop/cop/naming/ascii_identifiers.rb +1 -1
  117. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
  118. data/lib/rubocop/cop/naming/inclusive_language.rb +23 -4
  119. data/lib/rubocop/cop/naming/method_name.rb +3 -3
  120. data/lib/rubocop/cop/naming/predicate_name.rb +1 -1
  121. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +1 -1
  122. data/lib/rubocop/cop/registry.rb +3 -1
  123. data/lib/rubocop/cop/style/accessor_grouping.rb +39 -17
  124. data/lib/rubocop/cop/style/arguments_forwarding.rb +3 -3
  125. data/lib/rubocop/cop/style/array_intersect.rb +1 -1
  126. data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
  127. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +1 -1
  128. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  129. data/lib/rubocop/cop/style/block_delimiters.rb +11 -2
  130. data/lib/rubocop/cop/style/case_like_if.rb +20 -3
  131. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  132. data/lib/rubocop/cop/style/class_equality_comparison.rb +42 -9
  133. data/lib/rubocop/cop/style/collection_compact.rb +1 -1
  134. data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
  135. data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
  136. data/lib/rubocop/cop/style/concat_array_literals.rb +10 -2
  137. data/lib/rubocop/cop/style/conditional_assignment.rb +6 -6
  138. data/lib/rubocop/cop/style/copyright.rb +1 -1
  139. data/lib/rubocop/cop/style/data_inheritance.rb +75 -0
  140. data/lib/rubocop/cop/style/dir_empty.rb +60 -0
  141. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +2 -2
  142. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +2 -2
  143. data/lib/rubocop/cop/style/documentation.rb +10 -4
  144. data/lib/rubocop/cop/style/documentation_method.rb +4 -4
  145. data/lib/rubocop/cop/style/double_negation.rb +2 -2
  146. data/lib/rubocop/cop/style/each_with_object.rb +1 -1
  147. data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
  148. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
  149. data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
  150. data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -1
  151. data/lib/rubocop/cop/style/file_empty.rb +71 -0
  152. data/lib/rubocop/cop/style/file_read.rb +1 -1
  153. data/lib/rubocop/cop/style/file_write.rb +1 -1
  154. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
  155. data/lib/rubocop/cop/style/guard_clause.rb +1 -1
  156. data/lib/rubocop/cop/style/hash_except.rb +4 -4
  157. data/lib/rubocop/cop/style/hash_like_case.rb +3 -9
  158. data/lib/rubocop/cop/style/hash_syntax.rb +5 -2
  159. data/lib/rubocop/cop/style/if_unless_modifier.rb +108 -15
  160. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +2 -0
  161. data/lib/rubocop/cop/style/inverse_methods.rb +5 -5
  162. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +2 -2
  163. data/lib/rubocop/cop/style/map_to_hash.rb +4 -1
  164. data/lib/rubocop/cop/style/map_to_set.rb +4 -1
  165. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +3 -7
  166. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +44 -37
  167. data/lib/rubocop/cop/style/min_max.rb +3 -3
  168. data/lib/rubocop/cop/style/mixin_grouping.rb +4 -4
  169. data/lib/rubocop/cop/style/multiline_method_signature.rb +7 -4
  170. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -1
  171. data/lib/rubocop/cop/style/negated_if_else_condition.rb +12 -7
  172. data/lib/rubocop/cop/style/nil_lambda.rb +2 -2
  173. data/lib/rubocop/cop/style/parallel_assignment.rb +26 -18
  174. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +2 -3
  175. data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
  176. data/lib/rubocop/cop/style/redundant_condition.rb +2 -2
  177. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +2 -2
  178. data/lib/rubocop/cop/style/redundant_interpolation.rb +2 -2
  179. data/lib/rubocop/cop/style/redundant_line_continuation.rb +179 -0
  180. data/lib/rubocop/cop/style/redundant_parentheses.rb +2 -2
  181. data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
  182. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +7 -8
  183. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +11 -4
  184. data/lib/rubocop/cop/style/redundant_sort.rb +3 -3
  185. data/lib/rubocop/cop/style/redundant_string_escape.rb +3 -4
  186. data/lib/rubocop/cop/style/require_order.rb +1 -3
  187. data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
  188. data/lib/rubocop/cop/style/safe_navigation.rb +2 -2
  189. data/lib/rubocop/cop/style/slicing_with_range.rb +1 -1
  190. data/lib/rubocop/cop/style/sole_nested_conditional.rb +3 -3
  191. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  192. data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
  193. data/lib/rubocop/cop/style/trailing_body_on_class.rb +1 -0
  194. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -1
  195. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  196. data/lib/rubocop/cop/style/unless_logical_operators.rb +1 -0
  197. data/lib/rubocop/cop/style/unpack_first.rb +3 -3
  198. data/lib/rubocop/cop/style/word_array.rb +17 -5
  199. data/lib/rubocop/cop/style/yoda_condition.rb +1 -1
  200. data/lib/rubocop/cop/style/zero_length_predicate.rb +9 -5
  201. data/lib/rubocop/cop/team.rb +11 -8
  202. data/lib/rubocop/cop/util.rb +13 -4
  203. data/lib/rubocop/cop/variable_force/variable.rb +5 -3
  204. data/lib/rubocop/cops_documentation_generator.rb +10 -3
  205. data/lib/rubocop/directive_comment.rb +3 -3
  206. data/lib/rubocop/ext/comment.rb +18 -0
  207. data/lib/rubocop/ext/regexp_node.rb +1 -1
  208. data/lib/rubocop/ext/regexp_parser.rb +1 -1
  209. data/lib/rubocop/formatter/junit_formatter.rb +4 -1
  210. data/lib/rubocop/formatter/simple_text_formatter.rb +1 -1
  211. data/lib/rubocop/options.rb +4 -1
  212. data/lib/rubocop/result_cache.rb +1 -1
  213. data/lib/rubocop/rspec/cop_helper.rb +1 -1
  214. data/lib/rubocop/rspec/shared_contexts.rb +4 -0
  215. data/lib/rubocop/rspec/support.rb +1 -0
  216. data/lib/rubocop/server/cache.rb +1 -1
  217. data/lib/rubocop/server/core.rb +1 -1
  218. data/lib/rubocop/server/helper.rb +1 -1
  219. data/lib/rubocop/server/server_command/exec.rb +1 -1
  220. data/lib/rubocop/target_ruby.rb +1 -1
  221. data/lib/rubocop/version.rb +1 -1
  222. data/lib/rubocop.rb +8 -0
  223. metadata +20 -9
@@ -82,10 +82,19 @@ module RuboCop
82
82
  attr_accessor :largest_brackets
83
83
  end
84
84
 
85
+ def on_new_investigation
86
+ super
87
+
88
+ # Prevent O(n2) checks (checking the entire matrix once for each child array) by caching
89
+ @matrix_of_complex_content_cache = Hash.new do |cache, node|
90
+ cache[node] = matrix_of_complex_content?(node)
91
+ end
92
+ end
93
+
85
94
  def on_array(node)
86
95
  if bracketed_array_of?(:str, node)
87
96
  return if complex_content?(node.values)
88
- return if within_2d_array_of_complex_content?(node)
97
+ return if within_matrix_of_complex_content?(node)
89
98
 
90
99
  check_bracketed_array(node, 'w')
91
100
  elsif node.percent_literal?(:string)
@@ -95,12 +104,15 @@ module RuboCop
95
104
 
96
105
  private
97
106
 
98
- def within_2d_array_of_complex_content?(node)
107
+ def within_matrix_of_complex_content?(node)
99
108
  return false unless (parent = node.parent)
100
109
 
101
- parent.array_type? &&
102
- parent.values.all?(&:array_type?) &&
103
- parent.values.any? { |subarray| complex_content?(subarray.values) }
110
+ parent.array_type? && @matrix_of_complex_content_cache[parent]
111
+ end
112
+
113
+ def matrix_of_complex_content?(array)
114
+ array.values.all?(&:array_type?) &&
115
+ array.values.any? { |subarray| complex_content?(subarray.values) }
104
116
  end
105
117
 
106
118
  def complex_content?(strings, complex_regex: word_regex)
@@ -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
@@ -28,7 +28,7 @@ module RuboCop
28
28
  def self.mobilize_cops(cop_classes, config, options = {})
29
29
  cop_classes = Registry.new(cop_classes.to_a, options) unless cop_classes.is_a?(Registry)
30
30
 
31
- cop_classes.enabled(config).map do |cop_class|
31
+ cop_classes.map do |cop_class|
32
32
  cop_class.new(config, options)
33
33
  end
34
34
  end
@@ -58,6 +58,7 @@ module RuboCop
58
58
  @options = options
59
59
  reset
60
60
  @ready = true
61
+ @registry = Registry.new(cops, options.dup)
61
62
 
62
63
  validate_config
63
64
  end
@@ -84,7 +85,7 @@ module RuboCop
84
85
  # until there are no corrections left to perform
85
86
  # To speed things up, run autocorrecting cops by themselves, and only
86
87
  # run the other cops when no corrections are left
87
- on_duty = roundup_relevant_cops(processed_source.file_path)
88
+ on_duty = roundup_relevant_cops(processed_source)
88
89
 
89
90
  autocorrect_cops, other_cops = on_duty.partition(&:autocorrect?)
90
91
  report = investigate_partial(autocorrect_cops, processed_source,
@@ -130,7 +131,7 @@ module RuboCop
130
131
  # holds source read in from stdin, when --stdin option is used
131
132
  @options[:stdin] = new_source
132
133
  else
133
- filename = processed_source.buffer.name
134
+ filename = processed_source.file_path
134
135
  File.write(filename, new_source)
135
136
  end
136
137
  @updated_source_file = true
@@ -156,11 +157,13 @@ module RuboCop
156
157
  end
157
158
 
158
159
  # @return [Array<cop>]
159
- def roundup_relevant_cops(filename)
160
- cops.reject do |cop|
161
- cop.excluded_file?(filename) ||
162
- !support_target_ruby_version?(cop) ||
163
- !support_target_rails_version?(cop)
160
+ def roundup_relevant_cops(processed_source)
161
+ cops.select do |cop|
162
+ next true if processed_source.comment_config.cop_opted_in?(cop)
163
+ next false if cop.excluded_file?(processed_source.file_path)
164
+ next false unless @registry.enabled?(cop, @config)
165
+
166
+ support_target_ruby_version?(cop) && support_target_rails_version?(cop)
164
167
  end
165
168
  end
166
169
 
@@ -3,6 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  # This module contains a collection of useful utility methods.
6
+ # rubocop:disable Metrics/ModuleLength
6
7
  module Util
7
8
  include PathUtil
8
9
 
@@ -80,7 +81,7 @@ module RuboCop
80
81
  end
81
82
 
82
83
  def args_end(node)
83
- node.loc.expression.end
84
+ node.source_range.end
84
85
  end
85
86
 
86
87
  def on_node(syms, sexp, excludes = [], &block)
@@ -92,13 +93,20 @@ module RuboCop
92
93
  sexp.each_child_node { |elem| on_node(syms, elem, excludes, &block) }
93
94
  end
94
95
 
96
+ # Arbitrarily chosen value, should be enough to cover
97
+ # the most nested source code in real world projects.
98
+ MAX_LINE_BEGINS_REGEX_INDEX = 50
95
99
  LINE_BEGINS_REGEX_CACHE = Hash.new do |hash, index|
96
- hash[index] = /^\s{#{index}}\S/
100
+ hash[index] = /^\s{#{index}}\S/ if index <= MAX_LINE_BEGINS_REGEX_INDEX
97
101
  end
98
- private_constant :LINE_BEGINS_REGEX_CACHE
102
+ private_constant :MAX_LINE_BEGINS_REGEX_INDEX, :LINE_BEGINS_REGEX_CACHE
99
103
 
100
104
  def begins_its_line?(range)
101
- range.source_line.match?(LINE_BEGINS_REGEX_CACHE[range.column])
105
+ if (regex = LINE_BEGINS_REGEX_CACHE[range.column])
106
+ range.source_line.match?(regex)
107
+ else
108
+ range.source_line.index(/\S/) == range.column
109
+ end
102
110
  end
103
111
 
104
112
  # Returns, for example, a bare `if` node if the given node is an `if`
@@ -190,5 +198,6 @@ module RuboCop
190
198
  source == target || (source.is_a?(Array) && source.include?(target))
191
199
  end
192
200
  end
201
+ # rubocop:enable Metrics/ModuleLength
193
202
  end
194
203
  end
@@ -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!
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'fileutils'
4
+
3
5
  # Class for generating documentation of all cops departments
4
6
  # @api private
5
7
  class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
@@ -14,6 +16,8 @@ class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
14
16
  @departments = departments.map(&:to_sym).sort!
15
17
  @cops = RuboCop::Cop::Registry.global
16
18
  @config = RuboCop::ConfigLoader.default_configuration
19
+ @docs_path = "#{Dir.pwd}/docs/modules/ROOT/pages/"
20
+ FileUtils.mkdir_p(@docs_path)
17
21
  end
18
22
 
19
23
  def call
@@ -27,7 +31,7 @@ class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
27
31
 
28
32
  private
29
33
 
30
- attr_reader :departments, :cops, :config
34
+ attr_reader :departments, :cops, :config, :docs_path
31
35
 
32
36
  def cops_of_department(department)
33
37
  cops.with_department(department).sort!
@@ -252,7 +256,7 @@ class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
252
256
  content = +"= #{department}\n"
253
257
  selected_cops.each { |cop| content << print_cop_with_doc(cop) }
254
258
  content << footer_for_department(department)
255
- file_name = "#{Dir.pwd}/docs/modules/ROOT/pages/#{department_to_basename(department)}.adoc"
259
+ file_name = "#{docs_path}/#{department_to_basename(department)}.adoc"
256
260
  File.open(file_name, 'w') do |file|
257
261
  puts "* generated #{file_name}"
258
262
  file.write("#{content.strip}\n")
@@ -298,7 +302,10 @@ class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
298
302
  end
299
303
 
300
304
  def print_table_of_contents
301
- path = "#{Dir.pwd}/docs/modules/ROOT/pages/cops.adoc"
305
+ path = "#{docs_path}/cops.adoc"
306
+
307
+ File.write(path, table_contents) and return unless File.exist?(path)
308
+
302
309
  original = File.read(path)
303
310
  content = +"// START_COP_LIST\n\n"
304
311
 
@@ -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
@@ -29,7 +29,7 @@ module RuboCop
29
29
  @parsed_tree&.each_expression(true) { |e| e.origin = origin }
30
30
  end
31
31
  # Please remove this `else` branch when support for regexp_parser 1.8 will be dropped.
32
- # It's for compatibility with regexp_arser 1.8 and will never be maintained.
32
+ # It's for compatibility with regexp_parser 1.8 and will never be maintained.
33
33
  else
34
34
  def assign_properties(*)
35
35
  super
@@ -28,7 +28,7 @@ module RuboCop
28
28
  @expression ||= origin.adjust(begin_pos: ts, end_pos: ts + full_length)
29
29
  end
30
30
  # Please remove this `else` branch when support for regexp_parser 1.8 will be dropped.
31
- # It's for compatibility with regexp_arser 1.8 and will never be maintained.
31
+ # It's for compatibility with regexp_parser 1.8 and will never be maintained.
32
32
  else
33
33
  attr_accessor :source
34
34
 
@@ -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)
@@ -61,7 +61,7 @@ module RuboCop
61
61
  correctable_count,
62
62
  rainbow,
63
63
  # :safe_autocorrect is a derived option based on several command-line
64
- # arguments - see Rubocop::Options#add_autocorrection_options
64
+ # arguments - see RuboCop::Options#add_autocorrection_options
65
65
  safe_autocorrect: @options[:safe_autocorrect])
66
66
 
67
67
  output.puts
@@ -182,7 +182,10 @@ module RuboCop
182
182
  raise OptionArgumentError, message
183
183
  end
184
184
 
185
- @options[:"#{option}"] = list.empty? ? [''] : list.split(',')
185
+ cop_names = list.empty? ? [''] : list.split(',')
186
+ cop_names.unshift('Lint/Syntax') if option == 'only' && !cop_names.include?('Lint/Syntax')
187
+
188
+ @options[:"#{option}"] = cop_names
186
189
  end
187
190
  end
188
191
 
@@ -86,7 +86,7 @@ module RuboCop
86
86
  attr :path
87
87
 
88
88
  def initialize(file, team, options, config_store, cache_root = nil)
89
- cache_root ||= options[:cache_root]
89
+ cache_root ||= File.join(options[:cache_root], 'rubocop_cache') if options[:cache_root]
90
90
  cache_root ||= ResultCache.cache_root(config_store)
91
91
  @allow_symlinks_in_cache_location =
92
92
  ResultCache.allow_symlinks_in_cache_location?(config_store)
@@ -69,7 +69,7 @@ module CopHelper
69
69
  end
70
70
 
71
71
  def _investigate(cop, processed_source)
72
- team = RuboCop::Cop::Team.new([cop], nil, raise_error: true)
72
+ team = RuboCop::Cop::Team.new([cop], configuration, raise_error: true)
73
73
  report = team.investigate(processed_source)
74
74
  @last_corrector = report.correctors.first || RuboCop::Cop::Corrector.new(processed_source)
75
75
  report.offenses.reject(&:disabled?)
@@ -172,3 +172,7 @@ end
172
172
  RSpec.shared_context 'ruby 3.2' do
173
173
  let(:ruby_version) { 3.2 }
174
174
  end
175
+
176
+ RSpec.shared_context 'ruby 3.3' do
177
+ let(:ruby_version) { 3.3 }
178
+ end
@@ -25,4 +25,5 @@ RSpec.configure do |config|
25
25
  config.include_context 'ruby 3.0', :ruby30
26
26
  config.include_context 'ruby 3.1', :ruby31
27
27
  config.include_context 'ruby 3.2', :ruby32
28
+ config.include_context 'ruby 3.3', :ruby33
28
29
  end
@@ -116,7 +116,7 @@ module RuboCop
116
116
 
117
117
  def pid_running?
118
118
  Process.kill(0, pid_path.read.to_i) == 1
119
- rescue Errno::ESRCH, Errno::ENOENT
119
+ rescue Errno::ESRCH, Errno::ENOENT, Errno::EACCES
120
120
  false
121
121
  end
122
122
 
@@ -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
 
@@ -11,7 +11,7 @@
11
11
  #
12
12
  module RuboCop
13
13
  module Server
14
- # This module has a helper memthod for `RuboCop::Server::SocketReader`.
14
+ # This module has a helper method for `RuboCop::Server::SocketReader`.
15
15
  # @api private
16
16
  module Helper
17
17
  def self.redirect(stdin: $stdin, stdout: $stdout, stderr: $stderr, &_block)
@@ -21,7 +21,7 @@ module RuboCop
21
21
  # We must pass the --color option to preserve this behavior.
22
22
  @args.unshift('--color') unless %w[--color --no-color].any? { |f| @args.include?(f) }
23
23
  status = RuboCop::CLI.new.run(@args)
24
- # This status file is read by `rubocop --server` (`RuboCop::Server::Clientcommand::Exec`).
24
+ # This status file is read by `rubocop --server` (`RuboCop::Server::ClientCommand::Exec`).
25
25
  # so that they use the correct exit code.
26
26
  # Status is 1 when there are any issues, and 0 otherwise.
27
27
  Cache.write_status_file(status)
@@ -4,7 +4,7 @@ module RuboCop
4
4
  # The kind of Ruby that code inspected by RuboCop is written in.
5
5
  # @api private
6
6
  class TargetRuby
7
- KNOWN_RUBIES = [2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2].freeze
7
+ KNOWN_RUBIES = [2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3].freeze
8
8
  DEFAULT_VERSION = 2.6
9
9
 
10
10
  OBSOLETE_RUBIES = {
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.45.1'
6
+ STRING = '1.50.1'
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'
@@ -297,6 +299,7 @@ require_relative 'rubocop/cop/lint/duplicate_case_condition'
297
299
  require_relative 'rubocop/cop/lint/duplicate_elsif_condition'
298
300
  require_relative 'rubocop/cop/lint/duplicate_hash_key'
299
301
  require_relative 'rubocop/cop/lint/duplicate_magic_comment'
302
+ require_relative 'rubocop/cop/lint/duplicate_match_pattern'
300
303
  require_relative 'rubocop/cop/lint/duplicate_methods'
301
304
  require_relative 'rubocop/cop/lint/duplicate_regexp_character_class_element'
302
305
  require_relative 'rubocop/cop/lint/duplicate_require'
@@ -415,6 +418,7 @@ require_relative 'rubocop/cop/metrics/abc_size'
415
418
  require_relative 'rubocop/cop/metrics/block_length'
416
419
  require_relative 'rubocop/cop/metrics/block_nesting'
417
420
  require_relative 'rubocop/cop/metrics/class_length'
421
+ require_relative 'rubocop/cop/metrics/collection_literal_length'
418
422
  require_relative 'rubocop/cop/metrics/method_length'
419
423
  require_relative 'rubocop/cop/metrics/module_length'
420
424
  require_relative 'rubocop/cop/metrics/parameter_lists'
@@ -477,9 +481,11 @@ require_relative 'rubocop/cop/style/concat_array_literals'
477
481
  require_relative 'rubocop/cop/style/conditional_assignment'
478
482
  require_relative 'rubocop/cop/style/constant_visibility'
479
483
  require_relative 'rubocop/cop/style/copyright'
484
+ require_relative 'rubocop/cop/style/data_inheritance'
480
485
  require_relative 'rubocop/cop/style/date_time'
481
486
  require_relative 'rubocop/cop/style/def_with_parentheses'
482
487
  require_relative 'rubocop/cop/style/dir'
488
+ require_relative 'rubocop/cop/style/dir_empty'
483
489
  require_relative 'rubocop/cop/style/disable_cops_within_source_code_directive'
484
490
  require_relative 'rubocop/cop/style/documentation_method'
485
491
  require_relative 'rubocop/cop/style/documentation'
@@ -505,6 +511,7 @@ require_relative 'rubocop/cop/style/expand_path_arguments'
505
511
  require_relative 'rubocop/cop/style/explicit_block_argument'
506
512
  require_relative 'rubocop/cop/style/exponential_notation'
507
513
  require_relative 'rubocop/cop/style/fetch_env_var'
514
+ require_relative 'rubocop/cop/style/file_empty'
508
515
  require_relative 'rubocop/cop/style/file_read'
509
516
  require_relative 'rubocop/cop/style/file_write'
510
517
  require_relative 'rubocop/cop/style/float_division'
@@ -558,6 +565,7 @@ require_relative 'rubocop/cop/style/redundant_fetch_block'
558
565
  require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
559
566
  require_relative 'rubocop/cop/style/redundant_heredoc_delimiter_quotes'
560
567
  require_relative 'rubocop/cop/style/redundant_initialize'
568
+ require_relative 'rubocop/cop/style/redundant_line_continuation'
561
569
  require_relative 'rubocop/cop/style/redundant_self_assignment'
562
570
  require_relative 'rubocop/cop/style/redundant_self_assignment_branch'
563
571
  require_relative 'rubocop/cop/style/require_order'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.45.1
4
+ version: 1.50.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-02-08 00:00:00.000000000 Z
13
+ date: 2023-04-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -120,7 +120,7 @@ dependencies:
120
120
  requirements:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 1.24.1
123
+ version: 1.28.0
124
124
  - - "<"
125
125
  - !ruby/object:Gem::Version
126
126
  version: '2.0'
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: 1.24.1
133
+ version: 1.28.0
134
134
  - - "<"
135
135
  - !ruby/object:Gem::Version
136
136
  version: '2.0'
@@ -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
@@ -281,12 +282,14 @@ files:
281
282
  - lib/rubocop/cop/internal_affairs/node_type_predicate.rb
282
283
  - lib/rubocop/cop/internal_affairs/numblock_handler.rb
283
284
  - lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
285
+ - lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb
284
286
  - lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
285
287
  - lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
286
288
  - lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb
287
289
  - lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
288
290
  - lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
289
291
  - lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
292
+ - lib/rubocop/cop/internal_affairs/redundant_source_range.rb
290
293
  - lib/rubocop/cop/internal_affairs/single_line_comparison.rb
291
294
  - lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
292
295
  - lib/rubocop/cop/internal_affairs/undefined_config.rb
@@ -417,6 +420,7 @@ files:
417
420
  - lib/rubocop/cop/lint/duplicate_elsif_condition.rb
418
421
  - lib/rubocop/cop/lint/duplicate_hash_key.rb
419
422
  - lib/rubocop/cop/lint/duplicate_magic_comment.rb
423
+ - lib/rubocop/cop/lint/duplicate_match_pattern.rb
420
424
  - lib/rubocop/cop/lint/duplicate_methods.rb
421
425
  - lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb
422
426
  - lib/rubocop/cop/lint/duplicate_require.rb
@@ -530,6 +534,7 @@ files:
530
534
  - lib/rubocop/cop/metrics/block_length.rb
531
535
  - lib/rubocop/cop/metrics/block_nesting.rb
532
536
  - lib/rubocop/cop/metrics/class_length.rb
537
+ - lib/rubocop/cop/metrics/collection_literal_length.rb
533
538
  - lib/rubocop/cop/metrics/cyclomatic_complexity.rb
534
539
  - lib/rubocop/cop/metrics/method_length.rb
535
540
  - lib/rubocop/cop/metrics/module_length.rb
@@ -580,6 +585,7 @@ files:
580
585
  - lib/rubocop/cop/mixin/method_complexity.rb
581
586
  - lib/rubocop/cop/mixin/method_preference.rb
582
587
  - lib/rubocop/cop/mixin/min_body_length.rb
588
+ - lib/rubocop/cop/mixin/min_branches_count.rb
583
589
  - lib/rubocop/cop/mixin/multiline_element_indentation.rb
584
590
  - lib/rubocop/cop/mixin/multiline_element_line_breaks.rb
585
591
  - lib/rubocop/cop/mixin/multiline_expression_indentation.rb
@@ -678,9 +684,11 @@ files:
678
684
  - lib/rubocop/cop/style/conditional_assignment.rb
679
685
  - lib/rubocop/cop/style/constant_visibility.rb
680
686
  - lib/rubocop/cop/style/copyright.rb
687
+ - lib/rubocop/cop/style/data_inheritance.rb
681
688
  - lib/rubocop/cop/style/date_time.rb
682
689
  - lib/rubocop/cop/style/def_with_parentheses.rb
683
690
  - lib/rubocop/cop/style/dir.rb
691
+ - lib/rubocop/cop/style/dir_empty.rb
684
692
  - lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb
685
693
  - lib/rubocop/cop/style/document_dynamic_eval_definition.rb
686
694
  - lib/rubocop/cop/style/documentation.rb
@@ -706,6 +714,7 @@ files:
706
714
  - lib/rubocop/cop/style/explicit_block_argument.rb
707
715
  - lib/rubocop/cop/style/exponential_notation.rb
708
716
  - lib/rubocop/cop/style/fetch_env_var.rb
717
+ - lib/rubocop/cop/style/file_empty.rb
709
718
  - lib/rubocop/cop/style/file_read.rb
710
719
  - lib/rubocop/cop/style/file_write.rb
711
720
  - lib/rubocop/cop/style/float_division.rb
@@ -820,6 +829,7 @@ files:
820
829
  - lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb
821
830
  - lib/rubocop/cop/style/redundant_initialize.rb
822
831
  - lib/rubocop/cop/style/redundant_interpolation.rb
832
+ - lib/rubocop/cop/style/redundant_line_continuation.rb
823
833
  - lib/rubocop/cop/style/redundant_parentheses.rb
824
834
  - lib/rubocop/cop/style/redundant_percent_q.rb
825
835
  - lib/rubocop/cop/style/redundant_regexp_character_class.rb
@@ -902,6 +912,7 @@ files:
902
912
  - lib/rubocop/core_ext/string.rb
903
913
  - lib/rubocop/directive_comment.rb
904
914
  - lib/rubocop/error.rb
915
+ - lib/rubocop/ext/comment.rb
905
916
  - lib/rubocop/ext/processed_source.rb
906
917
  - lib/rubocop/ext/range.rb
907
918
  - lib/rubocop/ext/regexp_node.rb
@@ -980,10 +991,10 @@ metadata:
980
991
  homepage_uri: https://rubocop.org/
981
992
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
982
993
  source_code_uri: https://github.com/rubocop/rubocop/
983
- documentation_uri: https://docs.rubocop.org/rubocop/1.45/
994
+ documentation_uri: https://docs.rubocop.org/rubocop/1.50/
984
995
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
985
996
  rubygems_mfa_required: 'true'
986
- post_install_message:
997
+ post_install_message:
987
998
  rdoc_options: []
988
999
  require_paths:
989
1000
  - lib
@@ -998,8 +1009,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
998
1009
  - !ruby/object:Gem::Version
999
1010
  version: '0'
1000
1011
  requirements: []
1001
- rubygems_version: 3.3.7
1002
- signing_key:
1012
+ rubygems_version: 3.4.6
1013
+ signing_key:
1003
1014
  specification_version: 4
1004
1015
  summary: Automatic Ruby code style checking tool.
1005
1016
  test_files: []