Class: RuboCop::Cop::SketchupSuggestions::DynamicComponentInternals

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

Overview

Tapping into the internals of Dynamic Components is risky. It could change at any time.

Constant Summary collapse

MSG =
"Avoid relying on internal logic of Dynamic Components.".freeze

Constants included from SketchUp::DynamicComponentGlobals

SketchUp::DynamicComponentGlobals::DC_GLOBALS

Constants included from SketchUp::Config

SketchUp::Config::DEFAULT_CONFIGURATION

Instance Method Summary collapse

Methods inherited from SketchUp::Cop

inherited, #relevant_file?

Instance Method Details

#check_global(node) ⇒ Object



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

def check_global(node)
  global_var, = *node
  return unless dc_global_var?(global_var)
  add_offense(node, location: :name, severity: :error)
end

#on_gvar(node) ⇒ Object



14
15
16
# File 'lib/rubocop/sketchup/cop/suggestions/dc_internals.rb', line 14

def on_gvar(node)
  check_global(node)
end

#on_gvasgn(node) ⇒ Object



18
19
20
# File 'lib/rubocop/sketchup/cop/suggestions/dc_internals.rb', line 18

def on_gvasgn(node)
  check_global(node)
end