Sha256: 63e3e153b2034c9e54f3da45ab7a5432e038da351ef3ba1879d0993dc85df11a

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop checks for unwanted parentheses in parameterless method calls.
      class MethodCallParentheses < Cop
        MSG = 'Do not use parentheses for method calls with no arguments.'

        def on_send(node)
          _receiver, _method_name, *args = *node

          convention(node, :begin) if args.empty? && node.loc.begin
        end

        def autocorrect(node)
          @corrections << lambda do |corrector|
            corrector.remove(node.loc.begin)
            corrector.remove(node.loc.end)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.14.1 lib/rubocop/cop/style/method_call_parentheses.rb
rubocop-0.14.0 lib/rubocop/cop/style/method_call_parentheses.rb