Skip to content

Commit

Permalink
Make all non-test files typed: true
Browse files Browse the repository at this point in the history
  • Loading branch information
issyl0 committed Aug 19, 2024
1 parent 082de47 commit fe2890c
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 12 deletions.
1 change: 1 addition & 0 deletions cmd/test-bot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "abstract_command"
Expand Down
1 change: 1 addition & 0 deletions lib/junit.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down
1 change: 1 addition & 0 deletions lib/step.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "system_command"
Expand Down
1 change: 1 addition & 0 deletions lib/test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require "utils/analytics"
Expand Down
3 changes: 3 additions & 0 deletions lib/test_bot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require_relative "step"
Expand All @@ -16,6 +17,8 @@

module Homebrew
module TestBot
include Kernel

module_function

GIT = "/usr/bin/git"
Expand Down
1 change: 1 addition & 0 deletions lib/test_cleanup.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
5 changes: 4 additions & 1 deletion lib/test_formulae.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# typed: true
# frozen_string_literal: true

module Homebrew
module Tests
class TestFormulae < Test
include Kernel

attr_accessor :skipped_or_failed_formulae
attr_reader :artifact_cache

def initialize(tap:, git:, dry_run:, fail_fast:, verbose:)
super

@skipped_or_failed_formulae = []
@artifact_cache = Pathname("artifact-cache")
@artifact_cache = Pathname.new("artifact-cache")
# Let's keep track of the artifacts we've already downloaded
# to avoid repeatedly trying to download the same thing.
@downloaded_artifacts = Hash.new { |h, k| h[k] = [] }
Expand Down
23 changes: 13 additions & 10 deletions lib/test_runner.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

require_relative "junit"
Expand All @@ -15,6 +16,8 @@

module Homebrew
module TestRunner
include Kernel

module_function

def ensure_blank_file_exists!(file)
Expand All @@ -26,13 +29,13 @@ def ensure_blank_file_exists!(file)
end

def run!(tap, git:, args:)
tests = []
tests = T.let([], T::Array[Homebrew::Test])
skip_setup = args.skip_setup?
skip_cleanup_before = false
skip_cleanup_before = T.let(false, T::Boolean)

bottle_output_path = Pathname("bottle_output.txt")
linkage_output_path = Pathname("linkage_output.txt")
@skipped_or_failed_formulae_output_path = Pathname("skipped_or_failed_formulae-#{Utils::Bottles.tag}.txt")
bottle_output_path = Pathname.new("bottle_output.txt")
linkage_output_path = Pathname.new("linkage_output.txt")
@skipped_or_failed_formulae_output_path = Pathname.new("skipped_or_failed_formulae-#{Utils::Bottles.tag}.txt")

if no_only_args?(args) || args.only_formulae?
ensure_blank_file_exists!(bottle_output_path)
Expand Down Expand Up @@ -91,7 +94,7 @@ def run!(tap, git:, args:)
end
puts steps_output

steps_output_path = Pathname("steps_output.txt")
steps_output_path = Pathname.new("steps_output.txt")
steps_output_path.unlink if steps_output_path.exist?
steps_output_path.write(steps_output)

Expand Down Expand Up @@ -209,9 +212,9 @@ def run_tests(tests, args:)
]
else
[
Array(args.testing_formulae),
Array(args.added_formulae),
Array(args.deleted_formulae),
args.testing_formulae&.to_a,
args.added_formulae&.to_a,
args.deleted_formulae&.to_a,
]
end

Expand All @@ -224,7 +227,7 @@ def run_tests(tests, args:)

formulae_test.skipped_or_failed_formulae
elsif args.skipped_or_failed_formulae.present?
Array(args.skipped_or_failed_formulae)
Array.new(args.skipped_or_failed_formulae)
elsif @skipped_or_failed_formulae_output_path.exist?
@skipped_or_failed_formulae_output_path.read.chomp.split(",")
else
Expand Down
1 change: 1 addition & 0 deletions lib/tests/bottles_fetch.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down
1 change: 1 addition & 0 deletions lib/tests/cleanup_after.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down
1 change: 1 addition & 0 deletions lib/tests/cleanup_before.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down
3 changes: 2 additions & 1 deletion lib/tests/formulae.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down Expand Up @@ -81,7 +82,7 @@ def install_ca_certificates_if_needed
end

def install_gcc_if_needed(formula, deps)
installed_gcc = false
installed_gcc = T.let(false, T::Boolean)
begin
deps.each { |dep| CompilerSelector.select_for(dep.to_formula) }
CompilerSelector.select_for(formula)
Expand Down
1 change: 1 addition & 0 deletions lib/tests/formulae_dependents.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down
1 change: 1 addition & 0 deletions lib/tests/formulae_detect.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down
1 change: 1 addition & 0 deletions lib/tests/setup.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down
1 change: 1 addition & 0 deletions lib/tests/tap_syntax.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# typed: true
# frozen_string_literal: true

module Homebrew
Expand Down

0 comments on commit fe2890c

Please sign in to comment.