Class: RuboCop::Cop::SketchupSuggestions::ModelEntities

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

Constant Summary collapse

MSG =
'Typically one should use model.active_entities instead of model.entities.'.freeze
MODEL_VARIABLE_NAMES =
%w[model mod]

Constants included from SketchUp::Config

SketchUp::Config::DEFAULT_CONFIGURATION

Instance Method Summary collapse

Methods inherited from SketchUp::Cop

inherited, #relevant_file?

Instance Method Details

#model_entities?(node) ⇒ Boolean

Returns:

  • (Boolean)

23
24
25
26
27
# File 'lib/rubocop/sketchup/cop/suggestions/model_entities.rb', line 23

def model_entities?(node)
  return true if active_model_entities?(node)
  name = entities_receiver(node)
  name && model_variable?(name)
end

#on_send(node) ⇒ Object


29
30
31
# File 'lib/rubocop/sketchup/cop/suggestions/model_entities.rb', line 29

def on_send(node)
  add_offense(node, location: :expression) if model_entities?(node)
end