diff --git a/Library/Homebrew/cask/dsl.rb b/Library/Homebrew/cask/dsl.rb index 32021a702c1b70..bb5d36cf7ec44c 100644 --- a/Library/Homebrew/cask/dsl.rb +++ b/Library/Homebrew/cask/dsl.rb @@ -411,7 +411,7 @@ def caveats(*strings, &block) end def discontinued? - odeprecated "`discontinued?`", "`deprecated?` or `disabled?`" + odisabled "`discontinued?`", "`deprecated?` or `disabled?`" @caveats&.discontinued? == true end diff --git a/Library/Homebrew/cask/dsl/caveats.rb b/Library/Homebrew/cask/dsl/caveats.rb index 5872cb79108eb7..cd27bf0776038d 100644 --- a/Library/Homebrew/cask/dsl/caveats.rb +++ b/Library/Homebrew/cask/dsl/caveats.rb @@ -164,7 +164,7 @@ def eval_caveats(&block) end caveat :discontinued do - odeprecated "`caveats :discontinued`", "`deprecate!`" + odisabled "`caveats :discontinued`", "`deprecate!`" @discontinued = true <<~EOS #{@cask} has been officially discontinued upstream. diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index 13bc524901ea3a..3d9e6553e1ff69 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -166,11 +166,11 @@ def initialize(cmd = nil, &block) @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) - # odeprecated( - # "`brew #{@command_name}'. This command needs to be refactored, as it is written in a style that", - # "inheritance from `Homebrew::AbstractCommand' ( see https://docs.brew.sh/External-Commands )", - # disable_for_developers: false, - # ) + odeprecated( + "`brew #{@command_name}'. This command needs to be refactored, as it is written in a style that", + "inherits from `Homebrew::AbstractCommand' ( see https://docs.brew.sh/External-Commands )", + disable_for_developers: false, + ) end @constraints = T.let([], T::Array[[String, String]]) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 54da623d0feb5d..c2dfb656f9bb9c 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -61,10 +61,6 @@ class UpgradeCmd < AbstractCommand "formula is outdated. Otherwise, the repository's HEAD will only be checked for " \ "updates when a new stable or development version has been released.", }], - [:switch, "--ignore-pinned", { - description: "Set a successful exit status even if pinned formulae are not upgraded.", - hidden: true, - }], [:switch, "--keep-tmp", { description: "Retain the temporary files created during installation.", }], @@ -124,9 +120,6 @@ class UpgradeCmd < AbstractCommand sig { override.void } def run - # Disabled since this is now the default behavior. - odisabled "`brew upgrade --ignore-pinned`" if args.ignore_pinned? - formulae, casks = args.named.to_resolved_formulae_to_casks # If one or more formulae are specified, but no casks were # specified, we want to make note of that so we don't diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index 1f42fda187c9db..52cd7b1ddb576c 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -27,8 +27,6 @@ class BumpCaskPr < AbstractCommand "to the cask file." switch "--no-audit", description: "Don't run `brew audit` before opening the PR." - switch "--online", - hidden: true switch "--no-style", description: "Don't run `brew style --fix` before opening the PR." switch "--no-browse", @@ -60,8 +58,6 @@ class BumpCaskPr < AbstractCommand sig { override.void } def run - odisabled "brew bump-cask-pr --online" if args.online? - # This will be run by `brew audit` or `brew style` later so run it first to # not start spamming during normal output. gem_groups = [] diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 12a4a636adf232..5f93b441a367f9 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -507,10 +507,6 @@ def check_throttle(formula, new_version) return if tap.nil? throttled_rate = formula.livecheck.throttle - throttled_rate ||= if (rate = tap.audit_exceptions.dig(:throttled_formulae, formula.name)) - odisabled "throttled_formulae.json", "Livecheck#throttle" - rate - end return if throttled_rate.blank? formula_suffix = Version.new(new_version).patch.to_i diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index 4965b8d6220ecd..f2ec8555b5c384 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -41,7 +41,6 @@ def run Homebrew.setup_gem_environment! if args.stackprof? - # odeprecated. vernier is better in every way with_env HOMEBREW_STACKPROF: "1" do system(*HOMEBREW_RUBY_EXEC_ARGS, brew_rb, *args.named) end diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 9a895611b8d3c2..9f9bb1135f5bfc 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -76,13 +76,6 @@ def quiet! @quiet = true end - # Disable any output during downloading. - sig { void } - def shutup! - odisabled "`AbstractDownloadStrategy#shutup!`", "`AbstractDownloadStrategy#quiet!`" - quiet! - end - def quiet? Context.current.quiet? || @quiet end diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 1f8cd606dd87c8..0df8d17dd43e1a 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -509,7 +509,7 @@ def rmtree(noop: nil, verbose: nil, secure: nil) # create a RuboCop autocorrect instead soon. # This is why monkeypatching is non-ideal (but right solution to get # Ruby 3.3 over the line). - # odeprecated "rmtree", "FileUtils#rm_r" + odeprecated "rmtree", "FileUtils#rm_r" FileUtils.rm_r(@path, noop:, verbose:, secure:) nil end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 48749f0ac31861..74ab4a987bdb07 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1234,7 +1234,7 @@ def with_logging(log_type) # # @see https://www.unix.com/man-page/all/5/plist/ plist(5) man page def plist - odeprecated "`Formula#plist`", "`Homebrew::Service`" + odisabled "`Formula#plist`", "`Homebrew::Service`" nil end @@ -2777,12 +2777,12 @@ def on_system_blocks_exist? ).returns(Pathname) } def fetch(verify_download_integrity: true, timeout: nil, quiet: false) - # odeprecated "Formula#fetch", "Resource#fetch on Formula#resource" + odeprecated "Formula#fetch", "Resource#fetch on Formula#resource" active_spec.fetch(verify_download_integrity:, timeout:, quiet:) end def verify_download_integrity(filename) - # odeprecated "Formula#verify_download_integrity", "Resource#verify_download_integrity on Formula#resource" + odeprecated "Formula#verify_download_integrity", "Resource#verify_download_integrity on Formula#resource" active_spec.verify_download_integrity(filename) end @@ -2887,8 +2887,8 @@ def install; end def inreplace(paths, before = nil, after = nil, old_audit_result = nil, audit_result: true, &block) # NOTE: must check for `#nil?` and not `#blank?`, or else `old_audit_result = false` will not call `odeprecated`. unless old_audit_result.nil? - # odeprecated "inreplace(paths, before, after, #{old_audit_result})", - # "inreplace(paths, before, after, audit_result: #{old_audit_result})" + odeprecated "inreplace(paths, before, after, #{old_audit_result})", + "inreplace(paths, before, after, audit_result: #{old_audit_result})" audit_result = old_audit_result end Utils::Inreplace.inreplace(paths, before, after, audit_result:, &block) @@ -3749,7 +3749,7 @@ def resource(name, klass = Resource, &block) # # @api public def go_resource(name, &block) - odeprecated "`Formula.go_resource`", "Go modules" + odisabled "`Formula.go_resource`", "Go modules" specs.each { |spec| spec.go_resource(name, &block) } end diff --git a/Library/Homebrew/git_repository.rb b/Library/Homebrew/git_repository.rb index c8c36e36c2ac84..65a03ea35d81f9 100644 --- a/Library/Homebrew/git_repository.rb +++ b/Library/Homebrew/git_repository.rb @@ -19,8 +19,13 @@ def initialize(pathname) def git_repository? pathname.join(".git").exist? end - # odeprecated: use git_repository? instead - alias git_repo? git_repository? + + sig { returns(T::Boolean) } + def git_repo? + # delete this whole function when removing odisabled + odeprecated "GitRepository#git_repo?", "GitRepository#git_repository?" + git_repository? + end # Gets the URL of the Git origin remote. sig { returns(T.nilable(String)) } diff --git a/Library/Homebrew/github_packages.rb b/Library/Homebrew/github_packages.rb index 3af412251552cf..a3cde6b1ec6db0 100644 --- a/Library/Homebrew/github_packages.rb +++ b/Library/Homebrew/github_packages.rb @@ -123,11 +123,11 @@ def self.image_formula_name(formula_name) end def self.image_version_rebuild(version_rebuild) - return version_rebuild if version_rebuild.match?(VALID_OCI_TAG_REGEX) + unless version_rebuild.match?(VALID_OCI_TAG_REGEX) + raise ArgumentError, "GitHub Packages versions must match #{VALID_OCI_TAG_REGEX.source}!" + end - odisabled "GitHub Packages versions that do not match #{VALID_OCI_TAG_REGEX.source}", - "declaring a new `version` without these characters" - version_rebuild.gsub(INVALID_OCI_TAG_CHARS_REGEX, ".") + version_rebuild end private diff --git a/Library/Homebrew/language/go.rb b/Library/Homebrew/language/go.rb index 6118ffc5bb312e..2dc65920e5de41 100644 --- a/Library/Homebrew/language/go.rb +++ b/Library/Homebrew/language/go.rb @@ -14,7 +14,7 @@ module Go # e.g. `resource "github.com/foo/bar"`. sig { params(resources: T::Array[Resource], target: T.any(String, Pathname)).void } def self.stage_deps(resources, target) - odeprecated "`Language::Go.stage_deps`", "Go modules" + odisabled "`Language::Go.stage_deps`", "Go modules" if resources.empty? if Homebrew::EnvConfig.developer? odie "Tried to stage empty Language::Go resources array" diff --git a/Library/Homebrew/os/linux.rb b/Library/Homebrew/os/linux.rb index 7f5c32d85a15da..88a5843e728ee4 100644 --- a/Library/Homebrew/os/linux.rb +++ b/Library/Homebrew/os/linux.rb @@ -56,65 +56,6 @@ module Mac ::MacOS = OS::Mac raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] - - def self.version - odisabled "`MacOS.version` on Linux" - MacOSVersion::NULL - end - - def self.full_version - odisabled "`MacOS.full_version` on Linux" - MacOSVersion::NULL - end - - def self.languages - odisabled "`MacOS.languages` on Linux" - @languages ||= Array(ENV["LANG"]&.slice(/[a-z]+/)).uniq - end - - def self.language - odisabled "`MacOS.language` on Linux" - languages.first - end - - def self.sdk_root_needed? - odisabled "`MacOS.sdk_root_needed?` on Linux" - false - end - - def self.sdk_path_if_needed(_version = nil) - odisabled "`MacOS.sdk_path_if_needed` on Linux" - nil - end - - def self.sdk_path(_version = nil) - odisabled "`MacOS.sdk_path` on Linux" - nil - end - - module Xcode - def self.version - odisabled "`MacOS::Xcode.version` on Linux" - ::Version::NULL - end - - def self.installed? - odisabled "`MacOS::Xcode.installed?` on Linux" - false - end - end - - module CLT - def self.version - odisabled "`MacOS::CLT.version` on Linux" - ::Version::NULL - end - - def self.installed? - odisabled "`MacOS::CLT.installed?` on Linux" - false - end - end end # rubocop:enable Style/Documentation end diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 3a65aeab2f744a..7260b4b7b10f2a 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -35,7 +35,7 @@ def self.version # @api internal sig { returns(MacOSVersion) } def self.full_version - odisabled "`MacOS.full_version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS.full_version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? @full_version ||= if (fake_macos = ENV.fetch("HOMEBREW_FAKE_MACOS", nil)) # for Portable Ruby building MacOSVersion.new(fake_macos) else @@ -68,7 +68,7 @@ def self.preferred_perl_version end def self.languages - odisabled "`MacOS.languages` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS.languages` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? return @languages if @languages os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages") @@ -82,7 +82,7 @@ def self.languages end def self.language - odisabled "`MacOS.language` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS.language` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? languages.first end @@ -93,7 +93,7 @@ def self.active_developer_dir sig { returns(T::Boolean) } def self.sdk_root_needed? - odisabled "`MacOS.sdk_root_needed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS.sdk_root_needed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? if MacOS::CLT.installed? # If there's no CLT SDK, return false return false unless MacOS::CLT.provides_sdk? @@ -142,13 +142,13 @@ def self.sdk_for_formula(formula, version = nil, check_only_runtime_requirements # Returns the path to an SDK or nil, following the rules set by {sdk}. def self.sdk_path(version = nil) - odisabled "`MacOS.sdk_path` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS.sdk_path` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? s = sdk(version) s&.path end def self.sdk_path_if_needed(version = nil) - odisabled "`MacOS.sdk_path_if_needed` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS.sdk_path_if_needed` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? # Prefer CLT SDK when both Xcode and the CLT are installed. # Expected results: # 1. On Xcode-only systems, return the Xcode SDK. diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 1372a03ec6099b..df54e3662cd30f 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -126,7 +126,7 @@ def self.bundle_path sig { returns(T::Boolean) } def self.installed? - odisabled "`MacOS::Xcode.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS::Xcode.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? !prefix.nil? end @@ -178,7 +178,7 @@ def self.update_instructions # @api internal sig { returns(::Version) } def self.version - odisabled "`MacOS::Xcode.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS::Xcode.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? # may return a version string # that is guessed based on the compiler, so do not # use it in order to check if Xcode is installed. @@ -278,7 +278,7 @@ module CLT # Returns true even if outdated tools are installed. sig { returns(T::Boolean) } def self.installed? - odisabled "`MacOS::CLT.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS::CLT.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? !version.null? end @@ -423,7 +423,7 @@ def self.detect_version_from_clang_version # @api internal sig { returns(::Version) } def self.version - odisabled "`MacOS::CLT.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + raise "`MacOS::CLT.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? if @version ||= detect_version ::Version.new @version else diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 5c4bd6f911c490..45106519bf4740 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -154,7 +154,7 @@ def resource(name = T.unsafe(nil), klass = Resource, &block) end def go_resource(name, &block) - odeprecated "`SoftwareSpec#go_resource`", "Go modules" + odisabled "`SoftwareSpec#go_resource`", "Go modules" resource name, Resource::Go, &block end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index dd78d0a97c3a56..c5632e6bed0cad 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -157,8 +157,13 @@ def self.forbidden_taps # # @api public attr_reader :repository - # odeprecated: use repository instead. - alias repo repository + + sig { returns(T::Boolean) } + def repo + # delete this whole function when removing odisabled + odeprecated "Tap#repo", "Tap#repository" + repository + end # The name of this {Tap}. It combines {#user} and {#repository} with a slash. # {#name} is always in lowercase. @@ -288,8 +293,13 @@ def repository_var_suffix .tr("^A-Za-z0-9", "_") .upcase end - # odeprecated: use repository_var_suffix instead. - alias repo_var_suffix repository_var_suffix + + sig { returns(String) } + def repo_var_suffix + # delete this whole function when removing odisabled + odeprecated "Tap#repo_var_suffix", "Tap#repository_var_suffix" + repository_var_suffix + end # Check whether this {Tap} is a Git repository. # @@ -1059,7 +1069,7 @@ def self.each(&block) # An array of all installed {Tap} names. sig { returns(T::Array[String]) } def self.names - odeprecated "`#{self}.names`" + odisabled "`#{self}.names`" map(&:name).sort end @@ -1165,7 +1175,7 @@ def ensure_installed! sig { void } def self.ensure_installed! - odeprecated "`#{self}.ensure_installed!`", "`#{self}.instance.ensure_installed!`" + odisabled "`#{self}.ensure_installed!`", "`#{self}.instance.ensure_installed!`" instance.ensure_installed! end diff --git a/Library/Homebrew/utils/string_inreplace_extension.rb b/Library/Homebrew/utils/string_inreplace_extension.rb index e1a1cc625ed353..49250528ddb8a8 100644 --- a/Library/Homebrew/utils/string_inreplace_extension.rb +++ b/Library/Homebrew/utils/string_inreplace_extension.rb @@ -39,8 +39,8 @@ def sub!(before, after) def gsub!(before, after, old_audit_result = nil, audit_result: true) # NOTE: must check for `#nil?` and not `#blank?`, or else `old_audit_result = false` will not call `odeprecated`. unless old_audit_result.nil? - # odeprecated "gsub!(before, after, #{old_audit_result})", - # "gsub!(before, after, audit_result: #{old_audit_result})" + odeprecated "gsub!(before, after, #{old_audit_result})", + "gsub!(before, after, audit_result: #{old_audit_result})" audit_result = old_audit_result end before = before.to_s if before.is_a?(Pathname)