Merge pull request #15003 from issyl0/audit-for-keg_only-HOMEBREW_PREFIX

formula_auditor: Having `HOMEBREW_PREFIX` in `keg_only` reasons is bad
This commit is contained in:
Mike McQuaid 2023-03-22 14:13:33 +00:00 committed by GitHub
commit 7ad3306e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -466,6 +466,16 @@ module Homebrew
"They must not be upgraded to version 7.11 or newer." "They must not be upgraded to version 7.11 or newer."
end end
def audit_keg_only_reason
return unless @core_tap
return unless formula.keg_only?
keg_only_message = text.to_s.match(/keg_only\s+["'](.*)["']/)&.captures&.first
return unless keg_only_message&.include?("HOMEBREW_PREFIX")
problem "`keg_only` reason should not include `HOMEBREW_PREFIX` as it creates confusing `brew info` output."
end
def audit_versioned_keg_only def audit_versioned_keg_only
return unless @versioned_formula return unless @versioned_formula
return unless @core_tap return unless @core_tap