Merge pull request #20513 from Homebrew/more_typed_strict
More Sorbet `typed: strict` files
This commit is contained in:
commit
b29076c577
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundle/formula_installer"
|
||||
@ -10,6 +10,7 @@ module Homebrew
|
||||
PACKAGE_TYPE = :brew
|
||||
PACKAGE_TYPE_NAME = "Formula"
|
||||
|
||||
sig { params(formula: String, no_upgrade: T::Boolean).returns(T::Boolean) }
|
||||
def installed_and_up_to_date?(formula, no_upgrade: false)
|
||||
Homebrew::Bundle::FormulaInstaller.formula_installed_and_up_to_date?(formula, no_upgrade:)
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundle/cask_installer"
|
||||
@ -10,6 +10,7 @@ module Homebrew
|
||||
PACKAGE_TYPE = :cask
|
||||
PACKAGE_TYPE_NAME = "Cask"
|
||||
|
||||
sig { params(cask: String, no_upgrade: T::Boolean).returns(T::Boolean) }
|
||||
def installed_and_up_to_date?(cask, no_upgrade: false)
|
||||
Homebrew::Bundle::CaskInstaller.cask_installed_and_up_to_date?(cask, no_upgrade:)
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundle/dumper"
|
||||
@ -7,6 +7,11 @@ module Homebrew
|
||||
module Bundle
|
||||
module Commands
|
||||
module Dump
|
||||
sig {
|
||||
params(global: T::Boolean, file: T.nilable(String), describe: T::Boolean, force: T::Boolean,
|
||||
no_restart: T::Boolean, taps: T::Boolean, formulae: T::Boolean, casks: T::Boolean,
|
||||
mas: T::Boolean, whalebrew: T::Boolean, vscode: T::Boolean).void
|
||||
}
|
||||
def self.run(global:, file:, describe:, force:, no_restart:, taps:, formulae:, casks:, mas:, whalebrew:,
|
||||
vscode:)
|
||||
Homebrew::Bundle::Dumper.dump_brewfile(
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundle/brewfile"
|
||||
@ -8,6 +8,10 @@ module Homebrew
|
||||
module Bundle
|
||||
module Commands
|
||||
module List
|
||||
sig {
|
||||
params(global: T::Boolean, file: T.nilable(String), formulae: T::Boolean, casks: T::Boolean,
|
||||
taps: T::Boolean, mas: T::Boolean, whalebrew: T::Boolean, vscode: T::Boolean).void
|
||||
}
|
||||
def self.run(global:, file:, formulae:, casks:, taps:, mas:, whalebrew:, vscode:)
|
||||
parsed_entries = Brewfile.read(global:, file:).entries
|
||||
Homebrew::Bundle::Lister.list(
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "bundle/remover"
|
||||
@ -7,6 +7,7 @@ module Homebrew
|
||||
module Bundle
|
||||
module Commands
|
||||
module Remove
|
||||
sig { params(args: T.anything, type: Symbol, global: T::Boolean, file: T.nilable(String)).void }
|
||||
def self.run(*args, type:, global:, file:)
|
||||
Homebrew::Bundle::Remover.remove(*args, type:, global:, file:)
|
||||
end
|
||||
|
@ -1,15 +1,23 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Homebrew
|
||||
module Bundle
|
||||
module Lister
|
||||
sig {
|
||||
params(entries: T::Array[Homebrew::Bundle::Dsl::Entry], formulae: T::Boolean, casks: T::Boolean,
|
||||
taps: T::Boolean, mas: T::Boolean, whalebrew: T::Boolean, vscode: T::Boolean).void
|
||||
}
|
||||
def self.list(entries, formulae:, casks:, taps:, mas:, whalebrew:, vscode:)
|
||||
entries.each do |entry|
|
||||
puts entry.name if show?(entry.type, formulae:, casks:, taps:, mas:, whalebrew:, vscode:)
|
||||
end
|
||||
end
|
||||
|
||||
sig {
|
||||
params(type: Symbol, formulae: T::Boolean, casks: T::Boolean, taps: T::Boolean, mas: T::Boolean,
|
||||
whalebrew: T::Boolean, vscode: T::Boolean).returns(T::Boolean)
|
||||
}
|
||||
private_class_method def self.show?(type, formulae:, casks:, taps:, mas:, whalebrew:, vscode:)
|
||||
return true if formulae && type == :brew
|
||||
return true if casks && type == :cask
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Homebrew
|
||||
@ -8,6 +8,10 @@ module Homebrew
|
||||
PACKAGE_TYPE = :tap
|
||||
PACKAGE_TYPE_NAME = "Tap"
|
||||
|
||||
sig {
|
||||
params(entries: T::Array[Homebrew::Bundle::Dsl::Entry], exit_on_first_error: T::Boolean,
|
||||
no_upgrade: T::Boolean, verbose: T::Boolean).returns(T::Array[String])
|
||||
}
|
||||
def find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false)
|
||||
requested_taps = format_checkable(entries)
|
||||
return [] if requested_taps.empty?
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Homebrew
|
||||
@ -8,10 +8,12 @@ module Homebrew
|
||||
PACKAGE_TYPE = :vscode
|
||||
PACKAGE_TYPE_NAME = "VSCode Extension"
|
||||
|
||||
sig { params(extension: String, no_upgrade: T::Boolean).returns(String) }
|
||||
def failure_reason(extension, no_upgrade:)
|
||||
"#{PACKAGE_TYPE_NAME} #{extension} needs to be installed."
|
||||
end
|
||||
|
||||
sig { params(extension: String, no_upgrade: T::Boolean).returns(T::Boolean) }
|
||||
def installed_and_up_to_date?(extension, no_upgrade: false)
|
||||
require "bundle/vscode_extension_installer"
|
||||
Homebrew::Bundle::VscodeExtensionInstaller.extension_installed?(extension)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cask/artifact/abstract_uninstall"
|
||||
@ -7,6 +7,7 @@ module Cask
|
||||
module Artifact
|
||||
# Artifact corresponding to the `zap` stanza.
|
||||
class Zap < AbstractUninstall
|
||||
sig { params(options: T.anything).void }
|
||||
def zap_phase(**options)
|
||||
dispatch_uninstall_directives(**options)
|
||||
end
|
||||
|
@ -1,17 +1,20 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PourBottleCheck
|
||||
include OnSystem::MacOSAndLinux
|
||||
|
||||
sig { params(formula: T.class_of(Formula)).void }
|
||||
def initialize(formula)
|
||||
@formula = formula
|
||||
end
|
||||
|
||||
sig { params(reason: String).void }
|
||||
def reason(reason)
|
||||
@formula.pour_bottle_check_unsatisfied_reason = reason
|
||||
end
|
||||
|
||||
sig { params(block: T.proc.void).void }
|
||||
def satisfy(&block)
|
||||
@formula.send(:define_method, :pour_bottle?, &block)
|
||||
end
|
||||
|
@ -58,12 +58,12 @@ RSpec.describe Homebrew::Bundle::Commands::List do
|
||||
verb = (options_list.length == 1 && "is") || "are"
|
||||
|
||||
context "when #{opts} #{verb} passed" do
|
||||
let(:formulae) { args_hash[:formulae] }
|
||||
let(:casks) { args_hash[:casks] }
|
||||
let(:taps) { args_hash[:taps] }
|
||||
let(:mas) { args_hash[:mas] }
|
||||
let(:whalebrew) { args_hash[:whalebrew] }
|
||||
let(:vscode) { args_hash[:vscode] }
|
||||
let(:formulae) { args_hash.fetch(:formulae, false) }
|
||||
let(:casks) { args_hash.fetch(:casks, false) }
|
||||
let(:taps) { args_hash.fetch(:taps, false) }
|
||||
let(:mas) { args_hash.fetch(:mas, false) }
|
||||
let(:whalebrew) { args_hash.fetch(:whalebrew, false) }
|
||||
let(:vscode) { args_hash.fetch(:vscode, false) }
|
||||
|
||||
it "shows only #{words}" do
|
||||
expected = options_list.map { |opt| types_and_deps[opt] }.join("\n")
|
||||
|
Loading…
x
Reference in New Issue
Block a user