diff options
| author | Mike McQuaid | 2018-01-24 09:13:01 +0000 |
|---|---|---|
| committer | GitHub | 2018-01-24 09:13:01 +0000 |
| commit | 60a30e966b7cece5bd4823dae3fb981ab85106ea (patch) | |
| tree | 10360dc9668332633227fa9089aa84969459570f | |
| parent | ea0af7d1af3a6b44338656739a76cf5b86f2e00f (diff) | |
| parent | 459b113e28cab57cde94625b3f284e54986c2167 (diff) | |
| download | brew-60a30e966b7cece5bd4823dae3fb981ab85106ea.tar.bz2 | |
Merge pull request #3725 from MikeMcQuaid/fix-odeprecated-again1.5.2
utils: reduce odeprecated warnings.
| -rw-r--r-- | Library/Homebrew/utils.rb | 9 |
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] |
