class RuboCop::Cop::SketchupRequirements::GlobalConstants

Extensions in SketchUp all share the same Ruby environment on the user's machine. Because of this it's important that each extension isolate itself to avoid clashing with other extensions.

Extensions submitted to Extension Warehouse is expected to not define global constants.

Constants

MSG

Public Instance Methods

on_casgn(node) click to toggle source

Constant assignment.

# File lib/rubocop/sketchup/cop/requirements/global_constants.rb, line 26
def on_casgn(node)
  return if namespaced_constant?(node)

  namespace = Namespace.new(node.parent_module_name)
  return unless namespace.top_level?

  add_offense(node, location: :name)
end