Merge pull request #17100 from krehel/array-alphabetization-blank-line-fix

This commit is contained in:
Patrick Linnane 2024-04-17 11:33:00 -07:00 committed by GitHub
commit 929995c810
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,6 +37,7 @@ module RuboCop
def sort_array(source) def sort_array(source)
# Combine each comment with the line(s) below so that they remain in the same relative location # Combine each comment with the line(s) below so that they remain in the same relative location
combined_source = source.each_with_index.filter_map do |line, index| combined_source = source.each_with_index.filter_map do |line, index|
next if line.blank?
next if line.strip.start_with?("#") next if line.strip.start_with?("#")
next recursively_find_comments(source, index, line) next recursively_find_comments(source, index, line)