-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
Is your feature request related to a problem? Please describe.
A new Naming/PredicateMethod
cop seems quite useful 😻
I noticed one case that it potentially could catch, but didn't, at the time: the return value is calculated by a predicate. For example:
class File
def ruby_file
name.end_with?('.rb')
end
end
This code doesn't trigger the cop.
Describe the solution you'd like
- the method should probably be named
ruby_file?
- in the assumption that every predicate returns booleans, the cop can fairly confidently guess that the statement in the body returns a boolean (if it is not -- it is bad code anyway).