Skip to content

Commit d0a1445

Browse files
authored
Merge pull request #20145 from Homebrew/some-bundle-files-werent-typed-at-all-but-now-some-are
Make some of the `bundle` commands Sorbet `typed: true`
2 parents 9d357b5 + 68596ec commit d0a1445

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

Library/Homebrew/bundle/brew_dumper.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# typed: false # rubocop:todo Sorbet/TrueSigil
1+
# typed: true
22
# frozen_string_literal: true
33

44
require "json"
@@ -189,7 +189,12 @@ def formula_to_hash(formula)
189189

190190
class Topo < Hash
191191
include TSort
192+
193+
def each_key(&block)
194+
keys.each(&block)
195+
end
192196
alias tsort_each_node each_key
197+
193198
def tsort_each_child(node, &block)
194199
fetch(node.downcase).sort.each(&block)
195200
end
@@ -230,8 +235,8 @@ def sort!(formulae)
230235

231236
odie <<~EOS
232237
Formulae dependency graph sorting failed (likely due to a circular dependency):
233-
#{cycle_first}: #{topo[cycle_first]}
234-
#{cycle_last}: #{topo[cycle_last]}
238+
#{cycle_first}: #{topo[cycle_first] if topo}
239+
#{cycle_last}: #{topo[cycle_last] if topo}
235240
Please run the following commands and try again:
236241
brew update
237242
brew uninstall --ignore-dependencies --force #{cycle_first} #{cycle_last}

Library/Homebrew/bundle/checker.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# typed: false # rubocop:todo Sorbet/TrueSigil
1+
# typed: true
22
# frozen_string_literal: true
33

44
module Homebrew
@@ -23,7 +23,7 @@ def failure_reason(name, no_upgrade:)
2323
else
2424
"needs to be installed or updated."
2525
end
26-
"#{self.class::PACKAGE_TYPE_NAME} #{name} #{reason}"
26+
"#{self.class.const_get(:PACKAGE_TYPE_NAME)} #{name} #{reason}"
2727
end
2828

2929
def full_check(packages, no_upgrade:)
@@ -33,7 +33,7 @@ def full_check(packages, no_upgrade:)
3333

3434
def checkable_entries(all_entries)
3535
require "bundle/skipper"
36-
all_entries.select { |e| e.type == self.class::PACKAGE_TYPE }
36+
all_entries.select { |e| e.type == self.class.const_get(:PACKAGE_TYPE) }
3737
.reject(&Bundle::Skipper.method(:skip?))
3838
end
3939

Library/Homebrew/sorbet/rbi/dsl/homebrew/bundle/brew_dumper.rbi

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)