Sha256: 7eebcd5b0194cd14400ff49329df4cb324aeb72d588f9a78287e3ea3ef146b42

Contents?: true

Size: 627 Bytes

Versions: 175

Compression:

Stored size: 627 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

175 entries across 168 versions & 15 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/style/send.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/style/send.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/style/send.rb
rubocop-1.63.2 lib/rubocop/cop/style/send.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/style/send.rb
rubocop-1.63.1 lib/rubocop/cop/style/send.rb
rubocop-1.63.0 lib/rubocop/cop/style/send.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.62.1/lib/rubocop/cop/style/send.rb
rubocop-1.62.1 lib/rubocop/cop/style/send.rb
rubocop-1.62.0 lib/rubocop/cop/style/send.rb
rubocop-1.61.0 lib/rubocop/cop/style/send.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.2/lib/rubocop/cop/style/send.rb
rubocop-1.60.2 lib/rubocop/cop/style/send.rb
study_line-0.2.7 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/style/send.rb
study_line-0.2.6 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/style/send.rb
study_line-0.2.5 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/style/send.rb
study_line-0.2.4 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/style/send.rb
study_line-0.2.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/style/send.rb
study_line-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/style/send.rb
rubocop-1.60.1 lib/rubocop/cop/style/send.rb