diff options
| author | Dominyk Tiller | 2017-04-28 04:53:52 +0100 |
|---|---|---|
| committer | Dominyk Tiller | 2017-05-01 19:22:34 +0100 |
| commit | 85053b1476f9aee0f4608ea77f1594bec7014ac1 (patch) | |
| tree | b0f9bca69b92bac5aa80ee2bfcda5b35bef0ab0e /Library/Homebrew/dev-cmd | |
| parent | 285b0bc94154adb8b9b89038589e3194e80ece3d (diff) | |
| download | brew-85053b1476f9aee0f4608ea77f1594bec7014ac1.tar.bz2 | |
audit: add audit_keg_only_style
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" |
