Skip to content

Commit dab44fc

Browse files
committed
Enable strict typing in Homebrew::TestBot
1 parent 70b5921 commit dab44fc

15 files changed

+628
-389
lines changed

Library/Homebrew/test_bot.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# typed: true # rubocop:todo Sorbet/StrictSigil
1+
# typed: strict
22
# frozen_string_literal: true
33

44
require "test_bot/step"
@@ -23,14 +23,17 @@ module TestBot
2323

2424
HOMEBREW_TAP_REGEX = %r{^([\w-]+)/homebrew-([\w-]+)$}
2525

26+
sig { params(args: Homebrew::Cmd::TestBotCmd::Args).returns(T::Boolean) }
2627
def cleanup?(args)
2728
args.cleanup? || GitHub::Actions.env_set?
2829
end
2930

31+
sig { params(args: Homebrew::Cmd::TestBotCmd::Args).returns(T::Boolean) }
3032
def local?(args)
3133
args.local? || GitHub::Actions.env_set?
3234
end
3335

36+
sig { params(tap: T.nilable(String)).returns(T.nilable(Tap)) }
3437
def resolve_test_tap(tap = nil)
3538
return Tap.fetch(tap) if tap
3639

@@ -52,6 +55,7 @@ def resolve_test_tap(tap = nil)
5255
end
5356
end
5457

58+
sig { params(args: Homebrew::Cmd::TestBotCmd::Args).void }
5559
def run!(args)
5660
$stdout.sync = true
5761
$stderr.sync = true

Library/Homebrew/test_bot/bottles_fetch.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# typed: true # rubocop:todo Sorbet/StrictSigil
1+
# typed: strict
22
# frozen_string_literal: true
33

44
module Homebrew
55
module TestBot
66
class BottlesFetch < TestFormulae
7+
sig { returns(T::Array[String]) }
78
attr_accessor :testing_formulae
89

10+
sig { params(args: Homebrew::Cmd::TestBotCmd::Args).void }
911
def run!(args:)
1012
info_header "Testing formulae:"
1113
puts testing_formulae
@@ -19,6 +21,7 @@ def run!(args:)
1921

2022
private
2123

24+
sig { params(formula_name: String, args: Homebrew::Cmd::TestBotCmd::Args).void }
2225
def fetch_bottles!(formula_name, args:)
2326
test_header(:BottlesFetch, method: "fetch_bottles!(#{formula_name})")
2427

Library/Homebrew/test_bot/cleanup_after.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# typed: true # rubocop:todo Sorbet/StrictSigil
1+
# typed: strict
22
# frozen_string_literal: true
33

44
module Homebrew
55
module TestBot
66
class CleanupAfter < TestCleanup
7+
sig { params(args: Homebrew::Cmd::TestBotCmd::Args).void }
78
def run!(args:)
89
if ENV["HOMEBREW_GITHUB_ACTIONS"].present? && ENV["GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED"].blank? &&
910
# don't need to do post-build cleanup unless testing test-bot itself.
@@ -27,6 +28,7 @@ def run!(args:)
2728

2829
private
2930

31+
sig { void }
3032
def pkill_if_needed
3133
pgrep = ["pgrep", "-f", HOMEBREW_CELLAR.to_s]
3234

Library/Homebrew/test_bot/cleanup_before.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# typed: true # rubocop:todo Sorbet/StrictSigil
1+
# typed: strict
22
# frozen_string_literal: true
33

44
module Homebrew
55
module TestBot
66
class CleanupBefore < TestCleanup
7+
sig { params(args: Homebrew::Cmd::TestBotCmd::Args).void }
78
def run!(args:)
89
test_header(:CleanupBefore)
910

0 commit comments

Comments
 (0)