class RuboCop::Server::CLI

def process_arguments(argv)

rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
def process_arguments(argv)
  server_arguments = delete_server_argument_from(argv)
  detach = !server_arguments.delete('--no-detach')
  if server_arguments.size >= 2
    return error("#{server_arguments.join(', ')} cannot be specified together.")
  end
  server_command = server_arguments.first
  unless detach || NO_DETACH_OPTIONS.include?(server_command)
    return error("#{server_command} cannot be combined with --no-detach.")
  end
  if EXCLUSIVE_OPTIONS.include?(server_command) && argv.count > allowed_option_count
    return error("#{server_command} cannot be combined with #{argv[0]}.")
  end
  if server_command.nil?
    server_command = ArgumentsEnv.read_as_arguments.delete('--server') ||
                     ArgumentsFile.read_as_arguments.delete('--server')
  end
  run_command(server_command, detach: detach)
  STATUS_SUCCESS
end