class Bundler::CLI::Gem

def ask_and_set_linter

def ask_and_set_linter
  linter_template = options[:linter] || Bundler.settings["gem.linter"]
  linter_template = deprecated_rubocop_option if linter_template.nil?
  if linter_template.to_s.empty?
    Bundler.ui.confirm "Do you want to add a code linter and formatter to your gem? " \
      "Supported Linters:\n" \
      "* RuboCop:       https://rubocop.org\n" \
      "* Standard:      https://github.com/testdouble/standard\n" \
      "\n"
    Bundler.ui.info hint_text("linter")
    result = Bundler.ui.ask "Enter a linter. rubocop/standard/(none):"
    if /rubocop|standard/.match?(result)
      linter_template = result
    else
      linter_template = false
    end
  end
  if Bundler.settings["gem.linter"].nil?
    Bundler.settings.set_global("gem.linter", linter_template)
  end
  # Once gem.linter safely set, unset the deprecated gem.rubocop
  unless Bundler.settings["gem.rubocop"].nil?
    Bundler.settings.set_global("gem.rubocop", nil)
  end
  if options[:linter] == Bundler.settings["gem.linter"]
    Bundler.ui.info "#{options[:linter]} is already configured, ignoring --linter flag."
  end
  linter_template
end