Class: Rubocop::Cop::Lint::Debugger

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/lint/debugger.rb

Overview

This cop checks for calls to debugger or pry.

Constant Summary collapse

MSG =
'Remove calls to debugger.'
DEBUGGER_NODE =

debugger call node

(send nil :debugger)

s(:send, nil, :debugger)
PRY_NODE =

binding.pry node

(send (send nil :binding) :pry)

s(:send, s(:send, nil, :binding), :pry)
REMOTE_PRY_NODE =

binding.remote_pry node

(send (send nil :binding) :remote_pry)

s(:send, s(:send, nil, :binding), :remote_pry)
DEBUGGER_NODES =
[DEBUGGER_NODE, PRY_NODE, REMOTE_PRY_NODE]

Constants inherited from Cop

Cop::OPERATOR_METHODS

Instance Attribute Summary

Attributes inherited from Cop

#config, #corrections, #offences, #processed_source

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, all, #autocorrect?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, non_rails, rails?, style?, #support_autocorrect?, #warning

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#on_send(node) ⇒ Object



29
30
31
# File 'lib/rubocop/cop/lint/debugger.rb', line 29

def on_send(node)
  warning(node, :selector) if DEBUGGER_NODES.include?(node)
end