Sha256: 918f46bbc9ff39cb3f5a272932f6c3bd15afdf17391ba63ad7d5fc552ecdc310

Contents?: true

Size: 671 Bytes

Versions: 26

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Style
      # This cop checks for the use of the send method.
      #
      # @example
      #   # bad
      #   Foo.send(:bar)
      #   quuz.send(:fred)
      #
      #   # good
      #   Foo.__send__(:bar)
      #   quuz.public_send(:fred)
      class Send < Cop
        MSG = 'Prefer `Object#__send__` or `Object#public_send` to ' \
              '`send`.'.freeze

        def_node_matcher :sending?, '(send _ :send ...)'

        def on_send(node)
          return unless sending?(node) && node.arguments?

          add_offense(node, location: :selector)
        end
      end
    end
  end
end

Version data entries

26 entries across 24 versions & 3 rubygems

Version Path
rubocop-0.63.1 lib/rubocop/cop/style/send.rb
rubocop-0.63.0 lib/rubocop/cop/style/send.rb
rubocop-0.62.0 lib/rubocop/cop/style/send.rb
rubocop-0.61.1 lib/rubocop/cop/style/send.rb
rubocop-0.61.0 lib/rubocop/cop/style/send.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/style/send.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/style/send.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/style/send.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/style/send.rb
rubocop-0.60.0 lib/rubocop/cop/style/send.rb
rubocop-0.59.2 lib/rubocop/cop/style/send.rb
rubocop-0.59.1 lib/rubocop/cop/style/send.rb
rubocop-0.59.0 lib/rubocop/cop/style/send.rb
rubocop-0.58.2 lib/rubocop/cop/style/send.rb
rubocop-0.58.1 lib/rubocop/cop/style/send.rb
rubocop-0.58.0 lib/rubocop/cop/style/send.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/cop/style/send.rb
rubocop-0.57.2 lib/rubocop/cop/style/send.rb
rubocop-0.57.1 lib/rubocop/cop/style/send.rb
rubocop-0.57.0 lib/rubocop/cop/style/send.rb