Class: RuboCop::Cop::SketchupRequirements::RegisterExtension

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

Overview

Always register extensions to load by default. Otherwise it might confuse users to think the extension isn't working.

Constant Summary collapse

MSG =
'Always register extensions to load by default.'.freeze

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


20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rubocop/sketchup/cop/requirements/register_extension.rb', line 20

def on_send(node)
  sketchup_register_extension(node).each { |args|
    if args.size < 2
      add_offense(node, severity: :error)
      next
    end
    load_arg = args[1]
    next if load_arg.true_type?
    add_offense(load_arg, severity: :error)
  }
end