<commit_before>package org.jetbrains.sbt
package project.structure

import java.io.File

import com.intellij.openapi.application.PathManager
import org.jetbrains.plugins.scala.project.template.writeLinesTo

/**
 * @author <NAME>
 */
final class SbtException private(key: String, params: Seq[String])
  extends RuntimeException(SbtBundle.message(key, params))

object SbtException {

  private[this] val WarnRegexp = "^\\[warn]\\s*::\\s*((?!UNRESOLVED DEPENDENCIES).)*".r

  def apply(log: Seq[String]): SbtException = {
    val (key, params) = if (log.exists(_.startsWith("sbt.ResolveException"))) {
      ("sbt.import.unresolvedDependencies", Seq(handleUnresolvedDeps(log), dumpLog(log)))
    } else {
      ("sbt.import.error", Seq(log.mkString(System.getProperty("line.separator"))))
    }

    new SbtException(key, params)
  }

  private[this] def handleUnresolvedDeps(log: Seq[String]) =
    log.foldLeft(StringBuilder.newBuilder) {
      case (accumulator, WarnRegexp(group)) => accumulator.append("<li>").append(group).append("</li>")
      case (accumulator, _) => accumulator
    }.toString

  private[this] def dumpLog(log: Seq[String]) = {
    val logDir = new File(PathManager.getLogPath)
    logDir.mkdirs()

    val file = new File(logDir, "sbt.last.log")
    file.createNewFile()
<commit_msg>Refactored dynamic bundle keys in ultimate<commit_after>package org.jetbrains.sbt
package project.structure

import java.io.File

import com.intellij.openapi.application.PathManager
import org.jetbrains.plugins.scala.project.template.writeLinesTo

/**
 * @author <NAME>
 */
final class SbtException private(message: String)
  extends RuntimeException(message)

object SbtException {

  private[this] val WarnRegexp = "^\\[warn]\\s*::\\s*((?!UNRESOLVED DEPENDENCIES).)*".r

  def apply(log: Seq[String]): SbtException = {
    val message = if (log.exists(_.startsWith("sbt.ResolveException"))) {
      SbtBundle.message("sbt.import.unresolvedDependencies", handleUnresolvedDeps(log), dumpLog(log))
    } else {
      SbtBundle.message("sbt.import.error", log.mkString(System.getProperty("line.separator")))
    }

    new SbtException(message)
  }

  private[this] def handleUnresolvedDeps(log: Seq[String]) =
    log.foldLeft(StringBuilder.newBuilder) {
      case (accumulator, WarnRegexp(group)) => accumulator.append("<li>").append(group).append("</li>")
      case (accumulator, _) => accumulator
    }.toString

  private[this] def dumpLog(log: Seq[String]) = {
    val logDir = new File(PathManager.getLogPath)
    logDir.mkdirs()

    val file = new File(logDir, "sbt.last.log")
    file.createNewFile()

{'fraction_non_alphanumeric': 0.14967544864452081, 'fraction_numerical': 0.0, 'mean_word_length': 4.598290598290598, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3230672', 'n_tokens_mistral': 887, 'n_tokens_neox': 862, 'n_words': 150}