From 075f818118387b0d4a198732ba9632cad9607633 Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Mon, 9 Oct 2017 17:01:35 +0100 Subject: [PATCH] formula_desc_cop: empty string is not a valid desc Just a slightly tweaked version of https://github.com/Homebrew/brew/issues/3286#issuecomment-334983011 --- Library/Homebrew/rubocops/formula_desc_cop.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/rubocops/formula_desc_cop.rb b/Library/Homebrew/rubocops/formula_desc_cop.rb index 2b613c9b49..2ef60303dc 100644 --- a/Library/Homebrew/rubocops/formula_desc_cop.rb +++ b/Library/Homebrew/rubocops/formula_desc_cop.rb @@ -18,8 +18,14 @@ module RuboCop return end - # Check if a formula's desc is too long + # Check the formula's desc length. Should be >0 and <80 characters. desc = parameters(desc_call).first + pure_desc_length = string_content(desc).length + if pure_desc_length.zero? + problem "The desc (description) should not be an empty string." + return + end + desc_length = "#{@formula_name}: #{string_content(desc)}".length max_desc_length = 80 return if desc_length <= max_desc_length