<commit_before>import de.johoop.findbugs4sbt._

name := "linter"

organization := "com.foursquare.lint"

//version := "0.1.3"

scalaVersion := "2.10.4"

crossScalaVersions <<= scalaVersion { scalaVersion => Seq("2.10.4", "2.11.0") }

resolvers ++= Seq("snapshots", "releases").map(Resolver.sonatypeRepo)

libraryDependencies <++= (scalaVersion) { (scalaVersion) =>
  Seq(
    "org.scala-lang" % "scala-compiler"  % scalaVersion,
    "org.specs2"     %% "specs2"          % "2.3.11" % "test",
    "junit"          % "junit"           % "4.11"   % "test",
    "com.novocode"   % "junit-interface" % "0.10"   % "test"
  )
}

libraryDependencies := {
  CrossVersion.partialVersion(scalaVersion.value) match {
    case Some((2, scalaMajor)) if scalaMajor >= 11 =>
      libraryDependencies.value :+ "org.scala-lang.modules" %% "scala-xml" % "1.0.1"
    case _ =>
      libraryDependencies.value
  }
}

scalacOptions in console in Compile <+= (packageBin in Compile) map { pluginJar => "-Xplugin:"+pluginJar }

publishTo := Some(Resolver.file("file",  new File( "../linteRepo/releases" )) )

// Well, if we're gonna do static analysis, why not see what the compiler already does ;)

scalacOptions ++= Seq(
  "-Yrangepos",
  "-deprecation",
  "-unchecked",
  "-Xlint")

scalacOptions ++= Seq(
  "-Ywarn-dead-code",
  "-Ywarn-inaccessible",
  "-Ywarn-nullary-override",
  "-Ywarn-nullary-unit",
  "-Ywarn-numeric-widen",
  "-Ywarn-value-discard")

// Also, a self-test

//scalacOptions += "-Xplugin:../linteRepo/releases/com/foursquare/lint/linter_2.10/0.1-SNAPSHOT/linter_2.10-0.1-SNAPSHOT.jar"

//scalacOptions += "-Xplugin:../linteRepo/releases/com/foursquare/lint/linter_2.11/0.1-SNAPSHOT/linter_2.11-0.1-SNAPSHOT.jar"

// Also, what others are doing

// ScalaStyle

org.scalastyle.sbt.ScalastylePlugin.Settings

// Findbugs (optionally put findbugs plugins (such as fb-contrib and findsecbugs) jars into ~/.findbugs/plugin)

findbugsSettings

findbugsEffort := Effort.Maximum

findbugsReportPath <<= baseDirectory { base => Some(base / "findbugs.xml") }

// CPD

//import de.johoop.cpd4sbt.CopyPasteDetector._

cpdSettings<commit_msg>Update build.sbt<commit_after>import de.johoop.findbugs4sbt._
import de.johoop.cpd4sbt.CopyPasteDetector._
import de.johoop.cpd4sbt.{ReportType => CPDReportType}
import org.scalastyle.sbt.ScalastylePlugin

name := "linter"

organization := "com.foursquare.lint"

//version := "0.1.3"

scalaVersion := "2.10.4"

crossScalaVersions <<= scalaVersion { scalaVersion => Seq("2.10.4", "2.11.0") }

resolvers ++= Seq("snapshots", "releases").map(Resolver.sonatypeRepo)

libraryDependencies <++= (scalaVersion) { (scalaVersion) =>
  Seq(
    "org.scala-lang" % "scala-compiler"  % scalaVersion,
    "org.specs2"     %% "specs2"          % "2.3.11" % "test",
    "junit"          % "junit"           % "4.11"   % "test",
    "com.novocode"   % "junit-interface" % "0.10"   % "test"
  )
}

libraryDependencies := {
  CrossVersion.partialVersion(scalaVersion.value) match {
    case Some((2, scalaMajor)) if scalaMajor >= 11 =>
      libraryDependencies.value :+ "org.scala-lang.modules" %% "scala-xml" % "1.0.1"
    case _ =>
      libraryDependencies.value
  }
}

scalacOptions in console in Compile <+= (packageBin in Compile) map { pluginJar => "-Xplugin:"+pluginJar }

publishTo := Some(Resolver.file("file",  new File( "../linteRepo/releases" )) )

// Well, if we're gonna do static analysis, why not see what the compiler already does ;)

scalacOptions ++= Seq(
  "-Yrangepos",
  "-deprecation",
  "-unchecked",
  "-Xlint")

scalacOptions ++= Seq(
  "-Ywarn-dead-code",
  "-Ywarn-inaccessible",
  "-Ywarn-nullary-override",
  "-Ywarn-nullary-unit",
  "-Ywarn-numeric-widen",
  "-Ywarn-value-discard")

// Also, a self-test

//scalacOptions += "-Xplugin:../linteRepo/releases/com/foursquare/lint/linter_2.10/0.1-SNAPSHOT/linter_2.10-0.1-SNAPSHOT.jar"
//scalacOptions += "-Xplugin:../linteRepo/releases/com/foursquare/lint/linter_2.11/0.1-SNAPSHOT/linter_2.11-0.1-SNAPSHOT.jar"

// Also, what others are doing

// ScalaStyle
ScalastylePlugin.Settings

// Findbugs (optionally put findbugs plugins (such as fb-contrib and findsecbugs) jars into ~/.findbugs/plugin)
findbugsSettings

findbugsEffort := Effort.Maximum

findbugsReportPath <<= baseDirectory { base => Some(base / "findbugsoutput.xml") }

// CPD
cpdSettings

cpdTargetPath <<= baseDirectory { base => base }

cpdReportName := "cpdoutput.txt"

cpdReportType := CPDReportType.Simple
{'fraction_non_alphanumeric': 0.1690550828481863, 'fraction_numerical': 0.024854455888938646, 'mean_word_length': 3.712025316455696, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '5054921', 'n_tokens_mistral': 1761, 'n_tokens_neox': 1672, 'n_words': 287}