From 5f721c6986b60b2e574563e09e77cb0d4b435dc8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 10 May 2020 15:21:31 +0100 Subject: [PATCH] Cleanup ARGV.include? usage Remove usage where `Homebrew.args` could be used instead or, due to the `Homebrew.args` parsing, there was dead code that was never executed (and no-one complained about not working). --- Library/Homebrew/dependencies.rb | 2 +- Library/Homebrew/extend/ENV/shared.rb | 14 -------------- Library/Homebrew/formula_installer.rb | 3 +-- Library/Homebrew/style.rb | 2 +- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index 1431ec2507..3ef90b2ed1 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -81,7 +81,7 @@ module Homebrew ignores << "optional?" end - ignores << "recommended?" if ARGV.include? "--skip-recommended" + ignores << "recommended?" if Homebrew.args.skip_recommended? [includes, ignores] end diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index fc422fa352..ac087c55c0 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -235,20 +235,6 @@ module SharedEnvExtension ohai "Building with an alternative Fortran compiler" puts "This is unsupported." self["F77"] ||= fc - - if ARGV.include? "--default-fortran-flags" - flags = FC_FLAG_VARS.reject { |key| self[key] } - elsif values_at(*FC_FLAG_VARS).compact.empty? - opoo <<~EOS - No Fortran optimization information was provided. You may want to consider - setting FCFLAGS and FFLAGS or pass the `--default-fortran-flags` option to - `brew install` if your compiler is compatible with GCC. - - If you like the default optimization level of your compiler, ignore this - warning. - EOS - end - else if (gfortran = which("gfortran", (HOMEBREW_PREFIX/"bin").to_s)) ohai "Using Homebrew-provided Fortran compiler." diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index cd757386cb..ae14f768b7 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -52,7 +52,7 @@ class FormulaInstaller @build_from_source = Homebrew.args.build_from_source? @build_bottle = false @force_bottle = Homebrew.args.force_bottle? - @include_test = ARGV.include?("--include-test") + @include_test = Homebrew.args.include_test? @interactive = false @git = false @verbose = Homebrew.args.verbose? @@ -707,7 +707,6 @@ class FormulaInstaller args << "--verbose" if verbose? args << "--debug" if debug? args << "--cc=#{ARGV.cc}" if ARGV.cc - args << "--default-fortran-flags" if ARGV.include? "--default-fortran-flags" args << "--keep-tmp" if Homebrew.args.keep_tmp? if ARGV.env diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 7285de1926..4c2c57d0ec 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -78,7 +78,7 @@ module Homebrew case output_type when :print args << "--debug" if ARGV.debug? - args << "--display-cop-names" if ARGV.include? "--display-cop-names" + args << "--display-cop-names" if Homebrew.args.display_cop_names? args << "--format" << "simple" if files system(cache_env, "rubocop", *args) rubocop_success = $CHILD_STATUS.success?