From 39498af1c6f56fa63d068dff26abfec3b4556df1 Mon Sep 17 00:00:00 2001 From: Nikolaus Wittenstein Date: Tue, 19 May 2015 13:05:22 -0400 Subject: audit looks for and validates 'desc' --- Library/Homebrew/cmd/audit.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'Library') diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 7d0230ab2..923ea0cc1 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -244,6 +244,32 @@ class FormulaAuditor end end + def audit_desc + # For now, only check the description when using `--strict` + return unless @strict + + desc = formula.desc + + unless desc and desc.length > 0 + problem "Formula should have a desc (Description)." + return + end + + # Make sure the formula name plus description is no longer than 80 characters + linelength = formula.name.length + ": ".length + desc.length + if linelength > 80 + problem "Description is too long. \"name: desc\" should be less than 80 characters (currently #{linelength})." + end + + if desc =~ %r[[Cc]ommandline] + problem "It should be \"command-line\", not \"commandline\"." + end + + if desc =~ %r[[Cc]ommand line] + problem "It should be \"command-line\", not \"command line\"." + end + end + def audit_homepage homepage = formula.homepage @@ -706,6 +732,7 @@ class FormulaAuditor audit_file audit_class audit_specs + audit_desc audit_homepage audit_deps audit_conflicts -- cgit v1.2.3