class RuboCop::Cop::Style::DefWithParentheses
end
do_something
def Baz.foo
# good
end
do_something
def Baz.foo()
# bad
@example
def foo() do_something end
# good (without parentheses it’s a syntax error)
def foo = do_something
# good
def foo() = do_something
# bad
end
do_something
def foo
# good
end
do_something
def foo()
# bad
@example
class/singleton methods are checked.
that does not take any arguments. Both instance and
Checks for parentheses in the definition of a method,
def on_def(node)
def on_def(node) return if node.single_line? && !node.endless? return unless !node.arguments? && (node_arguments = node.arguments.source_range) add_offense(node_arguments) do |corrector| corrector.remove(node_arguments) end end