Sha256: bfda439dcb804596f5863d8daf78eb1144aed5bc56e86462b03ecdff655dcff5

Contents?: true

Size: 840 Bytes

Versions: 3

Compression:

Stored size: 840 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Lint
      # This cop checks for calls to debugger or pry.
      class Debugger < Cop
        MSG = 'Remove calls to debugger.'

        # debugger call node
        #
        # (send nil :debugger)
        DEBUGGER_NODE = s(:send, nil, :debugger)

        # binding.pry node
        #
        # (send
        #   (send nil :binding) :pry)
        PRY_NODE = s(:send, s(:send, nil, :binding), :pry)

        # binding.remote_pry node
        #
        # (send
        #   (send nil :binding) :remote_pry)
        REMOTE_PRY_NODE = s(:send, s(:send, nil, :binding), :remote_pry)

        DEBUGGER_NODES = [DEBUGGER_NODE, PRY_NODE, REMOTE_PRY_NODE]

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.15.0 lib/rubocop/cop/lint/debugger.rb
rubocop-0.14.1 lib/rubocop/cop/lint/debugger.rb
rubocop-0.14.0 lib/rubocop/cop/lint/debugger.rb