Sha256: 3490133590f668df3bf2d6646bb3d40596503f4781001a2c00ea6663e58bb8a9

Contents?: true

Size: 449 Bytes

Versions: 4

Compression:

Stored size: 449 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    class ColonMethodCall < Cop
      MSG = 'Do not use :: for method invocation.'

      def on_send(node)
        receiver, _method_name, *_args = *node

        # discard methods with nil receivers and op methods(like [])
        if receiver && node.loc.dot && node.loc.dot.source == '::'
          add_offence(:convention, node.loc.line, MSG)
        end

        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 lib/rubocop/cop/colon_method_call.rb
rubocop-0.8.2 lib/rubocop/cop/colon_method_call.rb
rubocop-0.8.1 lib/rubocop/cop/colon_method_call.rb
rubocop-0.8.0 lib/rubocop/cop/colon_method_call.rb