Refactor T.must called on .last
This commit is contained in:
parent
d97933b38c
commit
4d11307d41
@ -49,7 +49,7 @@ module Homebrew
|
|||||||
sig { params(tap: Tap).returns(T::Array[Formula]) }
|
sig { params(tap: Tap).returns(T::Array[Formula]) }
|
||||||
def installed_formulae_for(tap:)
|
def installed_formulae_for(tap:)
|
||||||
tap.formula_names.filter_map do |formula_name|
|
tap.formula_names.filter_map do |formula_name|
|
||||||
next unless installed_formulae_names.include?(T.must(formula_name.split("/").last))
|
next unless installed_formulae_names.include?(formula_name.split("/").fetch(-1))
|
||||||
|
|
||||||
formula = begin
|
formula = begin
|
||||||
Formulary.factory(formula_name)
|
Formulary.factory(formula_name)
|
||||||
@ -68,7 +68,7 @@ module Homebrew
|
|||||||
sig { params(tap: Tap).returns(T::Array[Cask::Cask]) }
|
sig { params(tap: Tap).returns(T::Array[Cask::Cask]) }
|
||||||
def installed_casks_for(tap:)
|
def installed_casks_for(tap:)
|
||||||
tap.cask_tokens.filter_map do |cask_token|
|
tap.cask_tokens.filter_map do |cask_token|
|
||||||
next unless installed_cask_tokens.include?(T.must(cask_token.split("/").last))
|
next unless installed_cask_tokens.include?(cask_token.split("/").fetch(-1))
|
||||||
|
|
||||||
cask = begin
|
cask = begin
|
||||||
Cask::CaskLoader.load(cask_token)
|
Cask::CaskLoader.load(cask_token)
|
||||||
|
|||||||
@ -500,7 +500,7 @@ class Reporter
|
|||||||
case status
|
case status
|
||||||
when "A", "D"
|
when "A", "D"
|
||||||
full_name = tap.formula_file_to_name(src)
|
full_name = tap.formula_file_to_name(src)
|
||||||
name = T.must(full_name.split("/").last)
|
name = full_name.split("/").fetch(-1)
|
||||||
new_tap = tap.tap_migrations[name]
|
new_tap = tap.tap_migrations[name]
|
||||||
@report[T.must(status).to_sym] << full_name unless new_tap
|
@report[T.must(status).to_sym] << full_name unless new_tap
|
||||||
when "M"
|
when "M"
|
||||||
@ -614,7 +614,7 @@ class Reporter
|
|||||||
sig { void }
|
sig { void }
|
||||||
def migrate_tap_migration
|
def migrate_tap_migration
|
||||||
(Array(report[:D]) + Array(report[:DC])).each do |full_name|
|
(Array(report[:D]) + Array(report[:DC])).each do |full_name|
|
||||||
name = T.must(full_name.split("/").last)
|
name = full_name.split("/").fetch(-1)
|
||||||
new_tap_name = tap.tap_migrations[name]
|
new_tap_name = tap.tap_migrations[name]
|
||||||
next if new_tap_name.nil? # skip if not in tap_migrations list.
|
next if new_tap_name.nil? # skip if not in tap_migrations list.
|
||||||
|
|
||||||
@ -901,7 +901,7 @@ class ReporterHub
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
casks.each do |cask|
|
casks.each do |cask|
|
||||||
cask_token = T.must(cask.split("/").last)
|
cask_token = cask.split("/").fetch(-1)
|
||||||
if should_display_descriptions && (desc = cask_description(cask))
|
if should_display_descriptions && (desc = cask_description(cask))
|
||||||
puts "#{cask_token}: #{desc}"
|
puts "#{cask_token}: #{desc}"
|
||||||
else
|
else
|
||||||
@ -924,7 +924,7 @@ class ReporterHub
|
|||||||
return if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
return if Homebrew::SimulateSystem.simulating_or_running_on_linux?
|
||||||
|
|
||||||
casks = select_formula_or_cask(:DC).sort.filter_map do |name|
|
casks = select_formula_or_cask(:DC).sort.filter_map do |name|
|
||||||
name = T.must(name.split("/").last)
|
name = name.split("/").fetch(-1)
|
||||||
pretty_uninstalled(name) if cask_installed?(name)
|
pretty_uninstalled(name) if cask_installed?(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1332,7 +1332,7 @@ module Formulary
|
|||||||
if (possible_alias = tap.alias_table[alias_table_key].presence)
|
if (possible_alias = tap.alias_table[alias_table_key].presence)
|
||||||
# FIXME: Remove the need to split the name and instead make
|
# FIXME: Remove the need to split the name and instead make
|
||||||
# the alias table only contain short names.
|
# the alias table only contain short names.
|
||||||
name = T.must(possible_alias.split("/").last)
|
name = possible_alias.split("/").fetch(-1)
|
||||||
type = :alias
|
type = :alias
|
||||||
elsif (new_name = tap.formula_renames[name].presence)
|
elsif (new_name = tap.formula_renames[name].presence)
|
||||||
old_name = tap.core_tap? ? name : tapped_name
|
old_name = tap.core_tap? ? name : tapped_name
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user