Merge pull request #2472 from DomT4/keg_only

caveats: tweak keg_only wording
This commit is contained in:
Mike McQuaid 2017-05-02 15:17:37 +01:00 committed by GitHub
commit 7a0e5d123c
3 changed files with 43 additions and 10 deletions

View File

@ -44,8 +44,10 @@ class Caveats
def keg_only_text
return unless f.keg_only?
s = "This formula is keg-only, which means it was not symlinked into #{HOMEBREW_PREFIX}."
s << "\n\n#{f.keg_only_reason}\n"
s = <<-EOS.undent
This formula is keg-only, which means it was not symlinked into #{HOMEBREW_PREFIX},
because #{f.keg_only_reason}.
EOS
if f.bin.directory? || f.sbin.directory?
s << "\nIf you need to have this software first in your PATH run:\n"
if f.bin.directory?

View File

@ -489,6 +489,37 @@ class FormulaAuditor
EOS
end
def audit_keg_only_style
return unless @strict
return unless formula.keg_only?
whitelist = %w[
Apple
macOS
OS
Homebrew
Xcode
GPG
GNOME
BSD
].freeze
reason = formula.keg_only_reason.to_s
# Formulae names can legitimately be uppercase/lowercase/both.
name = Regexp.new(formula.name, Regexp::IGNORECASE)
reason.sub!(name, "")
first_word = reason.split[0]
if reason =~ /^[A-Z]/ && !reason.start_with?(*whitelist)
problem <<-EOS.undent
'#{first_word}' from the keg_only reason should be '#{first_word.downcase}'.
EOS
end
return unless reason.end_with?(".")
problem "keg_only reason should not end with a period."
end
def audit_options
formula.options.each do |o|
if o.name == "32-bit"

View File

@ -32,30 +32,30 @@ class KegOnlyReason
return @explanation unless @explanation.empty?
case @reason
when :versioned_formula then <<-EOS.undent
This is an alternate version of another formula.
this is an alternate version of another formula
EOS
when :provided_by_macos, :provided_by_osx then <<-EOS.undent
macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
parallel can cause all kinds of trouble
EOS
when :shadowed_by_macos, :shadowed_by_osx then <<-EOS.undent
macOS provides similar software and installing this software in
parallel can cause all kinds of trouble.
parallel can cause all kinds of trouble
EOS
when :provided_pre_mountain_lion then <<-EOS.undent
macOS already provides this software in versions before Mountain Lion.
macOS already provides this software in versions before Mountain Lion
EOS
when :provided_pre_mavericks then <<-EOS.undent
macOS already provides this software in versions before Mavericks.
macOS already provides this software in versions before Mavericks
EOS
when :provided_pre_el_capitan then <<-EOS.undent
macOS already provides this software in versions before El Capitan.
macOS already provides this software in versions before El Capitan
EOS
when :provided_until_xcode43 then <<-EOS.undent
Xcode provides this software prior to version 4.3.
Xcode provides this software prior to version 4.3
EOS
when :provided_until_xcode5 then <<-EOS.undent
Xcode provides this software prior to version 5.
Xcode provides this software prior to version 5
EOS
else
@reason