class RuboCop::Cop::UmtsCustomCops::PredicateMethodMatcher

See the specs for examples.

Constants

MESSAGE

Public Instance Methods

on_send(node) click to toggle source
# File lib/umts-custom-cops/predicate_method_matcher.rb, line 33
def on_send(node)
  ends_with_question_mark = ->(method) { method.to_s.end_with? '?' }

  if generic_equality_expectation(node, &ends_with_question_mark) ||
     boolean_equality_expectation(node, &ends_with_question_mark)

    add_offense node, location: :expression, message: MESSAGE
  end
end