utils: only try and replace tap or replaced methods.

This commit is contained in:
Mike McQuaid 2018-03-08 08:22:47 +00:00 committed by GitHub
parent 8668b7108a
commit 8860402f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,11 +109,7 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call
if ARGV.homebrew_developer? || disable ||
Homebrew.raise_deprecation_exceptions?
if caller_message.match?(HOMEBREW_LIBRARY_PATH/"cmd") ||
caller_message.match?(HOMEBREW_LIBRARY_PATH/"dev-cmd") &&
replacement_message == "There is no replacement."
developer_message = message
else
if replacement || tap
developer_message = message + "Or, even better, submit a PR to fix it!"
end
raise MethodDeprecatedError, developer_message