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. If you create an extension that depend on the internal logic of another extension you are at the mercy of change and luck!

Constant Summary collapse

MSG =
'Avoid relying on internal logic of Dynamic Components.'

Constants included from SketchUp::DynamicComponentGlobals

SketchUp::DynamicComponentGlobals::DC_GLOBALS

Constants inherited from SketchUp::Cop

SketchUp::Cop::SKETCHUP_DEPARTMENT_SEVERITY

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



24
25
26
27
28
29
# File 'lib/rubocop/sketchup/cop/suggestions/dc_internals.rb', line 24

def check_global(node)
  global_var, = *node
  return unless dc_global_var?(global_var)

  add_offense(node, location: :name, severity: :warning)
end

#on_gvar(node) ⇒ Object



16
17
18
# File 'lib/rubocop/sketchup/cop/suggestions/dc_internals.rb', line 16

def on_gvar(node)
  check_global(node)
end

#on_gvasgn(node) ⇒ Object



20
21
22
# File 'lib/rubocop/sketchup/cop/suggestions/dc_internals.rb', line 20

def on_gvasgn(node)
  check_global(node)
end