Class: RuboCop::Cop::SketchupRequirements::GlobalConstants

Inherits:
SketchUp::Cop
  • Object
show all
Includes:
SketchUp, SketchUp::NoCommentDisable
Defined in:
lib/rubocop/sketchup/cop/requirements/global_constants.rb

Constant Summary collapse

MSG =
'Do not introduce global constants.'.freeze

Constants included from SketchUp

SketchUp::CONFIG, SketchUp::VERSION, SketchUp::WorkaroundCop

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_casgn(node) ⇒ Object

Constant assignment.


20
21
22
23
24
# File 'lib/rubocop/sketchup/cop/requirements/global_constants.rb', line 20

def on_casgn(node)
  return if namespaced_constant?(node)
  namespace = Namespace.new(node.parent_module_name)
  add_offense(node, location: :name, severity: :error) if namespace.top_level?
end