class RuboCop::Cop::Style::MethodCallWithArgsParentheses

puts ‘test’
# good if ‘puts` is listed in IgnoredMethods
array.delete(e)
# good
array.delete e
# bad
@example
users can ignore them by passing their names to IgnoredMethods option.
called without parentheses,
As in popular Ruby’s frameworks a lot of methods should always be
parameters.
This cop checks presence of parentheses in method calls containing

def args_begin(node)

def args_begin(node)
  loc = node.loc
  selector = node.super_type? ? loc.keyword : loc.selector
  selector.end.resize(1)
end

def args_end(node)

def args_end(node)
  node.loc.expression.end
end

def autocorrect(node)

def autocorrect(node)
  lambda do |corrector|
    corrector.replace(args_begin(node), '(')
    corrector.insert_after(args_end(node), ')')
  end
end

def ignored_list

def ignored_list
  cop_config['IgnoredMethods'].map(&:to_sym)
end

def on_send(node)

def on_send(node)
  _receiver, method_name, *args = *node
  return if ignored_list.include?(method_name)
  return if args.empty?
  return if operator_call?(node)
  return if parentheses?(node)
  add_offense(node, :selector)
end

def on_super(node)

def on_super(node)
  # super nodetype implies call with arguments.
  return if parentheses?(node)
  add_offense(node, :keyword)
end

def on_yield(node)

def on_yield(node)
  args = node.children
  return if args.empty?
  return if parentheses?(node)
  add_offense(node, :keyword)
end

def operator_call?(node)

def operator_call?(node)
  node.loc.operator || (reciever?(node) && !node.loc.dot)
end

def parentheses?(node)

def parentheses?(node)
  node.loc.begin
end

def reciever?(node)

def reciever?(node)
  !node.children[0].nil?
end