class RuboCop::Cop::Style::SuperWithArgsParentheses

Enforces the presence of parentheses in ‘super` containing arguments.

‘super` is a keyword and is provided as a distinct cop from those designed for method call.

@example

# bad
super name, age

# good
super(name, age)

Constants

MSG

Public Instance Methods

on_super(node) click to toggle source
# File lib/rubocop/cop/style/super_with_args_parentheses.rb, line 23
def on_super(node)
  return if node.parenthesized?

  add_offense(node) do |corrector|
    range = node.loc.keyword.end.join(node.first_argument.source_range.begin)
    corrector.replace(range, '(')
    corrector.insert_after(node.last_argument, ')')
  end
end