class RuboCop::Cop::Style::AccessorMethodName

def attribute …
# good
def get_attribute …
# bad
def attribute=(value)
# good
def set_attribute(value) …
# bad
@example
This cop makes sure that accessor methods are named properly.

def bad_reader_name?(method_name, args)

def bad_reader_name?(method_name, args)
  method_name.start_with?('get_') && args.to_a.empty?
end

def bad_writer_name?(method_name, args)

def bad_writer_name?(method_name, args)
  method_name.start_with?('set_') && args.to_a.one?
end

def on_method_def(node, method_name, args, _body)

def on_method_def(node, method_name, args, _body)
  if bad_reader_name?(method_name.to_s, args)
    add_offense(node, :name,
                'Do not prefix reader method names with `get_`.')
  elsif bad_writer_name?(method_name.to_s, args)
    add_offense(node, :name,
                'Do not prefix writer method names with `set_`.')
  end
end