Merge pull request #2838 from ilovezfs/allow-formula-name-in-description
formula_desc_cop: allow formula name in desc
This commit is contained in:
commit
1503c9fcb2
@ -72,9 +72,9 @@ module RuboCop
|
|||||||
problem "Description should start with a capital letter"
|
problem "Description should start with a capital letter"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if formula's name is used in formula's desc
|
# Check if formula's desc starts with formula's name
|
||||||
return unless regex_match_group(desc, /(^|[^a-z])#{@formula_name}([^a-z]|$)/i)
|
return unless regex_match_group(desc, /^#{@formula_name} /i)
|
||||||
problem "Description shouldn't include the formula name"
|
problem "Description shouldn't start with the formula name"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@ -146,11 +146,11 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do
|
|||||||
source = <<-EOS.undent
|
source = <<-EOS.undent
|
||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
url 'http://example.com/foo-1.0.tgz'
|
url 'http://example.com/foo-1.0.tgz'
|
||||||
desc 'Foo: foobar'
|
desc 'Foo is a foobar'
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
expected_offenses = [{ message: "Description shouldn't include the formula name",
|
expected_offenses = [{ message: "Description shouldn't start with the formula name",
|
||||||
severity: :convention,
|
severity: :convention,
|
||||||
line: 3,
|
line: 3,
|
||||||
column: 8,
|
column: 8,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user