Skip to content
New issue

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

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

Already on GitHub? # to your account

Suppress sorbet type errors when using `undef' #18056

Merged
merged 2 commits into from
Aug 15, 2024
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
3 changes: 2 additions & 1 deletion Library/Homebrew/extend/os/linux/cleanup.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

module Homebrew
class Cleanup
undef use_system_ruby?

sig { returns(T::Boolean) }
def use_system_ruby?
return false if Homebrew::EnvConfig.force_vendor_ruby?

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/linux/parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

module Homebrew
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/cleaner.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

class Cleaner
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/extend/os/mac/cleanup.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

module Homebrew
class Cleanup
undef use_system_ruby?

sig { returns(T::Boolean) }
def use_system_ruby?
return false if Homebrew::EnvConfig.force_vendor_ruby?

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

module Homebrew
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/formula.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

class Formula
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/formula_installer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

class FormulaInstaller
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/extend/os/mac/linkage_checker.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

class LinkageChecker
undef system_libraries_exist_in_cache?

private

sig { returns(T::Boolean) }
def system_libraries_exist_in_cache?
# In macOS Big Sur and later, system libraries do not exist on-disk and instead exist in a cache.
MacOS.version >= :big_sur
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/readall.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

module Readall
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/simulate_system.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true # rubocop:disable Sorbet/StrictSigil
# typed: strict
# frozen_string_literal: true

module Homebrew
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/sorbet/config
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
--ignore=/vendor/gems
--ignore=/vendor/portable-ruby
--ignore=/test/.gem
--suppress-error-code=3008
--suppress-error-code=7019
3 changes: 3 additions & 0 deletions Library/Homebrew/sorbet/tapioca/compilers/args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def self.gather_constants
sig { override.void }
def decorate
cmd = T.cast(constant, T.class_of(Homebrew::AbstractCommand))
# This is a dummy class to make the `brew` command parsable
return if cmd == Homebrew::Cmd::Brew

args_class_name = T.must(T.must(cmd.args_class).name)
root.create_class(args_class_name, superclass_name: "Homebrew::CLI::Args") do |klass|
create_args_methods(klass, cmd.parser)
Expand Down