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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 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
5 changes: 3 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,7 @@ def exchange_uid_if_needed!(&block)
Process::Sys.seteuid(uid)
end

return_value = with_env("HOME" => Etc.getpwuid(Process.uid).dir, &block)
return_value = with_env("HOME" => Etc.getpwuid(Process.uid)&.dir, &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[Dependency])

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 @@ -104,7 +105,7 @@ def self.sanitize_brew_name(name)
user = Regexp.last_match(1)
repo = Regexp.last_match(2)
name = Regexp.last_match(3)
"#{user}/#{repo.sub("homebrew-", "")}/#{name}"
"#{user}/#{repo&.sub("homebrew-", "")}/#{name}"
else
name
end
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
1 change: 1 addition & 0 deletions 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 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
7 changes: 7 additions & 0 deletions lib/bundle/whalebrew_dumper.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module WhalebrewDumper
include Kernel
end
end
1 change: 1 addition & 0 deletions lib/bundle/whalebrew_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/whalebrew_installer.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# typed: true

module Bundle
module WhalebrewInstaller
include Kernel
end
end
Loading