From 47f8636e7d90d49ccddc31f8b0acfd7f8c6c178e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 28 Feb 2022 09:58:20 +0000 Subject: [PATCH] update-report: optimise update_report_only_installed code. --- Library/Homebrew/cmd/update-report.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index aa5fb7efea..b3d3623f63 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -413,7 +413,7 @@ class Reporter renamed_formulae << [old_full_name, new_full_name] end - unless renamed_formulae.empty? + if renamed_formulae.present? @report[:A] -= renamed_formulae.map(&:last) @report[:D] -= renamed_formulae.map(&:first) @report[:R] = renamed_formulae.to_a @@ -593,20 +593,21 @@ class ReporterHub private def dump_formula_report(key, title) - # TODO: 3.4.0: odisabled the old functionality and make this default only_installed = Homebrew::EnvConfig.update_report_only_installed? formulae = select_formula(key).sort.map do |name, new_name| # Format list items of renamed formulae case key when :R - name = pretty_installed(name) if installed?(name) - new_name = pretty_installed(new_name) if installed?(new_name) - "#{name} -> #{new_name}" unless only_installed + unless only_installed + name = pretty_installed(name) if installed?(name) + new_name = pretty_installed(new_name) if installed?(new_name) + "#{name} -> #{new_name}" + end when :A - name if !installed?(name) && !only_installed + name if !only_installed && !installed?(name) when :AC - name.split("/").last if !cask_installed?(name) && !only_installed + name.split("/").last if !only_installed && !cask_installed?(name) when :MC, :DC name = name.split("/").last if cask_installed?(name)