From 12366f9c5ba57c85d2a12f781e3e9fe3324e075b Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Thu, 21 Aug 2025 22:33:29 +0800 Subject: [PATCH 1/3] bundle/commands/install: `typed: strict` --- Library/Homebrew/bundle/commands/install.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/bundle/commands/install.rb b/Library/Homebrew/bundle/commands/install.rb index 03ce65774e..2b829d0420 100644 --- a/Library/Homebrew/bundle/commands/install.rb +++ b/Library/Homebrew/bundle/commands/install.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "bundle/brewfile" @@ -8,6 +8,17 @@ module Homebrew module Bundle module Commands module Install + sig { + params( + global: T::Boolean, + file: T.nilable(String), + no_lock: T::Boolean, + no_upgrade: T::Boolean, + verbose: T::Boolean, + force: T::Boolean, + quiet: T::Boolean, + ).void + } def self.run(global: false, file: nil, no_lock: false, no_upgrade: false, verbose: false, force: false, quiet: false) @dsl = Brewfile.read(global:, file:) @@ -17,7 +28,9 @@ module Homebrew ) || exit(1) end + sig { returns(T.nilable(Dsl)) } def self.dsl + @dsl ||= T.let(nil, T.nilable(Dsl)) @dsl end end From 13af5171217bb6cdd683d52e84a828ca244b657a Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Thu, 21 Aug 2025 22:33:39 +0800 Subject: [PATCH 2/3] bundle/brewfile: `typed: strict` --- Library/Homebrew/bundle/brewfile.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/bundle/brewfile.rb b/Library/Homebrew/bundle/brewfile.rb index 3c8adc8fab..60e1a1fba4 100644 --- a/Library/Homebrew/bundle/brewfile.rb +++ b/Library/Homebrew/bundle/brewfile.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "bundle/dsl" @@ -6,6 +6,13 @@ require "bundle/dsl" module Homebrew module Bundle module Brewfile + sig { + params( + dash_writes_to_stdout: T::Boolean, + global: T::Boolean, + file: T.nilable(String), + ).returns(Pathname) + } def self.path(dash_writes_to_stdout: false, global: false, file: nil) env_bundle_file_global = ENV.fetch("HOMEBREW_BUNDLE_FILE_GLOBAL", nil) env_bundle_file = ENV.fetch("HOMEBREW_BUNDLE_FILE", nil) @@ -36,12 +43,19 @@ module Homebrew Pathname.new(filename).expand_path(Dir.pwd) end + sig { params(global: T::Boolean, file: T.nilable(String)).returns(Dsl) } def self.read(global: false, file: nil) Homebrew::Bundle::Dsl.new(Brewfile.path(global:, file:)) rescue Errno::ENOENT raise "No Brewfile found" end + sig { + params( + filename: String, + dash_writes_to_stdout: T::Boolean, + ).returns(String) + } private_class_method def self.handle_file_value(filename, dash_writes_to_stdout) if filename != "-" filename From bcf3de58079d1c42fcb761254f8847e1df32fb27 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Thu, 21 Aug 2025 22:41:17 +0800 Subject: [PATCH 3/3] bundle/skipper: `typed: strict` --- Library/Homebrew/bundle/skipper.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/bundle/skipper.rb b/Library/Homebrew/bundle/skipper.rb index 84699c51b3..c6b4ccd8f1 100644 --- a/Library/Homebrew/bundle/skipper.rb +++ b/Library/Homebrew/bundle/skipper.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "hardware" @@ -29,17 +29,19 @@ module Homebrew true end + sig { params(tap_name: String).void } def tap_failed!(tap_name) - @failed_taps ||= [] + @failed_taps ||= T.let([], T.nilable(T::Array[String])) @failed_taps << tap_name end private + sig { returns(T::Hash[Symbol, T::Array[String]]) } def skipped_entries return @skipped_entries if @skipped_entries - @skipped_entries = {} + @skipped_entries ||= T.let({}, T.nilable(T::Hash[Symbol, T::Array[String]])) [:brew, :cask, :mas, :tap, :whalebrew].each do |type| @skipped_entries[type] = ENV["HOMEBREW_BUNDLE_#{type.to_s.upcase}_SKIP"]&.split