From fdd7fdd2f64579e3c0b7a3d9280dee2a58eed4e2 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 4 Jul 2024 23:59:32 +0100 Subject: [PATCH] formula_assertions: Convert to Sorbet `typed: strict` --- Library/Homebrew/formula_assertions.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula_assertions.rb b/Library/Homebrew/formula_assertions.rb index a7d6d0dd77..db3320b62a 100644 --- a/Library/Homebrew/formula_assertions.rb +++ b/Library/Homebrew/formula_assertions.rb @@ -1,4 +1,4 @@ -# typed: true +# typed: strict # frozen_string_literal: true module Homebrew @@ -10,15 +10,18 @@ module Homebrew require "minitest/assertions" include ::Minitest::Assertions + sig { params(assertions: Integer).returns(Integer) } attr_writer :assertions + sig { returns(Integer) } def assertions - @assertions ||= 0 + @assertions ||= T.let(0, T.nilable(Integer)) end # Returns the output of running cmd and asserts the exit status. # # @api public + sig { params(cmd: String, result: Integer).returns(String) } def shell_output(cmd, result = 0) ohai cmd output = `#{cmd}` @@ -33,6 +36,7 @@ module Homebrew # optionally asserts the exit status. # # @api public + sig { params(cmd: String, input: T.nilable(String), result: T.nilable(Integer)).returns(String) } def pipe_output(cmd, input = nil, result = nil) ohai cmd output = IO.popen(cmd, "w+") do |pipe|