From 36cc2016166a5bc2e682daa8c3b8397b5f303e9b Mon Sep 17 00:00:00 2001 From: Justin Krehel <39449589+krehel@users.noreply.github.com> Date: Wed, 17 Apr 2024 13:48:06 -0400 Subject: [PATCH] rubocops/cask/array_alphabetization: skip blank lines when sorting --- Library/Homebrew/rubocops/cask/array_alphabetization.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/rubocops/cask/array_alphabetization.rb b/Library/Homebrew/rubocops/cask/array_alphabetization.rb index 39f7b618b9193..8e3e93b22ddc6 100644 --- a/Library/Homebrew/rubocops/cask/array_alphabetization.rb +++ b/Library/Homebrew/rubocops/cask/array_alphabetization.rb @@ -37,6 +37,7 @@ def on_send(node) def sort_array(source) # 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| + next if line.blank? next if line.strip.start_with?("#") next recursively_find_comments(source, index, line)