class RuboCop::Cop::Style::DefWithParentheses
end
# does a thing
def Baz.foo
# good
end
# does a thing
def Baz.foo()
# bad
@example
def foo() does_a_thing end
# also good
end
# does a thing
def foo
# good
end
# does a thing
def foo()
# bad
@example
class/singleton methods are checked.
that does not take any arguments. Both instance and
This cop checks for parentheses in the definition of a method,
def autocorrect(node)
def autocorrect(node) lambda do |corrector| corrector.remove(node.loc.begin) corrector.remove(node.loc.end) end end
def on_def(node)
def on_def(node) return if node.single_line? return unless !node.arguments? && node.arguments.loc.begin add_offense(node.arguments, location: :begin) end