class Rubocop::Cop::Style::DefWithParentheses
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 on_def(node)
def on_def(node) start_line = node.loc.keyword.line end_line = node.loc.end.line return if start_line == end_line _, args = *node if args.children == [] && args.loc.begin add_offence(:convention, args.loc.begin, MSG) end super end
def on_defs(node)
def on_defs(node) start_line = node.loc.keyword.line end_line = node.loc.end.line return if start_line == end_line _, _, args = *node if args.children == [] && args.loc.begin add_offence(:convention, args.loc.begin, MSG) end super end