pass opitions as named parameters

This commit is contained in:
hyuraku 2023-04-12 20:16:10 +09:00
parent 4999639140
commit f7b51d8cd1

View File

@ -242,32 +242,32 @@ module Homebrew
odeprecated "`brew audit <cask> --display-failures-only`", "`brew audit <cask>` without the argument"
end
# For switches, we add `|| nil` so that `nil` will be passed instead of `false` if they aren't set.
# This way, we can distinguish between "not set" and "set to false".
options = {
audit_download: nil,
# No need for `|| nil` for `--[no-]signing` because boolean switches are already `nil` if not passed
audit_online: (args.online? || nil),
audit_strict: (args.strict? || nil),
audit_signing: args.signing?,
audit_new_cask: (args.new_cask? || nil),
audit_token_conflicts: (args.token_conflicts? || nil),
quarantine: nil,
language: nil,
any_named_args: !no_named_args,
only: args.only,
except: args.except,
}.compact
options[:quarantine] = true if options[:quarantine].nil?
Homebrew.auditing = true
require "cask/auditor"
audit_casks.to_h do |cask|
odebug "Auditing Cask #{cask}"
[cask.sourcefile_path, { errors: Cask::Auditor.audit(cask, **options), warnings: [] }]
[cask.sourcefile_path, { errors: Cask::Auditor.audit(
cask,
# For switches, we add `|| nil` so that `nil` will be passed
# instead of `false` if they aren't set.
# This way, we can distinguish between "not set" and "set to false".
audit_download: nil,
audit_online: (args.online? || nil),
audit_strict: (args.strict? || nil),
# 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_token_conflicts: (args.token_conflicts? || nil),
quarantine: true,
language: nil,
any_named_args: !no_named_args,
only: args.only,
except: args.except,
), warnings: [] }]
end
end