diff options
| author | Mike McQuaid | 2017-05-02 15:17:37 +0100 |
|---|---|---|
| committer | GitHub | 2017-05-02 15:17:37 +0100 |
| commit | 7a0e5d123c42e2fb907c0ad80cfe17125d8c9d56 (patch) | |
| tree | 0fa57766c11aeb8bd343954a36757efbf797c3be /Library/Homebrew/dev-cmd | |
| parent | b8e17502a304b987268340611127907fe6e0a518 (diff) | |
| parent | 25ffa301b8a4f3613886158f7a8848ca53e634f3 (diff) | |
| download | brew-7a0e5d123c42e2fb907c0ad80cfe17125d8c9d56.tar.bz2 | |
Merge pull request #2472 from DomT4/keg_only
caveats: tweak keg_only wording
Diffstat (limited to 'Library/Homebrew/dev-cmd')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 782405207..be53e1d6f 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -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" |
