diff --git a/Library/Homebrew/bundle/adder.rb b/Library/Homebrew/bundle/adder.rb index 00914550cf..bcb698f98d 100644 --- a/Library/Homebrew/bundle/adder.rb +++ b/Library/Homebrew/bundle/adder.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "bundle/brewfile" @@ -9,6 +9,7 @@ module Homebrew module Adder module_function + sig { params(args: String, type: Symbol, global: T::Boolean, file: String).void } def add(*args, type:, global:, file:) brewfile = Brewfile.read(global:, file:) content = brewfile.input diff --git a/Library/Homebrew/bundle/commands/check.rb b/Library/Homebrew/bundle/commands/check.rb index fa5d31eebf..5f194c1144 100644 --- a/Library/Homebrew/bundle/commands/check.rb +++ b/Library/Homebrew/bundle/commands/check.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "bundle/checker" @@ -7,6 +7,10 @@ module Homebrew module Bundle module Commands module Check + sig { + params(global: T::Boolean, file: T.nilable(String), no_upgrade: T::Boolean, verbose: T::Boolean, + quiet: T::Boolean).void + } def self.run(global: false, file: nil, no_upgrade: false, verbose: false, quiet: false) output_errors = verbose exit_on_first_error = !verbose diff --git a/Library/Homebrew/bundle/skipper.rb b/Library/Homebrew/bundle/skipper.rb index 349d3ceff8..f2788907a2 100644 --- a/Library/Homebrew/bundle/skipper.rb +++ b/Library/Homebrew/bundle/skipper.rb @@ -7,6 +7,7 @@ module Homebrew module Bundle module Skipper class << self + sig { params(entry: Dsl::Entry, silent: T::Boolean).returns(T::Boolean) } def skip?(entry, silent: false) require "bundle/brew_dumper" diff --git a/Library/Homebrew/bundle/whalebrew_dumper.rb b/Library/Homebrew/bundle/whalebrew_dumper.rb index 3ef74394fe..8f7edfd48e 100644 --- a/Library/Homebrew/bundle/whalebrew_dumper.rb +++ b/Library/Homebrew/bundle/whalebrew_dumper.rb @@ -1,23 +1,29 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module Homebrew module Bundle module WhalebrewDumper + sig { void } def self.reset! - @images = nil + @images = T.let(nil, T.nilable(T::Array[String])) end + sig { returns(T::Array[T.nilable(String)]) } def self.images return [] unless Bundle.whalebrew_installed? odeprecated "`brew bundle` `whalebrew` support", "using `whalebrew` directly" - @images ||= `whalebrew list 2>/dev/null`.split("\n") - .reject { |line| line.start_with?("COMMAND ") } - .map { |line| line.split(/\s+/).last } - .uniq + @images ||= T.let( + `whalebrew list 2>/dev/null`.split("\n") + .reject { |line| line.start_with?("COMMAND ") } + .filter_map { |line| line.split(/\s+/).last } + .uniq, + T.nilable(T::Array[String]), + ) end + sig { returns(String) } def self.dump images.map { |image| "whalebrew \"#{image}\"" }.join("\n") end diff --git a/Library/Homebrew/extend/os/linux/bundle/skipper.rb b/Library/Homebrew/extend/os/linux/bundle/skipper.rb index c7a4c2e65c..8ae8259c05 100644 --- a/Library/Homebrew/extend/os/linux/bundle/skipper.rb +++ b/Library/Homebrew/extend/os/linux/bundle/skipper.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "cask/cask_loader" @@ -27,6 +27,7 @@ module OS true end + sig { params(entry: Homebrew::Bundle::Dsl::Entry, silent: T::Boolean).returns(T::Boolean) } def skip?(entry, silent: false) if macos_only_entry?(entry) || macos_only_cask?(entry) unless silent diff --git a/Library/Homebrew/head_software_spec.rb b/Library/Homebrew/head_software_spec.rb index cb7498b713..c5a00919a0 100644 --- a/Library/Homebrew/head_software_spec.rb +++ b/Library/Homebrew/head_software_spec.rb @@ -1,14 +1,16 @@ -# typed: true # rubocop:todo Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true require "software_spec" class HeadSoftwareSpec < SoftwareSpec + sig { params(flags: T::Array[String]).void } def initialize(flags: []) super @resource.version(Version.new("HEAD")) end + sig { params(_filename: Pathname).returns(NilClass) } def verify_download_integrity(_filename) # no-op end diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 0926444ec2..7463429257 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -38,7 +38,7 @@ class SoftwareSpec super() # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) - @resource = Resource::Formula.new + @resource = T.let(Resource::Formula.new, Resource::Formula) @resources = {} @dependency_collector = DependencyCollector.new @bottle_specification = BottleSpecification.new diff --git a/Library/Homebrew/test/head_software_spec_spec.rb b/Library/Homebrew/test/head_software_spec_spec.rb index 4e1d1021bc..c67314fe17 100644 --- a/Library/Homebrew/test/head_software_spec_spec.rb +++ b/Library/Homebrew/test/head_software_spec_spec.rb @@ -10,6 +10,6 @@ RSpec.describe HeadSoftwareSpec do end specify "#verify_download_integrity" do - expect(head_spec.verify_download_integrity(Object.new)).to be_nil + expect(head_spec.verify_download_integrity(Pathname.new("head.zip"))).to be_nil end end