Alphabetical envvars; better variable names; just the one loop

This commit is contained in:
Issy Long 2025-01-04 14:17:01 +00:00
parent 296c2b9f3f
commit ce562c312b
No known key found for this signature in database
2 changed files with 11 additions and 16 deletions

View File

@ -93,24 +93,19 @@ module Homebrew
end end
if skip_autobump? if skip_autobump?
autobump_files = {} autobump_lists = {}
formulae_and_casks_to_check.each do |formula_or_cask|
tap = formula_or_cask.tap
next if tap.nil?
autobump_files[tap] ||= begin
autobump_path = tap.path/".github/autobump.txt"
autobump_path.exist? ? File.read(autobump_path).lines.map(&:strip) : []
end
end
formulae_and_casks_to_check = formulae_and_casks_to_check.reject do |formula_or_cask| formulae_and_casks_to_check = formulae_and_casks_to_check.reject do |formula_or_cask|
tap = formula_or_cask.tap tap = formula_or_cask.tap
next false if tap.nil? next false if tap.nil?
autobump_lists[tap] ||= begin
autobump_path = tap.path/".github/autobump.txt"
autobump_path.exist? ? autobump_path.readlines.map(&:strip) : []
end
name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
if autobump_files[tap].include?(name) if autobump_lists[tap].include?(name)
odebug "Skipping #{name} as it is autobumped in #{tap}." odebug "Skipping #{name} as it is autobumped in #{tap}."
true true
end end

View File

@ -296,6 +296,10 @@ module Homebrew
default_text: 'The "Beer Mug" emoji.', default_text: 'The "Beer Mug" emoji.',
default: "🍺", default: "🍺",
}, },
HOMEBREW_LIVECHECK_AUTOBUMP: {
description: "If set, `brew livecheck` will include data for packages that are autobumped by BrewTestBot.",
boolean: true,
},
HOMEBREW_LIVECHECK_WATCHLIST: { HOMEBREW_LIVECHECK_WATCHLIST: {
description: "Consult this file for the list of formulae to check by default when no formula argument " \ description: "Consult this file for the list of formulae to check by default when no formula argument " \
"is passed to `brew livecheck`.", "is passed to `brew livecheck`.",
@ -303,10 +307,6 @@ module Homebrew
"or `$HOME/.homebrew/livecheck_watchlist.txt` otherwise.", "or `$HOME/.homebrew/livecheck_watchlist.txt` otherwise.",
default: "#{ENV.fetch("HOMEBREW_USER_CONFIG_HOME")}/livecheck_watchlist.txt", default: "#{ENV.fetch("HOMEBREW_USER_CONFIG_HOME")}/livecheck_watchlist.txt",
}, },
HOMEBREW_LIVECHECK_AUTOBUMP: {
description: "If set, `brew livecheck` will include data for packages that are autobumped by BrewTestBot.",
boolean: true,
},
HOMEBREW_LOCK_CONTEXT: { HOMEBREW_LOCK_CONTEXT: {
description: "If set, Homebrew will add this output as additional context for locking errors. " \ description: "If set, Homebrew will add this output as additional context for locking errors. " \
"This is useful when running `brew` in the background.", "This is useful when running `brew` in the background.",