Sha256: f9f5aedabbe624b0a4d9e8a18f703529e6e4d8a7842cda2b0aad241d0a16eaf6
Contents?: true
Size: 755 Bytes
Versions: 3
Compression:
Stored size: 755 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # This cop checks for methods invoked via the :: operator instead # of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir). class ColonMethodCall < Cop MSG = 'Do not use :: for method calls.' 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.is?('::') add_offence(:convention, node.loc.dot, MSG) do_autocorrect(node) end super end def autocorrect_action(node) replace(node.loc.dot, '.') end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
rubocop-0.9.1 | lib/rubocop/cop/style/colon_method_call.rb |
sabat-rubocop-0.9.0 | lib/rubocop/cop/style/colon_method_call.rb |
rubocop-0.9.0 | lib/rubocop/cop/style/colon_method_call.rb |