Reports also methods not ending with `?` suffix in `PredicateName` rule
This commit is contained in:
parent
633ed7538e
commit
b3f11913ed
|
@ -30,6 +30,10 @@ module Ameba::Rule::Naming
|
|||
def is_valid?(x)
|
||||
# ^^^^^^^^^ error: Favour method name 'valid?' over 'is_valid?'
|
||||
end
|
||||
|
||||
def is_valid(x)
|
||||
# ^^^^^^^^ error: Favour method name 'valid?' over 'is_valid'
|
||||
end
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ module Ameba::Rule::Naming
|
|||
MSG = "Favour method name '%s?' over '%s'"
|
||||
|
||||
def test(source, node : Crystal::Def)
|
||||
return unless node.name =~ /^is_([a-z]\w*)\?$/
|
||||
return unless node.name =~ /^is_([a-z]\w*)\??$/
|
||||
alternative = $1
|
||||
|
||||
issue_for node, MSG % {alternative, node.name}, prefer_name_location: true
|
||||
|
|
Loading…
Reference in New Issue