install: typed: strict

This commit is contained in:
Michael Cho
2025-12-03 20:05:54 -05:00
parent f0df6fa040
commit 0fbb71700a
4 changed files with 19 additions and 7 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ module OS
# reproducible bottles.
def consistent_reproducible_symlink_permissions!
path.find do |file|
File.lchmod 0777, file if file.symlink?
file.lchmod 0777 if file.symlink?
end
end
end
+11 -5
View File
@@ -1,4 +1,4 @@
# typed: true # rubocop:todo Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true
require "diagnostic"
@@ -17,7 +17,7 @@ module Homebrew
class << self
sig { params(all_fatal: T::Boolean).void }
def perform_preinstall_checks_once(all_fatal: false)
@perform_preinstall_checks_once ||= {}
@perform_preinstall_checks_once ||= T.let({}, T.nilable(T::Hash[T::Boolean, TrueClass]))
@perform_preinstall_checks_once[all_fatal] ||= begin
perform_preinstall_checks(all_fatal:)
true
@@ -28,7 +28,7 @@ module Homebrew
def check_cc_argv(cc)
return unless cc
@checks ||= Diagnostic::Checks.new
@checks ||= T.let(Diagnostic::Checks.new, T.nilable(Homebrew::Diagnostic::Checks))
opoo <<~EOS
You passed `--cc=#{cc}`.
@@ -422,8 +422,14 @@ module Homebrew
end
end
sig { params(formula: Formula, dependencies: T::Array[[Dependency, Options]]).void }
def print_dry_run_dependencies(formula, dependencies)
sig {
params(
formula: Formula,
dependencies: T::Array[[Dependency, Options]],
_block: T.proc.params(arg0: Formula).void,
).void
}
def print_dry_run_dependencies(formula, dependencies, &_block)
return if dependencies.empty?
ohai "Would install #{Utils.pluralize("dependency", dependencies.count, include_count: true)} " \
+6 -1
View File
@@ -164,7 +164,11 @@ class Keg
).sort.uniq.freeze
end
attr_reader :path, :name, :linked_keg_record, :opt_record
sig { returns(String) }
attr_reader :name
sig { returns(Pathname) }
attr_reader :path, :linked_keg_record, :opt_record
protected :path
@@ -188,6 +192,7 @@ class Keg
@require_relocation = false
end
sig { returns(Pathname) }
def rack
path.parent
end
+1
View File
@@ -212,6 +212,7 @@ class Keg
changed_files = T.let([], T::Array[Pathname])
files.map { path.join(_1) }.group_by { |f| f.stat.ino }.each_value do |first, *rest|
first = T.must(first)
s = first.open("rb", &:read)
# Use full prefix replacement for Homebrew-created files when using selective relocation