Report only wrong predicate names

This commit is contained in:
Vitalii Elenhaupt 2017-11-23 19:58:59 +02:00
parent dceafd26e5
commit 21abce63bd
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706
2 changed files with 4 additions and 1 deletions

View file

@ -13,6 +13,9 @@ module Ameba::Rule
def picture?(x) def picture?(x)
end end
end end
def allow_this_picture?
end
) )
subject.catch(s).should be_valid subject.catch(s).should be_valid
end end

View file

@ -39,7 +39,7 @@ module Ameba::Rule
end end
def test(source, node : Crystal::Def) def test(source, node : Crystal::Def)
if node.name =~ /(is|has)_(\w+)\?/ if node.name =~ /^(is|has)_(\w+)\?/
source.error self, node.location, source.error self, node.location,
"Favour method name '#{$2}?' over '#{node.name}'" "Favour method name '#{$2}?' over '#{node.name}'"
end end