diff --git a/Library/Homebrew/extend/os/mac/keg.rb b/Library/Homebrew/extend/os/mac/keg.rb index 0c4a0eeb61..e681709b7d 100644 --- a/Library/Homebrew/extend/os/mac/keg.rb +++ b/Library/Homebrew/extend/os/mac/keg.rb @@ -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 diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index da11838062..99256ae791 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -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)} " \ diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index d38a7b92d2..45ce093945 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -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 diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 0996d62bc4..35449f5d18 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -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