From 0a4d10ba89f72304861aea0e74efb61abd985573 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 5 Dec 2023 19:12:14 +0100 Subject: [PATCH] Deprecate `--new-formula`/`--new-cask` options. --- Library/Homebrew/cli/parser.rb | 9 +++++---- Library/Homebrew/dev-cmd/audit.rb | 24 +++++++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index 993df1a3e8..9c1a6d1274 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -160,11 +160,12 @@ module Homebrew return if global_switch description = option_description(description, *names, hidden: hidden) - if replacement.nil? - process_option(*names, description, type: :switch, hidden: hidden) - else - description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})" + process_option(*names, description, type: :switch, hidden: hidden) unless disable + + if replacement || disable + description += " (#{disable ? "disabled" : "deprecated"}#{"; replaced by #{replacement}" if replacement})" end + @parser.public_send(method, *names, *wrap_option_desc(description)) do |value| # This odeprecated should stick around indefinitely. odeprecated "the `#{names.first}` switch", replacement, disable: disable if !replacement.nil? || disable diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 6d201ad279..2a849ddd9d 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -44,10 +44,22 @@ module Homebrew switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to audit them. " \ "Implied if `HOMEBREW_EVAL_ALL` is set." - switch "--new", "--new-formula", "--new-cask", + switch "--new", description: "Run various additional style checks to determine if a new formula or cask is eligible " \ - "for Homebrew. This should be used when creating new formula and implies " \ + "for Homebrew. This should be used when creating new formulae or casks and implies " \ "`--strict` and `--online`." + switch "--new-formula", + # odeprecated: uncomment `replacement` to enable the `odeprecated` handling in `CLI::Parser` + # replacement: "--new", + # odeprecated: remove `args.new_formula?` calls once this is `true` + disable: false, + hidden: true + switch "--new-cask", + # odeprecated: uncomment `replacement` to enable the `odeprecated` handling in `CLI::Parser` + # replacement: "--new", + # odeprecated: remove `args.new_cask?` calls once this is `true` + disable: false, + hidden: true switch "--[no-]signing", description: "Audit for signed apps, which are required on ARM" switch "--token-conflicts", @@ -101,6 +113,9 @@ module Homebrew def self.audit args = audit_args.parse + new_cask = args.new? || args.new_cask? + new_formula = args.new? || args.new_formula? + Formulary.enable_factory_cache! os_arch_combinations = args.os_arch_combinations @@ -108,7 +123,6 @@ module Homebrew Homebrew.auditing = true inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug? - new_formula = args.new_formula? strict = new_formula || args.strict? online = new_formula || args.online? tap_audit = args.tap.present? @@ -165,7 +179,7 @@ module Homebrew if only_cops style_options[:only_cops] = only_cops - elsif args.new_formula? + elsif new_formula || new_cask nil elsif except_cops style_options[:except_cops] = except_cops @@ -261,7 +275,7 @@ module Homebrew # No need for `|| nil` for `--[no-]signing` # because boolean switches are already `nil` if not passed audit_signing: args.signing?, - audit_new_cask: (args.new_cask? || nil), + audit_new_cask: (new_cask || nil), audit_token_conflicts: (args.token_conflicts? || nil), quarantine: true, any_named_args: !no_named_args,