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)
end
end
def allow_this_picture?
end
)
subject.catch(s).should be_valid
end

View File

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