<commit_before>import sbt._
import xerial.sbt.Sonatype.autoImport.sonatypePublishToBundle

object Common {
  import Keys._

  private[this] val unusedWarnings = Def.setting(
    CrossVersion.partialVersion(scalaVersion.value) match {
      case Some((2, _)) => Seq(
        "-Ywarn-unused:imports"
      )
      case _ =>
        Nil
    }
  )

  val Scala212 = "2.12.13"

  val settings: Seq[Setting[_]] = Defaults.coreDefaultSettings ++ Seq(
    organization := "ws.unfiltered",

    crossScalaVersions := Seq("2.13.5", Scala212),

    scalaVersion := Scala212,

    scalacOptions ++=
      Seq("-encoding", "utf8", "-deprecation", "-unchecked", "-feature"),

    scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)){
      case Some((2, _)) =>
        Seq("-Xcheckinit")
    }.toList.flatten,

    scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)){
      case Some((2, v)) if v <= 12 =>
        Seq("-Ywarn-adapted-args", "-Xfuture")
    }.toList.flatten,

    scalacOptions ++= unusedWarnings.value,

    Test / fork := true,

    Compile / doc / sources := {
      CrossVersion.partialVersion(scalaVersion.value) match {
        case Some((2, _)) =>
          (Compile / doc / sources).value
        case _ =>
          Nil // TODO enable scaladoc for Scala 3
      }
    },

    (Compile / doc / scalacOptions) ++= {
      val hash = sys.process.Process("git rev-parse HEAD").lineStream_!.head
      val base = (LocalRootProject / baseDirectory).value.getAbsolutePath
      CrossVersion.partialVersion(scalaVersion.value) match {
        case Some((3, _)) =>
          Nil
        case _ =>
          Seq(
            "-sourcepath",
            base,
            "-doc-source-url",<commit_msg>remove specs2 from testFrameworks if Scala 3<commit_after>import sbt._
import xerial.sbt.Sonatype.autoImport.sonatypePublishToBundle

object Common {
  import Keys._

  private[this] val unusedWarnings = Def.setting(
    CrossVersion.partialVersion(scalaVersion.value) match {
      case Some((2, _)) => Seq(
        "-Ywarn-unused:imports"
      )
      case _ =>
        Nil
    }
  )

  val Scala212 = "2.12.13"

  val settings: Seq[Setting[_]] = Defaults.coreDefaultSettings ++ Seq(
    organization := "ws.unfiltered",

    crossScalaVersions := Seq("2.13.5", Scala212),

    scalaVersion := Scala212,

    scalacOptions ++=
      Seq("-encoding", "utf8", "-deprecation", "-unchecked", "-feature"),

    scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)){
      case Some((2, _)) =>
        Seq("-Xcheckinit")
    }.toList.flatten,

    scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)){
      case Some((2, v)) if v <= 12 =>
        Seq("-Ywarn-adapted-args", "-Xfuture")
    }.toList.flatten,

    scalacOptions ++= unusedWarnings.value,

    Test / fork := true,

    Compile / doc / sources := {
      CrossVersion.partialVersion(scalaVersion.value) match {
        case Some((2, _)) =>
          (Compile / doc / sources).value
        case _ =>
          Nil // TODO enable scaladoc for Scala 3
      }
    },
    
    testFrameworks --= {
      CrossVersion.partialVersion(scalaVersion.value) match {
        case Some((2, _)) =>
          Nil
        case _ =>
          // specs2 does not support Scala 3
          // https://github.com/etorreborre/specs2/issues/848
          // TODO remove this setting when specs2 for Scala 3 released
          Seq(TestFrameworks.Specs2)
      }
    },

    (Compile / doc / scalacOptions) ++= {
      val hash = sys.process.Process("git rev-parse HEAD").lineStream_!.head
      val base = (LocalRootProject / baseDirectory).value.getAbsolutePath
      CrossVersion.partialVersion(scalaVersion.value) match {
        case Some((3, _)) =>
          Nil
        case _ =>
          Seq(
            "-sourcepath",
            base,
            "-doc-source-url",
{'fraction_non_alphanumeric': 0.1340050377833753, 'fraction_numerical': 0.01662468513853904, 'mean_word_length': 2.4085836909871245, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 1, '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': '6571834', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1188, 'n_words': 236}