display_items: handle nil keys

This commit is contained in:
Maxim Belkin 2018-03-20 12:30:14 -05:00
parent 81042c63fb
commit 0513d9de5c
No known key found for this signature in database
GPG Key ID: AC71560D4C5F2338

View File

@ -22,11 +22,8 @@ class LinkageChecker
end end
def dylib_to_dep(dylib) def dylib_to_dep(dylib)
if dylib =~ %r{#{Regexp.escape(HOMEBREW_PREFIX)}/(opt|Cellar)/([\w+-.@]+)/} dylib =~ %r{#{Regexp.escape(HOMEBREW_PREFIX)}/(opt|Cellar)/([\w+-.@]+)/}
Regexp.last_match(2) Regexp.last_match(2)
else
"Not a Homebrew library"
end
end end
def check_dylibs def check_dylibs
@ -170,7 +167,7 @@ class LinkageChecker
return if things.empty? return if things.empty?
puts "#{label}:" puts "#{label}:"
if things.is_a? Hash if things.is_a? Hash
things.sort.each do |list_label, list| things.sort_by { |k, _| k.to_s }.each do |list_label, list|
list.sort.each do |item| list.sort.each do |item|
puts " #{item} (#{list_label})" puts " #{item} (#{list_label})"
end end