Class: RuboCop::Cop::SketchupPerformance::Typename

Inherits:
SketchUp::Cop
  • Object
show all
Defined in:
lib/rubocop/sketchup/cop/performance/typename.rb

Constant Summary collapse

MSG =
'`.typename` is very slow, prefer `.is_a?` instead.'.freeze

Constants included from SketchUp::Config

SketchUp::Config::DEFAULT_CONFIGURATION

Instance Method Summary collapse

Methods inherited from SketchUp::Cop

inherited, #relevant_file?

Instance Method Details

#on_send(node) ⇒ Object


9
10
11
12
13
14
15
# File 'lib/rubocop/sketchup/cop/performance/typename.rb', line 9

def on_send(node)
  _, method_name = *node
  return unless method_name == :typename  # TODO(thomthom): Should we try to detect use of #typename
  # in context of comparing against a string?

  add_offense(node, location: :expression)
end