diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index e1e4712ea1..bacdb18f02 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -344,7 +344,7 @@ module Homebrew rescue FormulaInstallationAlreadyAttemptedError # We already attempted to install f as part of the dependency tree of # another formula. In that case, don't generate an error, just move on. - return + nil rescue CannotInstallFormulaError => e ofail e.message end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 7c62d8092a..420c08dfe8 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -47,7 +47,7 @@ module Homebrew fi.install fi.finish rescue FormulaInstallationAlreadyAttemptedError - return + nil rescue Exception # rubocop:disable Lint/RescueException ignore_interrupts { restore_backup(keg, keg_was_linked) } raise diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 1446025805..4e6dd04631 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -139,7 +139,7 @@ module Homebrew rescue FormulaInstallationAlreadyAttemptedError # We already attempted to upgrade f as part of the dependency tree of # another formula. In that case, don't generate an error, just move on. - return + nil rescue CannotInstallFormulaError => e ofail e rescue BuildError => e diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 79f5b2f1d0..1b779f226b 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -966,7 +966,7 @@ module Homebrew Putting non-prefixed coreutils in your path can cause gmp builds to fail. EOS rescue FormulaUnavailableError - return + nil end def check_for_non_prefixed_findutils @@ -981,7 +981,7 @@ module Homebrew Putting non-prefixed findutils in your path can cause python builds to fail. EOS rescue FormulaUnavailableError - return + nil end def check_for_pydistutils_cfg_in_home diff --git a/Library/Homebrew/extend/os/linux/system_config.rb b/Library/Homebrew/extend/os/linux/system_config.rb index cf01765623..47eca7697e 100644 --- a/Library/Homebrew/extend/os/linux/system_config.rb +++ b/Library/Homebrew/extend/os/linux/system_config.rb @@ -31,7 +31,7 @@ class SystemConfig return "N/A" unless CoreTap.instance.installed? Formulary.factory(formula).linked_version || "N/A" rescue FormulaUnavailableError - return "N/A" + "N/A" end def dump_verbose_config(out = $stdout) diff --git a/Library/Homebrew/formula_versions.rb b/Library/Homebrew/formula_versions.rb index c10c69e674..67edba9c5e 100644 --- a/Library/Homebrew/formula_versions.rb +++ b/Library/Homebrew/formula_versions.rb @@ -44,7 +44,7 @@ class FormulaVersions # continue walking the history ohai "#{e} in #{name} at revision #{rev}", e.backtrace if ARGV.debug? rescue FormulaUnavailableError - return + nil ensure Homebrew.raise_deprecation_exceptions = false end diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index aa0208d51a..0fed724a8d 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -326,8 +326,8 @@ class Tab < OpenStruct "time" => time, "source_modified_time" => source_modified_time.to_i, "HEAD" => self.HEAD, - "stdlib" => (stdlib.to_s if stdlib), - "compiler" => (compiler.to_s if compiler), + "stdlib" => (stdlib&.to_s), + "compiler" => (compiler&.to_s), "aliases" => aliases, "runtime_dependencies" => runtime_dependencies, "source" => source, diff --git a/Library/Homebrew/test/support/lib/config.rb b/Library/Homebrew/test/support/lib/config.rb index e54fc111fa..a59d80c995 100644 --- a/Library/Homebrew/test/support/lib/config.rb +++ b/Library/Homebrew/test/support/lib/config.rb @@ -16,9 +16,9 @@ TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k| end # Paths pointing into the Homebrew code base that persist across test runs -HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../../..", __FILE__)) +HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __dir__)) HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY_PATH.parent+"Homebrew/shims" -HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":") +HOMEBREW_LOAD_PATH = [File.expand_path(__dir__), HOMEBREW_LIBRARY_PATH].join(":") # Paths redirected to a temporary directory and wiped at the end of the test run HOMEBREW_PREFIX = Pathname.new(TEST_TMPDIR).join("prefix")