Sha256: acd5b7b8df67280b4d093a69d1b773f95ec327993a54a2d1b7e37a69b719cda3

Contents?: true

Size: 623 Bytes

Versions: 17

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Style
      # 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 < Base
        MSG = 'Prefer `Object#__send__` or `Object#public_send` to `send`.'
        RESTRICT_ON_SEND = %i[send].freeze

        def on_send(node)
          return unless node.arguments?

          add_offense(node.loc.selector)
        end
        alias on_csend on_send
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
rubocop-1.71.0 lib/rubocop/cop/style/send.rb
rubocop-1.70.0 lib/rubocop/cop/style/send.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/send.rb
rubocop-1.69.2 lib/rubocop/cop/style/send.rb
rubocop-1.69.1 lib/rubocop/cop/style/send.rb
rubocop-1.69.0 lib/rubocop/cop/style/send.rb
rubocop-1.68.0 lib/rubocop/cop/style/send.rb
rubocop-1.67.0 lib/rubocop/cop/style/send.rb
rubocop-1.66.1 lib/rubocop/cop/style/send.rb
rubocop-1.66.0 lib/rubocop/cop/style/send.rb
rubocop-1.65.1 lib/rubocop/cop/style/send.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/send.rb
rubocop-1.65.0 lib/rubocop/cop/style/send.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/send.rb
rubocop-1.64.1 lib/rubocop/cop/style/send.rb
rubocop-1.63.4 lib/rubocop/cop/style/send.rb
rubocop-1.63.3 lib/rubocop/cop/style/send.rb