diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index 31953442f4..ea9a159fb9 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -167,6 +167,14 @@ module Homebrew @command_name = T.let(T.must(cmd_location.label).chomp("_args").tr("_", "-"), String) @is_dev_cmd = T.let(T.must(cmd_location.absolute_path).start_with?(Commands::HOMEBREW_DEV_CMD_PATH), T::Boolean) + # We allow this path only from `brew.rb`: + if @command_name != "
" + odeprecated( + "`brew #{@command_name}', which does not inherit from from Homebrew::AbstractCommand. This command " \ + "needs to be refactored, as it is written in a style that", + disable_for_developers: false, + ) + end end @constraints = T.let([], T::Array[[String, String]]) diff --git a/Library/Homebrew/extend/kernel.rb b/Library/Homebrew/extend/kernel.rb index 0d27cee937..601f89eb90 100644 --- a/Library/Homebrew/extend/kernel.rb +++ b/Library/Homebrew/extend/kernel.rb @@ -172,11 +172,13 @@ module Kernel disable = true if disable_for_developers && Homebrew::EnvConfig.developer? if disable || Homebrew.raise_deprecation_exceptions? + require "utils/github/actions" GitHub::Actions.puts_annotation_if_env_set(:error, message, file:, line:) exception = MethodDeprecatedError.new(message) exception.set_backtrace(backtrace) raise exception elsif !Homebrew.auditing? + require "utils/github/actions" GitHub::Actions.puts_annotation_if_env_set(:warning, message, file:, line:) opoo message end