diff options
| author | Isabell Long | 2017-05-27 23:17:44 +0100 |
|---|---|---|
| committer | Isabell Long | 2017-05-29 00:26:47 +0100 |
| commit | 279a4df6c3fa41f0b660d67f880ed2bc7c0be848 (patch) | |
| tree | 4730c6f20096a0f9a23e7c673246f942048d1ddc | |
| parent | fb33acbbe47162adf90e92cbb6b244f26a5a346e (diff) | |
| download | brew-279a4df6c3fa41f0b660d67f880ed2bc7c0be848.tar.bz2 | |
Match the "formula name in description" on word boundaries
- The regexp for the "check if formula name is used in formula's
description" cop matches every instance of the formula name if it
exists, whether it's in a word or not.
- For example, the formula `mon` has the description "Monitor
hosts/services/whatever and alert about problems". This makes
`brew audit --strict` complain because it matches "Monitor",
which isn't the formula name! The formula `pass` has the description
"Password manager". Again, the strict audit matches "Password",
which isn't an issue.
- Instead, this change matches on a word boundary, so it will match
`mon:`, or `mon `, but not "Monitor", or, for example, "harmony".
- I've changed the tests to account for this change.
| -rw-r--r-- | Library/Homebrew/rubocops/formula_desc_cop.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/rubocops/formula_desc_cop.rb b/Library/Homebrew/rubocops/formula_desc_cop.rb index 1fbf1ddbf..81068ac34 100644 --- a/Library/Homebrew/rubocops/formula_desc_cop.rb +++ b/Library/Homebrew/rubocops/formula_desc_cop.rb @@ -40,7 +40,7 @@ module RuboCop end # Check if formula's name is used in formula's desc - problem "Description shouldn't include the formula name" if regex_match_group(desc, /^#{@formula_name}/i) + problem "Description shouldn't include the formula name" if regex_match_group(desc, /^#{@formula_name}\b/i) end end end diff --git a/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb b/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb index 432b15e3c..bc92291af 100644 --- a/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb @@ -120,7 +120,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do source = <<-EOS.undent class Foo < Formula url 'http://example.com/foo-1.0.tgz' - desc 'Foo' + desc 'Foo: foobar' end EOS |
