We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a02e42 commit 14a5c20Copy full SHA for 14a5c20
lib/rubocop/cop/layout/class_structure.rb
@@ -269,15 +269,11 @@ def end_position_for(node)
269
end
270
271
def begin_pos_with_comment(node)
272
- annotation_line = node.first_line - 1
273
first_comment = nil
+ (node.first_line - 1).downto(1) do |annotation_line|
274
+ break unless (comment = processed_source.comment_at_line(annotation_line))
275
- processed_source.comments_before_line(annotation_line)
276
- .reverse_each do |comment|
277
- if comment.location.line == annotation_line
278
- first_comment = comment
279
- annotation_line -= 1
280
- end
+ first_comment = comment
281
282
283
start_line_position(first_comment || node)
0 commit comments