aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2018-01-24 09:02:00 +0000
committerMike McQuaid2018-01-24 09:02:00 +0000
commit459b113e28cab57cde94625b3f284e54986c2167 (patch)
tree2225a837c2731aadc911bae6114f133ac960ae25
parente056e85078c5a8e79d187508cf391b9cd47ab2cf (diff)
downloadbrew-459b113e28cab57cde94625b3f284e54986c2167.tar.bz2
utils: reduce odeprecated warnings.
Fix the code so we don't actually output `odeprecated` warnings for `HOMEBREW_CACHE`d or `.brew`d formulae.
-rw-r--r--Library/Homebrew/utils.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index f8990e7ec..773efd2f4 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -82,6 +82,12 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call
# - Location of caller of deprecated method (if all else fails).
backtrace = caller
tap_message = nil
+
+ # Don't throw deprecations at all for cached or .brew formulae.
+ return if backtrace.any? do |line|
+ line.include?(HOMEBREW_CACHE) || line.include?("/.brew/")
+ end
+
caller_message = backtrace.detect do |line|
next unless line =~ %r{^#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/([^/]+/[^/]+)/}
tap = Tap.fetch Regexp.last_match(1)
@@ -89,9 +95,6 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call
true
end
caller_message ||= backtrace.detect do |line|
- # Don't throw deprecations at all for cached or .brew formulae.
- next false if line.include?(HOMEBREW_CACHE)
- next false if line.include?("/.brew/")
!line.start_with?("#{HOMEBREW_LIBRARY_PATH}/compat/")
end
caller_message ||= backtrace[1]