Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump some files to Sorbet typed: true #1559

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ group :test do
gem "rspec"
gem "simplecov", require: false
gem "simplecov-cobertura", require: false
gem "sorbet-runtime"
end
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ GEM
simplecov (~> 0.19)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
sorbet-runtime (0.5.11758)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uri (1.0.2)
Expand All @@ -62,6 +63,7 @@ DEPENDENCIES
rspec
simplecov
simplecov-cobertura
sorbet-runtime

RUBY VERSION
ruby 3.3.7p123
Expand Down
1 change: 1 addition & 0 deletions lib/bundle.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

$LOAD_PATH.unshift(File.dirname(__FILE__))
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/brew_checker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/brew_dumper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: false
# frozen_string_literal: true

require "json"
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/brew_installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/brew_service_checker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/brew_services.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/brewfile.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/brewfile.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module Brewfile
include Kernel
end
end
6 changes: 4 additions & 2 deletions lib/bundle/bundle.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "English"
Expand All @@ -8,7 +9,7 @@ def system(cmd, *args, verbose: false)
return super cmd, *args if verbose

logs = []
success = nil
success = T.let(nil, T.nilable(T::Boolean))
IO.popen([cmd, *args], err: [:child, :out]) do |pipe|
while (buf = pipe.gets)
logs << buf
Expand Down Expand Up @@ -66,7 +67,8 @@ def exchange_uid_if_needed!(&block)
Process::Sys.seteuid(uid)
end

return_value = with_env("HOME" => Etc.getpwuid(Process.uid).dir, &block)
home = T.must(Etc.getpwuid(Process.uid)).dir
return_value = with_env("HOME" => home, &block)

if process_reexchangeable
Process::UID.re_exchange
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/cask_checker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/cask_dumper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/cask_dumper.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module CaskDumper
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/cask_installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/cask_installer.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module CaskInstaller
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/checker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: false
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/commands/check.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
3 changes: 2 additions & 1 deletion lib/bundle/commands/cleanup.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "utils/formatter"
Expand Down Expand Up @@ -125,7 +126,7 @@ def kept_casks(global: false, file: nil)

def recursive_dependencies(current_formulae, formulae_names, top_level: true)
@checked_formulae_names = [] if top_level
dependencies = []
dependencies = T.let([], T::Array[Formula])

formulae_names.each do |name|
next if @checked_formulae_names.include?(name)
Expand Down
29 changes: 29 additions & 0 deletions lib/bundle/commands/commands.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# typed: true

module Bundle
module Commands
module Check
include Kernel
end

module Cleanup
include Kernel
end

module Dump
include Kernel
end

module Exec
include Kernel
end

module Install
include Kernel
end

module List
include Kernel
end
end
end
1 change: 1 addition & 0 deletions lib/bundle/commands/dump.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/commands/exec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: false
# frozen_string_literal: true

require "exceptions"
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/commands/install.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/commands/list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
3 changes: 2 additions & 1 deletion lib/bundle/dsl.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down Expand Up @@ -102,7 +103,7 @@ def self.sanitize_brew_name(name)
Regexp.last_match(1)
elsif name =~ HOMEBREW_TAP_FORMULA_REGEX
user = Regexp.last_match(1)
repo = Regexp.last_match(2)
repo = T.must(Regexp.last_match(2))
name = Regexp.last_match(3)
"#{user}/#{repo.sub("homebrew-", "")}/#{name}"
else
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/dumper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "fileutils"
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/dumper.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module Dumper
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/extend/os/bundle.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "bundle/extend/os/linux/bundle" if OS.linux?
1 change: 1 addition & 0 deletions lib/bundle/extend/os/linux/bundle.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/extend/os/linux/skipper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/extend/os/skipper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "bundle/extend/os/linux/skipper" if OS.linux?
2 changes: 2 additions & 0 deletions lib/bundle/installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down Expand Up @@ -37,6 +38,7 @@ def install(entries, global: false, file: nil, no_lock: false, no_upgrade: false
Bundle::TapInstaller
end

next if cls.nil?
next if Bundle::Skipper.skip? entry

preinstall = if cls.preinstall(*args, **options, no_upgrade:, verbose:)
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/installer.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module Installer
include Kernel
end
end
3 changes: 2 additions & 1 deletion lib/bundle/lister.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand All @@ -10,7 +11,7 @@ def list(entries, brews:, casks:, taps:, mas:, whalebrew:, vscode:)
end
end

def self.show?(type, brews:, casks:, taps:, mas:, whalebrew:, vscode:)
def show?(type, brews:, casks:, taps:, mas:, whalebrew:, vscode:)
return true if brews && type == :brew
return true if casks && type == :cask
return true if taps && type == :tap
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/lister.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module Lister
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/mac_app_store_checker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
6 changes: 5 additions & 1 deletion lib/bundle/mac_app_store_dumper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "json"
Expand All @@ -17,7 +18,10 @@ def apps

# Only add the application details should we have a valid match.
# Strip unprintable characters
[app_details[:id], app_details[:name].gsub(/[[:cntrl:]]|[\p{C}]/, "")] if app_details
if app_details
name = T.must(app_details[:name])
[app_details[:id], name.gsub(/[[:cntrl:]]|[\p{C}]/, "")]
end
end
else
[]
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/mac_app_store_dumper.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module MacAppStoreDumper
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/mac_app_store_installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "os"
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/mac_app_store_installer.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module MacAppStoreInstaller
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/skipper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "hardware"
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/tap_checker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/tap_dumper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "json"
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/tap_dumper.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module TapDumper
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/tap_installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/tap_installer.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module TapInstaller
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/vscode_extension_checker.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
1 change: 1 addition & 0 deletions lib/bundle/vscode_extension_dumper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/vscode_extension_dumper.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module VscodeExtensionDumper
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/vscode_extension_installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
7 changes: 7 additions & 0 deletions lib/bundle/vscode_extension_installer.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module VscodeExtensionInstaller
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/whalebrew_dumper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Bundle
Expand Down
Loading