Class: RuboCop::Cop::SketchupRequirements::Exit

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

Overview

Don’t attempt to kill the Ruby interpreter by calling ‘exit` or `exit!`. SketchUp will trap `exit` and prevent that, with a message in the console. But `exit!` is not trapped and with terminate SketchUp without shutting down cleanly. Use `return`, `next` or `break` instead.

Constant Summary collapse

MSG =
'Exit attempts to kill the Ruby interpreter. Use return, next or break instead.'.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



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

def on_send(node)
  add_offense(node, location: :expression, severity: :error) if exit?(node)
end