Skip to content

Commit

Permalink
Merge pull request #3725 from MikeMcQuaid/fix-odeprecated-again
Browse files Browse the repository at this point in the history
utils: reduce odeprecated warnings.
  • Loading branch information
MikeMcQuaid authored Jan 24, 2018
2 parents ea0af7d + 459b113 commit 60a30e9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Library/Homebrew/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,19 @@ 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)
tap_message = "\nPlease report this to the #{tap} tap!"
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]
Expand Down

0 comments on commit 60a30e9

Please sign in to comment.