Improve style

This commit is contained in:
Carlo Cabrera 2023-04-04 13:20:03 +08:00
parent 7ff2382d74
commit e191dbfb9e
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0
2 changed files with 8 additions and 8 deletions

View File

@ -81,16 +81,16 @@ module Homebrew
testing_formulae.any? do |formula| testing_formulae.any? do |formula|
# If the formula has a platform/arch/macOS version requirement, then its # If the formula has a platform/arch/macOS version requirement, then its
# dependents don't need to be tested if these requirements are not satisfied. # dependents don't need to be tested if these requirements are not satisfied.
next false if reject_platform && formula.method(:"#{reject_platform}_only?").call next false if reject_platform && formula.send(:"#{reject_platform}_only?")
next false if reject_arch && formula.method(:"#{reject_arch}_only?").call next false if reject_arch && formula.send(:"#{reject_arch}_only?")
next false if select_macos_version && !formula.compatible_with?(select_macos_version) next false if select_macos_version && !formula.compatible_with?(select_macos_version)
compatible_dependents = formula.dependents.dup compatible_dependents = formula.dependents.dup
compatible_dependents.reject! { |dependent_f| dependent_f.method(:"#{reject_arch}_only?").call } if reject_arch compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_arch}_only?")} if reject_arch
if reject_platform if reject_platform
compatible_dependents.reject! { |dependent_f| dependent_f.method(:"#{reject_platform}_only?").call } compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_platform}_only?") }
end end
if select_macos_version if select_macos_version
@ -129,9 +129,9 @@ module Homebrew
compatible_formulae = formulae.dup compatible_formulae = formulae.dup
compatible_formulae.reject! { |formula| formula.method(:"#{reject_arch}_only?").call } if reject_arch compatible_formulae.reject! { |formula| formula.send(:"#{reject_platform}_only?") } if reject_platform
compatible_formulae.reject! { |formula| formula.send(:"#{reject_arch}_only?") } if reject_arch
compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version
compatible_formulae.reject! { |formula| formula.method(:"#{reject_platform}_only?").call } if reject_platform
compatible_formulae.present? compatible_formulae.present?
end end

View File

@ -16,7 +16,7 @@ describe "brew determine-test-runners" do
let(:arm64_runners) { all_runners - intel_runners } let(:arm64_runners) { all_runners - intel_runners }
let(:macos_runners) { all_runners - [linux_runner] } let(:macos_runners) { all_runners - [linux_runner] }
# We need to make sure we write to a different path for each example. # We need to make sure we write to a different path for each example.
let(:github_output) { "#{TEST_TMPDIR}/github_output#{TestRunnerTestHelper.new.number}" } let(:github_output) { "#{TEST_TMPDIR}/github_output#{DetermineRunnerTestHelper.new.number}" }
let(:ephemeral_suffix) { "-12345-1" } let(:ephemeral_suffix) { "-12345-1" }
let(:runner_env) do let(:runner_env) do
{ {
@ -158,7 +158,7 @@ def get_runners(file)
.sort .sort
end end
class TestRunnerTestHelper class DetermineRunnerTestHelper
@instances = 0 @instances = 0
class << self class << self