diff options
| author | Dominyk Tiller | 2017-10-09 17:01:35 +0100 |
|---|---|---|
| committer | Dominyk Tiller | 2017-10-14 02:48:55 +0100 |
| commit | 075f818118387b0d4a198732ba9632cad9607633 (patch) | |
| tree | 5c500d33157a05e75985cb1b63b1d240d5f25f8b /Library | |
| parent | e1808bf0e35d522cda4ee4803f13746b604713f5 (diff) | |
| download | brew-075f818118387b0d4a198732ba9632cad9607633.tar.bz2 | |
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
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/rubocops/formula_desc_cop.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Library/Homebrew/rubocops/formula_desc_cop.rb b/Library/Homebrew/rubocops/formula_desc_cop.rb index 2b613c9b4..2ef60303d 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 |
