Deprecate --new-formula/--new-cask options.

This commit is contained in:
Markus Reiter 2023-12-05 19:12:14 +01:00
parent fc25915359
commit 0a4d10ba89
No known key found for this signature in database
GPG Key ID: 245293B51702655B
2 changed files with 24 additions and 9 deletions

View File

@ -160,11 +160,12 @@ module Homebrew
return if global_switch return if global_switch
description = option_description(description, *names, hidden: hidden) description = option_description(description, *names, hidden: hidden)
if replacement.nil? process_option(*names, description, type: :switch, hidden: hidden) unless disable
process_option(*names, description, type: :switch, hidden: hidden)
else if replacement || disable
description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})" description += " (#{disable ? "disabled" : "deprecated"}#{"; replaced by #{replacement}" if replacement})"
end end
@parser.public_send(method, *names, *wrap_option_desc(description)) do |value| @parser.public_send(method, *names, *wrap_option_desc(description)) do |value|
# This odeprecated should stick around indefinitely. # This odeprecated should stick around indefinitely.
odeprecated "the `#{names.first}` switch", replacement, disable: disable if !replacement.nil? || disable odeprecated "the `#{names.first}` switch", replacement, disable: disable if !replacement.nil? || disable

View File

@ -44,10 +44,22 @@ module Homebrew
switch "--eval-all", switch "--eval-all",
description: "Evaluate all available formulae and casks, whether installed or not, to audit them. " \ description: "Evaluate all available formulae and casks, whether installed or not, to audit them. " \
"Implied if `HOMEBREW_EVAL_ALL` is set." "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 " \ 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`." "`--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", switch "--[no-]signing",
description: "Audit for signed apps, which are required on ARM" description: "Audit for signed apps, which are required on ARM"
switch "--token-conflicts", switch "--token-conflicts",
@ -101,6 +113,9 @@ module Homebrew
def self.audit def self.audit
args = audit_args.parse args = audit_args.parse
new_cask = args.new? || args.new_cask?
new_formula = args.new? || args.new_formula?
Formulary.enable_factory_cache! Formulary.enable_factory_cache!
os_arch_combinations = args.os_arch_combinations os_arch_combinations = args.os_arch_combinations
@ -108,7 +123,6 @@ module Homebrew
Homebrew.auditing = true Homebrew.auditing = true
inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug? inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug?
new_formula = args.new_formula?
strict = new_formula || args.strict? strict = new_formula || args.strict?
online = new_formula || args.online? online = new_formula || args.online?
tap_audit = args.tap.present? tap_audit = args.tap.present?
@ -165,7 +179,7 @@ module Homebrew
if only_cops if only_cops
style_options[:only_cops] = only_cops style_options[:only_cops] = only_cops
elsif args.new_formula? elsif new_formula || new_cask
nil nil
elsif except_cops elsif except_cops
style_options[:except_cops] = except_cops style_options[:except_cops] = except_cops
@ -261,7 +275,7 @@ module Homebrew
# No need for `|| nil` for `--[no-]signing` # No need for `|| nil` for `--[no-]signing`
# because boolean switches are already `nil` if not passed # because boolean switches are already `nil` if not passed
audit_signing: args.signing?, audit_signing: args.signing?,
audit_new_cask: (args.new_cask? || nil), audit_new_cask: (new_cask || nil),
audit_token_conflicts: (args.token_conflicts? || nil), audit_token_conflicts: (args.token_conflicts? || nil),
quarantine: true, quarantine: true,
any_named_args: !no_named_args, any_named_args: !no_named_args,