From 70b072a7d02f9937dae9490f5e47774f131c6b1d Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Thu, 15 Aug 2024 07:59:49 -0700 Subject: [PATCH] Suppress sorbet type errors when using `undef' --- Library/Homebrew/extend/os/linux/cleanup.rb | 2 +- Library/Homebrew/extend/os/linux/parser.rb | 2 +- Library/Homebrew/extend/os/mac/cleaner.rb | 2 +- Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb | 2 +- Library/Homebrew/extend/os/mac/formula.rb | 2 +- Library/Homebrew/extend/os/mac/formula_installer.rb | 2 +- Library/Homebrew/extend/os/mac/linkage_checker.rb | 2 +- Library/Homebrew/extend/os/mac/readall.rb | 2 +- Library/Homebrew/extend/os/mac/simulate_system.rb | 2 +- Library/Homebrew/sorbet/config | 1 + Library/Homebrew/sorbet/tapioca/compilers/args.rb | 3 +++ 11 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/cleanup.rb b/Library/Homebrew/extend/os/linux/cleanup.rb index 40a9dff6b8..a9443a3d59 100644 --- a/Library/Homebrew/extend/os/linux/cleanup.rb +++ b/Library/Homebrew/extend/os/linux/cleanup.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module Homebrew diff --git a/Library/Homebrew/extend/os/linux/parser.rb b/Library/Homebrew/extend/os/linux/parser.rb index 6458173df0..7d81e2dddc 100644 --- a/Library/Homebrew/extend/os/linux/parser.rb +++ b/Library/Homebrew/extend/os/linux/parser.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module Homebrew diff --git a/Library/Homebrew/extend/os/mac/cleaner.rb b/Library/Homebrew/extend/os/mac/cleaner.rb index a91283da88..460169c996 100644 --- a/Library/Homebrew/extend/os/mac/cleaner.rb +++ b/Library/Homebrew/extend/os/mac/cleaner.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true class Cleaner diff --git a/Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb b/Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb index 413d50f87a..26d96cc1ce 100644 --- a/Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb +++ b/Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module Homebrew diff --git a/Library/Homebrew/extend/os/mac/formula.rb b/Library/Homebrew/extend/os/mac/formula.rb index c8a880832f..c32a41d9e3 100644 --- a/Library/Homebrew/extend/os/mac/formula.rb +++ b/Library/Homebrew/extend/os/mac/formula.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true class Formula diff --git a/Library/Homebrew/extend/os/mac/formula_installer.rb b/Library/Homebrew/extend/os/mac/formula_installer.rb index 67b4de7e58..89115c871d 100644 --- a/Library/Homebrew/extend/os/mac/formula_installer.rb +++ b/Library/Homebrew/extend/os/mac/formula_installer.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true class FormulaInstaller diff --git a/Library/Homebrew/extend/os/mac/linkage_checker.rb b/Library/Homebrew/extend/os/mac/linkage_checker.rb index 5844d645cf..6c69fd291b 100644 --- a/Library/Homebrew/extend/os/mac/linkage_checker.rb +++ b/Library/Homebrew/extend/os/mac/linkage_checker.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true class LinkageChecker diff --git a/Library/Homebrew/extend/os/mac/readall.rb b/Library/Homebrew/extend/os/mac/readall.rb index ca27d9a8d6..6957c2b086 100644 --- a/Library/Homebrew/extend/os/mac/readall.rb +++ b/Library/Homebrew/extend/os/mac/readall.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module Readall diff --git a/Library/Homebrew/extend/os/mac/simulate_system.rb b/Library/Homebrew/extend/os/mac/simulate_system.rb index c9b9050fca..95bc2ef9ae 100644 --- a/Library/Homebrew/extend/os/mac/simulate_system.rb +++ b/Library/Homebrew/extend/os/mac/simulate_system.rb @@ -1,4 +1,4 @@ -# typed: true # rubocop:disable Sorbet/StrictSigil +# typed: strict # frozen_string_literal: true module Homebrew diff --git a/Library/Homebrew/sorbet/config b/Library/Homebrew/sorbet/config index bd4721bc92..6022f9e533 100644 --- a/Library/Homebrew/sorbet/config +++ b/Library/Homebrew/sorbet/config @@ -4,4 +4,5 @@ --ignore=/vendor/gems --ignore=/vendor/portable-ruby --ignore=/test/.gem +--suppress-error-code=3008 --suppress-error-code=7019 diff --git a/Library/Homebrew/sorbet/tapioca/compilers/args.rb b/Library/Homebrew/sorbet/tapioca/compilers/args.rb index 5a533d73f8..947527d5a5 100644 --- a/Library/Homebrew/sorbet/tapioca/compilers/args.rb +++ b/Library/Homebrew/sorbet/tapioca/compilers/args.rb @@ -31,6 +31,9 @@ module Tapioca 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.name == "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)