Merge pull request #15987 from apainintheneck/audit-cmd-only-flush-formulary-cache-when-needed

cmd/audit: only flush formulary cache when needed
This commit is contained in:
Mike McQuaid 2023-09-11 13:03:41 +01:00 committed by GitHub
commit 838cb3bef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,6 +187,8 @@ module Homebrew
spdx_license_data = SPDX.license_data
spdx_exception_data = SPDX.exception_data
clear_formulary_cache = [args.os, args.arch].any?
formula_problems = audit_formulae.sort.each_with_object({}) do |f, problems|
path = f.path
@ -208,7 +210,7 @@ module Homebrew
SimulateSystem.with os: os, arch: arch do
odebug "Auditing Formula #{f} on os #{os} and arch #{arch}"
Formulary.clear_cache
Formulary.clear_cache if clear_formulary_cache
audit_proc = proc { FormulaAuditor.new(Formulary.factory(path), **options).tap(&:audit) }