diff --git a/.scalafmt.conf b/.scalafmt.conf index aadfe65..fcad558 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,19 +1,69 @@ -version = "2.3.2" +version = "2.6.1" -assumeStandardLibraryStripMargin = true +align { + stripMargin = true +} + +assumeStandardLibraryStripMargin = false + +binPack { + literalArgumentLists = false +} + +continuationIndent { + withSiteRelativeToExtends = 3 +} + +includeNoParensInSelectChains = true + +newlines { + alwaysBeforeElseAfterCurlyIf = true +} + +project { + excludeFilters = [ + ".metals" + ] +} rewrite { - rules = [SortModifiers, PreferCurlyFors] - sortModifiers.order = [ - "final", "sealed", "abstract", "override", - "implicit", "private", "protected", "lazy" + rules = [ + PreferCurlyFors, + RedundantBraces, + RedundantParens, + SortImports, + SortModifiers, ] + + sortModifiers { + order = [ + "final", + "sealed", + "abstract", + "override", + "implicit", + "private", + "protected", + "lazy" + ] + } +} + +rewriteTokens { + "⇒" = "=>" + "→" = "->" + "←" = "<-" +} + +spaces { + inImportCurlyBraces = true } verticalMultiline { - arityThreshold = 60 + arityThreshold = 3 atDefnSite = true + excludeDanglingParens = [] newlineAfterImplicitKW = true newlineAfterOpenParen = true - newlineBeforeImplicitKW = true + newlineBeforeImplicitKW = false } diff --git a/README.md b/README.md index c4d5958..8c01794 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ### Releases ```scala -libraryDependencies += "com.github.agilesteel" %% "spells" % "2.2.1" +libraryDependencies += "com.github.agilesteel" %% "spells" % "2.2.2" // for Scala version below 2.13 use: libraryDependencies += "com.github.agilesteel" %% "spells" % "2.2.0" diff --git a/aliases.sbt b/aliases.sbt index da7727a..fc00345 100644 --- a/aliases.sbt +++ b/aliases.sbt @@ -12,8 +12,13 @@ addCommandAlias( ) addCommandAlias("testWithCoverage", "clean; coverage; test; coverageReport") -addCommandAlias("deploySnapshot", "+clean; +test; +publish") -addCommandAlias("deploy", "+clean; +test; +publishSigned; sonatypeReleaseAll") +addCommandAlias("deploySnapshot", "clean; test; publish") +addCommandAlias("deploy", "clean; test; publishSigned; sonatypeReleaseAll") +addCommandAlias("deploySnapshotAll", "+clean; +test; +publish") +addCommandAlias( + "deployAll", + "+clean; +test; +publishSigned; sonatypeReleaseAll" +) onLoadMessage += s"""| @@ -29,5 +34,7 @@ onLoadMessage += |${styled("up2date")} │ dependencyUpdates |${styled("deploy")} │ deploy |${styled("deploySnapshot")} │ deploySnapshot + |${styled("deployAll")} │ deployAll + |${styled("deploySnapshotAll")}│ deploySnapshotAll |${styled("testWithCoverage")} │ testWithCoverage |─────────────────┴──────────────────""".stripMargin diff --git a/build.sbt b/build.sbt index cad1073..bad5480 100644 --- a/build.sbt +++ b/build.sbt @@ -6,8 +6,8 @@ lazy val spells = .settings( name := "spells", organization := "com.github.agilesteel", - version := "2.2.1", - scalaVersion := "2.13.1", + version := "2.2.2", + scalaVersion := "2.13.3", homepage := Some(url("https://agilesteel.github.io/spells/")), startYear := some(2012), description := """This is a small scala "util" library, which will hopefully grow over time.""", @@ -39,6 +39,10 @@ lazy val spells = "-Ywarn-unused:_", "-Xfatal-warnings" ), + Compile / doc / scalacOptions --= Seq( + "-Ywarn-unused:_", + "-Xfatal-warnings" + ), Compile / console / scalacOptions --= Seq( "-Ywarn-unused:_", "-Xfatal-warnings" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 99ad420..fbb7cef 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -7,7 +7,7 @@ object Dependencies extends (String => Seq[ModuleID]) { val `scala-reflect` = "org.scala-lang" % "scala-reflect" % scalaVersion val `scala-collection-compat` = - "org.scala-lang.modules" %% "scala-collection-compat" % "2.1.2" + "org.scala-lang.modules" %% "scala-collection-compat" % "2.1.6" val config = { val configVersion: String = @@ -18,18 +18,14 @@ object Dependencies extends (String => Seq[ModuleID]) { } object Test { - val pegdown = - "org.pegdown" % "pegdown" % "1.6.0" - val scalatest = - "org.scalatest" %% "scalatest" % "3.0.8" + "org.scalatest" %% "scalatest" % "3.2.0" } Seq( `scala-collection-compat`, `scala-reflect`, config, - Test.pegdown % sbt.Test, Test.scalatest % sbt.Test ) } diff --git a/project/UserConfigFileManager.scala b/project/UserConfigFileManager.scala index 5df9cd0..9edd9eb 100644 --- a/project/UserConfigFileManager.scala +++ b/project/UserConfigFileManager.scala @@ -1,4 +1,4 @@ -import java.nio.file.{Files, Paths} +import java.nio.file.{ Files, Paths } import java.nio.file.StandardCopyOption._ import java.nio.file.LinkOption._ @@ -7,7 +7,8 @@ object UserConfigFileManager { s"""${System.getProperty("user.home")}/.spells.conf""" private[this] val userConfigLocation = Paths get userConfigLocationValue - private[this] val userConfigBackupLocation = Paths get (userConfigLocationValue + "_backup") + private[this] val userConfigBackupLocation = + Paths get (userConfigLocationValue + "_backup") val createSpellsConfigFileForCurrentUser: () => Unit = () => { backup() @@ -19,7 +20,7 @@ object UserConfigFileManager { restore() } - private[this] def backup(): Unit = { + private[this] def backup(): Unit = if (Files exists userConfigLocation) Files.move( userConfigLocation, @@ -28,7 +29,6 @@ object UserConfigFileManager { REPLACE_EXISTING, NOFOLLOW_LINKS ) - } private[this] def create(): Unit = { val userConfigContent = @@ -41,11 +41,10 @@ object UserConfigFileManager { Files.write(userConfigLocation, userConfigContent.getBytes) } - private[this] def delete(): Unit = { + private[this] def delete(): Unit = Files.delete(userConfigLocation) - } - private[this] def restore(): Unit = { + private[this] def restore(): Unit = if (Files exists userConfigBackupLocation) Files.move( userConfigBackupLocation, @@ -54,5 +53,4 @@ object UserConfigFileManager { REPLACE_EXISTING, NOFOLLOW_LINKS ) - } } diff --git a/project/build.properties b/project/build.properties index 6adcdc7..0837f7a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.3 +sbt.version=1.3.13 diff --git a/project/plugins.sbt b/project/plugins.sbt index 64cfe4c..a0131a4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -ThisBuild / scalaVersion := "2.12.10" +ThisBuild / scalaVersion := "2.12.11" ThisBuild / useSuperShell := false ThisBuild / autoStartServer := false @@ -13,12 +13,12 @@ resolvers ++= Seq( addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "3.0.3") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") -addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.0") +addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.0") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.3") scalacOptions ++= Seq( "-encoding", diff --git a/project/project/plugins.sbt b/project/project/plugins.sbt index 594c596..040e32e 100644 --- a/project/project/plugins.sbt +++ b/project/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.0") +addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1") diff --git a/publish.sbt b/publish.sbt index a90d772..c25bbdc 100644 --- a/publish.sbt +++ b/publish.sbt @@ -8,8 +8,8 @@ pomIncludeRepository := { _ => false } -publishTo := { - (version) { version: String => +publishTo := + version { version: String => if (version.trim.endsWith("SNAPSHOT")) Some( "Sonatype Nexus Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" @@ -18,8 +18,7 @@ publishTo := { Some( "Sonatype Nexus Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2" ) - } -}.value + }.value scmInfo := Some( ScmInfo( diff --git a/src/main/scala/spells/AnsiModule.scala b/src/main/scala/spells/AnsiModule.scala index f98e264..bff020e 100644 --- a/src/main/scala/spells/AnsiModule.scala +++ b/src/main/scala/spells/AnsiModule.scala @@ -21,37 +21,39 @@ trait AnsiModule { * @see https://en.wikipedia.org/wiki/ANSI_escape_code * @return an instance of `AnsiStyle` */ - final def toAnsiStyle: AnsiModule#AnsiStyle = style match { - case "Black" => AnsiStyle.Black - case "Blue" => AnsiStyle.Blue - case "Cyan" => AnsiStyle.Cyan - case "Green" => AnsiStyle.Green - case "Magenta" => AnsiStyle.Magenta - case "Random" => AnsiStyle.Random - case "Red" => AnsiStyle.Red - case "Untouched" => AnsiStyle.Reset - case "White" => AnsiStyle.White - case "Yellow" => AnsiStyle.Yellow - case _ => - new AnsiStyle(Option(style).fold("")(_.replace("\\033", "\u001b"))) - } + final def toAnsiStyle: AnsiModule#AnsiStyle = + style match { + case "Black" => AnsiStyle.Black + case "Blue" => AnsiStyle.Blue + case "Cyan" => AnsiStyle.Cyan + case "Green" => AnsiStyle.Green + case "Magenta" => AnsiStyle.Magenta + case "Random" => AnsiStyle.Random + case "Red" => AnsiStyle.Red + case "Untouched" => AnsiStyle.Reset + case "White" => AnsiStyle.White + case "Yellow" => AnsiStyle.Yellow + case _ => + new AnsiStyle(Option(style).fold("")(_.replace("\\033", "\u001b"))) + } } /** Encoding of `AnsiStyle`s * @param value the style to encode */ final class AnsiStyle private[spells] (val value: String) { - final override def toString: String = value match { - case AnsiStyle.Black.value => "Black" in this - case AnsiStyle.Blue.value => "Blue" in this - case AnsiStyle.Cyan.value => "Cyan" in this - case AnsiStyle.Green.value => "Green" in this - case AnsiStyle.Magenta.value => "Magenta" in this - case AnsiStyle.Red.value => "Red" in this - case AnsiStyle.White.value => "White" in this - case AnsiStyle.Yellow.value => "Yellow" in this - case _ => AnsiStyle.Sample in this - } + final override def toString: String = + value match { + case AnsiStyle.Black.value => "Black" in this + case AnsiStyle.Blue.value => "Blue" in this + case AnsiStyle.Cyan.value => "Cyan" in this + case AnsiStyle.Green.value => "Green" in this + case AnsiStyle.Magenta.value => "Magenta" in this + case AnsiStyle.Red.value => "Red" in this + case AnsiStyle.White.value => "White" in this + case AnsiStyle.Yellow.value => "Yellow" in this + case _ => AnsiStyle.Sample in this + } } /** Provides the method `in` which converts `Any` to `String` `in` `AnsiStyle`. diff --git a/src/main/scala/spells/CalendarOpsModule.scala b/src/main/scala/spells/CalendarOpsModule.scala index 1658667..7a404a7 100644 --- a/src/main/scala/spells/CalendarOpsModule.scala +++ b/src/main/scala/spells/CalendarOpsModule.scala @@ -17,6 +17,8 @@ trait CalendarOpsModule { availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = SpellsConfig.terminal.WidthInCharacters.value ): String = - new SimpleDateFormat(DateOpsFromSpells.Defaults.Format) format value.getTime + new SimpleDateFormat( + DateOpsFromSpells.Defaults.Format + ) format value.getTime } } diff --git a/src/main/scala/spells/ClearPrintModule.scala b/src/main/scala/spells/ClearPrintModule.scala index 7b90feb..794d26b 100644 --- a/src/main/scala/spells/ClearPrintModule.scala +++ b/src/main/scala/spells/ClearPrintModule.scala @@ -37,12 +37,10 @@ trait ClearPrintModule { */ final def clearPrintln( input: Any = "" - )( - implicit + )(implicit style: AnsiModule#AnsiStyle = AnsiStyle.Reset - ): Unit = { + ): Unit = Console println cleared(input)(style) - } /** Prints an object to out using its toString method, beginning at the first character in the current line of your terminal. * @param input the object to print @@ -50,12 +48,10 @@ trait ClearPrintModule { */ final def clearPrint( input: Any = "" - )( - implicit + )(implicit style: AnsiModule#AnsiStyle = AnsiStyle.Reset - ): Unit = { + ): Unit = Console print cleared(input)(style) - } /** Moves the caret to the beginning of the line. * @param input the object to be moved to the beginning of the line @@ -64,8 +60,7 @@ trait ClearPrintModule { */ final def cleared( input: Any = "" - )( - implicit + )(implicit style: AnsiModule#AnsiStyle = AnsiStyle.Reset ): String = styled(ClearPrint.Clear.value + s"\r$input" + AnsiStyle.Reset.value)(style) diff --git a/src/main/scala/spells/ClipboardModule.scala b/src/main/scala/spells/ClipboardModule.scala index d7fb880..bc47a6a 100644 --- a/src/main/scala/spells/ClipboardModule.scala +++ b/src/main/scala/spells/ClipboardModule.scala @@ -4,7 +4,7 @@ package spells trait ClipboardModule { this: MiscModule => - import java.awt.datatransfer.{DataFlavor, StringSelection} + import java.awt.datatransfer.{ DataFlavor, StringSelection } import java.awt.Toolkit import java.util.logging.Level import scala.util.Try @@ -21,9 +21,8 @@ trait ClipboardModule { "sun.awt.X11" ) foreach disableLogging - private def disableLogging(loggerName: String): Unit = { + private def disableLogging(loggerName: String): Unit = java.util.logging.Logger getLogger loggerName setLevel Level.OFF - } private lazy val clipboard = Toolkit.getDefaultToolkit.getSystemClipboard @@ -31,19 +30,24 @@ trait ClipboardModule { * @param content the `String` to write * @return an instance of `Try[Unit]` */ - final def writeString(content: String): Try[Unit] = Try { - val contentAsStringSelection = new StringSelection(content) - clipboard.setContents(contentAsStringSelection, contentAsStringSelection) - } + final def writeString(content: String): Try[Unit] = + Try { + val contentAsStringSelection = new StringSelection(content) + clipboard.setContents( + contentAsStringSelection, + contentAsStringSelection + ) + } /** Reads the content of the operating systems' clipboard. * @return the `String` content of the operating system's clipboard wrapped in a `Try` */ - final def readString: Try[String] = Try { - clipboard - .getContents(null) - .getTransferData(DataFlavor.stringFlavor) - .asInstanceOf[String] - } + final def readString: Try[String] = + Try { + clipboard + .getContents(null) + .getTransferData(DataFlavor.stringFlavor) + .asInstanceOf[String] + } } } diff --git a/src/main/scala/spells/FunctionNOpsModule.scala b/src/main/scala/spells/FunctionNOpsModule.scala index 662704b..39f85ab 100644 --- a/src/main/scala/spells/FunctionNOpsModule.scala +++ b/src/main/scala/spells/FunctionNOpsModule.scala @@ -18,11 +18,10 @@ trait FunctionNOpsModule { final implicit class Function0OpsFromSpells[R, F[_]]( value: F[R] - )( - implicit + )(implicit typeTag: TypeTag[F[R]], - evidence: F[R] <:< Function0[R]) - extends TypeTagBasedCustomRendering(typeTag) + evidence: F[R] <:< Function0[R] + ) extends TypeTagBasedCustomRendering(typeTag) // final implicit class Function1OpsFromSpells[T1, R]( // value: Function1[T1, R] @@ -33,18 +32,16 @@ trait FunctionNOpsModule { final implicit class Function2OpsFromSpells[T1, T2, R, F[_, _, _]]( value: F[T1, T2, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, R]], - evidence: F[T1, T2, R] <:< Function2[T1, T2, R]) - extends TypeTagBasedCustomRendering(typeTag) + evidence: F[T1, T2, R] <:< Function2[T1, T2, R] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function3OpsFromSpells[T1, T2, T3, R, F[_, _, _, _]]( value: F[T1, T2, T3, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, R]], - evidence: F[T1, T2, T3, R] <:< Function3[T1, T2, T3, R]) - extends TypeTagBasedCustomRendering(typeTag) + evidence: F[T1, T2, T3, R] <:< Function3[T1, T2, T3, R] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function4OpsFromSpells[ T1, T2, @@ -54,11 +51,10 @@ trait FunctionNOpsModule { F[_, _, _, _, _] ]( value: F[T1, T2, T3, T4, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, R]], - evidence: F[T1, T2, T3, T4, R] <:< Function4[T1, T2, T3, T4, R]) - extends TypeTagBasedCustomRendering(typeTag) + evidence: F[T1, T2, T3, T4, R] <:< Function4[T1, T2, T3, T4, R] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function5OpsFromSpells[ T1, T2, @@ -69,11 +65,10 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, T5, R]], - evidence: F[T1, T2, T3, T4, T5, R] <:< Function5[T1, T2, T3, T4, T5, R]) - extends TypeTagBasedCustomRendering(typeTag) + evidence: F[T1, T2, T3, T4, T5, R] <:< Function5[T1, T2, T3, T4, T5, R] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function6OpsFromSpells[ T1, T2, @@ -85,8 +80,7 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, T5, T6, R]], evidence: F[T1, T2, T3, T4, T5, T6, R] <:< Function6[ T1, @@ -96,8 +90,8 @@ trait FunctionNOpsModule { T5, T6, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function7OpsFromSpells[ T1, T2, @@ -110,8 +104,7 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, T7, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, T5, T6, T7, R]], evidence: F[T1, T2, T3, T4, T5, T6, T7, R] <:< Function7[ T1, @@ -122,8 +115,8 @@ trait FunctionNOpsModule { T6, T7, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function8OpsFromSpells[ T1, T2, @@ -137,8 +130,7 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, T7, T8, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, T5, T6, T7, T8, R]], evidence: F[T1, T2, T3, T4, T5, T6, T7, T8, R] <:< Function8[ T1, @@ -150,8 +142,8 @@ trait FunctionNOpsModule { T7, T8, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function9OpsFromSpells[ T1, T2, @@ -166,8 +158,7 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, T5, T6, T7, T8, T9, R]], evidence: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, R] <:< Function9[ T1, @@ -180,8 +171,8 @@ trait FunctionNOpsModule { T8, T9, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function10OpsFromSpells[ T1, T2, @@ -197,8 +188,7 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]], evidence: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R] <:< Function10[ T1, @@ -212,8 +202,8 @@ trait FunctionNOpsModule { T9, T10, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function11OpsFromSpells[ T1, T2, @@ -230,10 +220,22 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R]], - evidence: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R] <:< Function11[ + evidence: F[ + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + R + ] <:< Function11[ T1, T2, T3, @@ -246,8 +248,8 @@ trait FunctionNOpsModule { T10, T11, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function12OpsFromSpells[ T1, T2, @@ -265,10 +267,9 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R] - )( - implicit + )(implicit typeTag: TypeTag[F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]], - evidence: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R] <:< Function12[ + evidence: F[ T1, T2, T3, @@ -282,8 +283,22 @@ trait FunctionNOpsModule { T11, T12, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] <:< Function12[ + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + R + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function13OpsFromSpells[ T1, T2, @@ -302,12 +317,11 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _, _, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R] - )( - implicit + )(implicit typeTag: TypeTag[ F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R] ], - evidence: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R] <:< Function13[ + evidence: F[ T1, T2, T3, @@ -322,8 +336,23 @@ trait FunctionNOpsModule { T12, T13, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] <:< Function13[ + T1, + T2, + T3, + T4, + T5, + T6, + T7, + T8, + T9, + T10, + T11, + T12, + T13, + R + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function14OpsFromSpells[ T1, T2, @@ -343,8 +372,7 @@ trait FunctionNOpsModule { F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _] ]( value: F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R] - )( - implicit + )(implicit typeTag: TypeTag[ F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R] ], @@ -380,8 +408,8 @@ trait FunctionNOpsModule { T13, T14, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function15OpsFromSpells[ T1, T2, @@ -419,8 +447,7 @@ trait FunctionNOpsModule { T15, R ] - )( - implicit + )(implicit typeTag: TypeTag[ F[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R] ], @@ -458,8 +485,8 @@ trait FunctionNOpsModule { T14, T15, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function16OpsFromSpells[ T1, T2, @@ -499,8 +526,7 @@ trait FunctionNOpsModule { T16, R ] - )( - implicit + )(implicit typeTag: TypeTag[F[ T1, T2, @@ -556,8 +582,8 @@ trait FunctionNOpsModule { T15, T16, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function17OpsFromSpells[ T1, T2, @@ -599,8 +625,7 @@ trait FunctionNOpsModule { T17, R ] - )( - implicit + )(implicit typeTag: TypeTag[F[ T1, T2, @@ -659,8 +684,8 @@ trait FunctionNOpsModule { T16, T17, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function18OpsFromSpells[ T1, T2, @@ -704,8 +729,7 @@ trait FunctionNOpsModule { T18, R ] - )( - implicit + )(implicit typeTag: TypeTag[F[ T1, T2, @@ -767,8 +791,8 @@ trait FunctionNOpsModule { T17, T18, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function19OpsFromSpells[ T1, T2, @@ -814,8 +838,7 @@ trait FunctionNOpsModule { T19, R ] - )( - implicit + )(implicit typeTag: TypeTag[F[ T1, T2, @@ -880,8 +903,8 @@ trait FunctionNOpsModule { T18, T19, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function20OpsFromSpells[ T1, T2, @@ -929,8 +952,7 @@ trait FunctionNOpsModule { T20, R ] - )( - implicit + )(implicit typeTag: TypeTag[F[ T1, T2, @@ -998,8 +1020,8 @@ trait FunctionNOpsModule { T19, T20, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function21OpsFromSpells[ T1, T2, @@ -1049,8 +1071,7 @@ trait FunctionNOpsModule { T21, R ] - )( - implicit + )(implicit typeTag: TypeTag[F[ T1, T2, @@ -1121,8 +1142,8 @@ trait FunctionNOpsModule { T20, T21, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) final implicit class Function22OpsFromSpells[ T1, T2, @@ -1174,8 +1195,7 @@ trait FunctionNOpsModule { T22, R ] - )( - implicit + )(implicit typeTag: TypeTag[F[ T1, T2, @@ -1249,6 +1269,6 @@ trait FunctionNOpsModule { T21, T22, R - ]) - extends TypeTagBasedCustomRendering(typeTag) + ] + ) extends TypeTagBasedCustomRendering(typeTag) } diff --git a/src/main/scala/spells/HumanRenderingModule.scala b/src/main/scala/spells/HumanRenderingModule.scala index 457e998..b965144 100644 --- a/src/main/scala/spells/HumanRenderingModule.scala +++ b/src/main/scala/spells/HumanRenderingModule.scala @@ -89,7 +89,8 @@ trait HumanRenderingModule { minutes: Long = 0, seconds: Long = 0, milliseconds: Long = 0, - nanoseconds: Long = 0) { + nanoseconds: Long = 0 + ) { override val toString = if (isPositiveOrZero) calculated else recalculated final private lazy val isPositiveOrZero: Boolean = @@ -116,7 +117,8 @@ trait HumanRenderingModule { remainder = remainder, renderedRemainder = remainder.render.duration.just.months ) - } else if (weeks != 0) + } + else if (weeks != 0) weeks.render.duration.just.weeks else if (days != 0) { val (quotient, remainder) = division(days, 7) @@ -126,7 +128,8 @@ trait HumanRenderingModule { remainder = remainder, renderedRemainder = remainder.render.duration.just.days ) - } else if (hours != 0) { + } + else if (hours != 0) { val (quotient, remainder) = division(hours, 24) render( @@ -134,7 +137,8 @@ trait HumanRenderingModule { remainder = remainder, renderedRemainder = remainder.render.duration.just.hours ) - } else if (minutes != 0) { + } + else if (minutes != 0) { val (quotient, remainder) = division(minutes, 60) render( @@ -142,7 +146,8 @@ trait HumanRenderingModule { remainder = remainder, renderedRemainder = remainder.render.duration.just.minutes ) - } else if (seconds != 0) { + } + else if (seconds != 0) { val (quotient, remainder) = division(seconds, 60) render( @@ -150,7 +155,8 @@ trait HumanRenderingModule { remainder = remainder, renderedRemainder = remainder.render.duration.just.seconds ) - } else if (milliseconds != 0) { + } + else if (milliseconds != 0) { val (quotient, remainder) = division(milliseconds, 1000) render( @@ -158,7 +164,8 @@ trait HumanRenderingModule { remainder = remainder, renderedRemainder = remainder.render.duration.just.milliseconds ) - } else if (nanoseconds != 0) { + } + else if (nanoseconds != 0) { val (quotient, remainder) = division(nanoseconds, 1000000) render( @@ -166,7 +173,8 @@ trait HumanRenderingModule { remainder = remainder, renderedRemainder = remainder.render.duration.just.nanoseconds ) - } else "" + } + else "" } final private def division(dividend: Long, divisor: Long): (Long, Long) = { diff --git a/src/main/scala/spells/IterableOpsModule.scala b/src/main/scala/spells/IterableOpsModule.scala index c4bedf0..01b6f5c 100644 --- a/src/main/scala/spells/IterableOpsModule.scala +++ b/src/main/scala/spells/IterableOpsModule.scala @@ -17,44 +17,41 @@ trait IterableOpsModule { final implicit def IterableOpsFromSpells[A, T[A] <: Iterable[A]]( value: T[A] - )( - implicit + )(implicit typeTag: TypeTag[T[A]], rendering: A => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any - ): CustomRendering = new CustomRendering { - final override def rendered( - implicit - availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = - SpellsConfig.terminal.WidthInCharacters.value - ): String = { - lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - - render[T[A]]( - value, - _.isEmpty, - _.size, - value.toString, - typeName, - availableWidthInCharacters - ) { - _ => - { availableWidthInCharacters => - var result: Vector[(String, String)] = - Vector.empty[(String, String)] - var index = 0 - value foreach { element => - result :+= (index.toString -> element.rendered( - availableWidthInCharacters - )) - index += 1 - } + ): CustomRendering = + new CustomRendering { + final override def rendered( + implicit + availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = + SpellsConfig.terminal.WidthInCharacters.value + ): String = { + lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - result + render[T[A]]( + value, + _.isEmpty, + _.size, + value.toString, + typeName, + availableWidthInCharacters + ) { _ => availableWidthInCharacters => + var result: Vector[(String, String)] = + Vector.empty[(String, String)] + var index = 0 + value foreach { element => + result :+= (index.toString -> element.rendered( + availableWidthInCharacters + )) + index += 1 } + + result + } } } - } final implicit def MapOpsFromSpells[ Key, @@ -62,132 +59,123 @@ trait IterableOpsModule { T[Key, Value] <: Map[Key, Value] ]( value: T[Key, Value] - )( - implicit + )(implicit typeTag: TypeTag[T[Key, Value]], rendering: Tuple2[Key, Value] => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any - ): CustomRendering = new CustomRendering { - final override def rendered( - implicit - availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = - SpellsConfig.terminal.WidthInCharacters.value - ): String = { - lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - - render[T[Key, Value]]( - value, - _.isEmpty, - _.size, - value.toString, - typeName, - availableWidthInCharacters - ) { - _ => - { availableWidthInCharacters => - var result: Vector[(String, String)] = - Vector.empty[(String, String)] - var index = 0 - value foreach { element => - result :+= (index.toString -> element.rendered( - availableWidthInCharacters - )) - index += 1 - } + ): CustomRendering = + new CustomRendering { + final override def rendered( + implicit + availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = + SpellsConfig.terminal.WidthInCharacters.value + ): String = { + lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - result + render[T[Key, Value]]( + value, + _.isEmpty, + _.size, + value.toString, + typeName, + availableWidthInCharacters + ) { _ => availableWidthInCharacters => + var result: Vector[(String, String)] = + Vector.empty[(String, String)] + var index = 0 + value foreach { element => + result :+= (index.toString -> element.rendered( + availableWidthInCharacters + )) + index += 1 } + + result + } } } - } final implicit def ArrayOpsFromSpells[A, T[A] <: Array[A]]( value: T[A] - )( - implicit + )(implicit typeTag: TypeTag[T[A]], rendering: A => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any - ): CustomRendering = new CustomRendering { - final override def rendered( - implicit - availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = - SpellsConfig.terminal.WidthInCharacters.value - ): String = { - lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - - render[T[A]]( - value, - _.isEmpty, - _.size, - s"Array()", - typeName, - availableWidthInCharacters - ) { - _ => - { availableWidthInCharacters => - var result: Vector[(String, String)] = - Vector.empty[(String, String)] - var index = 0 - value foreach { element => - result :+= (index.toString -> element.rendered( - availableWidthInCharacters - )) - index += 1 - } + ): CustomRendering = + new CustomRendering { + final override def rendered( + implicit + availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = + SpellsConfig.terminal.WidthInCharacters.value + ): String = { + lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - result + render[T[A]]( + value, + _.isEmpty, + _.size, + s"Array()", + typeName, + availableWidthInCharacters + ) { _ => availableWidthInCharacters => + var result: Vector[(String, String)] = + Vector.empty[(String, String)] + var index = 0 + value foreach { element => + result :+= (index.toString -> element.rendered( + availableWidthInCharacters + )) + index += 1 } + + result + } } } - } final implicit def CollectionOpsFromSpells[ A, T[A] <: java.util.Collection[A] ]( value: T[A] - )( - implicit + )(implicit typeTag: TypeTag[T[A]], rendering: A => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any - ): CustomRendering = new CustomRendering { - final override def rendered( - implicit - availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = - SpellsConfig.terminal.WidthInCharacters.value - ): String = { - lazy val className = value.decodedClassName - lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - - render[T[A]]( - value, - _.isEmpty, - _.size, - s"$className()", - typeName, - availableWidthInCharacters - ) { - _ => - { availableWidthInCharacters => - var result: Vector[(String, String)] = - Vector.empty[(String, String)] - var index = 0 - val iterator = value.iterator - while (iterator.hasNext) { - val element = iterator.next - result :+= (index.toString -> element.rendered( - availableWidthInCharacters - )) - index += 1 - } + ): CustomRendering = + new CustomRendering { + final override def rendered( + implicit + availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = + SpellsConfig.terminal.WidthInCharacters.value + ): String = { + lazy val className = value.decodedClassName + lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - result + render[T[A]]( + value, + _.isEmpty, + _.size, + s"$className()", + typeName, + availableWidthInCharacters + ) { _ => availableWidthInCharacters => + var result: Vector[(String, String)] = + Vector.empty[(String, String)] + var index = 0 + val iterator = value.iterator + while (iterator.hasNext) { + val element = iterator.next + result :+= (index.toString -> element.rendered( + availableWidthInCharacters + )) + index += 1 } + + result + } } } - } final implicit def JavaMapOpsFromSpells[ Key, @@ -195,47 +183,46 @@ trait IterableOpsModule { T[Key, Value] <: java.util.Map[Key, Value] ]( value: T[Key, Value] - )( - implicit + )(implicit typeTag: TypeTag[T[Key, Value]], - rendering: java.util.Map.Entry[Key, Value] => CustomRenderingModule#CustomRendering = + rendering: java + .util + .Map.Entry[Key, Value] => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any - ): CustomRendering = new CustomRendering { - final override def rendered( - implicit - availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = - SpellsConfig.terminal.WidthInCharacters.value - ): String = { - lazy val className = value.decodedClassName - lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - - render[java.util.Map[Key, Value]]( - value, - _.isEmpty, - _.size, - s"$className()", - typeName, - availableWidthInCharacters - ) { - in => - { availableWidthInCharacters => - var result: Vector[(String, String)] = - Vector.empty[(String, String)] - var index = 0 - val iterator = in.entrySet.iterator - while (iterator.hasNext) { - val element = iterator.next - result :+= (index.toString -> element.rendered( - availableWidthInCharacters - )) - index += 1 - } + ): CustomRendering = + new CustomRendering { + final override def rendered( + implicit + availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = + SpellsConfig.terminal.WidthInCharacters.value + ): String = { + lazy val className = value.decodedClassName + lazy val typeName = typeTag.tpe.toString.withDecodedScalaSymbols - result + render[java.util.Map[Key, Value]]( + value, + _.isEmpty, + _.size, + s"$className()", + typeName, + availableWidthInCharacters + ) { in => availableWidthInCharacters => + var result: Vector[(String, String)] = + Vector.empty[(String, String)] + var index = 0 + val iterator = in.entrySet.iterator + while (iterator.hasNext) { + val element = iterator.next + result :+= (index.toString -> element.rendered( + availableWidthInCharacters + )) + index += 1 } + + result + } } } - } final private def render[T]( value: => T, @@ -263,7 +250,7 @@ trait IterableOpsModule { final private[spells] def renderedTable( in: Int => Seq[(String, String)], availableWidthInCharacters: Int - ): Seq[String] = { + ): Seq[String] = if (in(0).isEmpty) Seq.empty else { val sizeOfTheBiggestKey = in(0) map { @@ -286,14 +273,15 @@ trait IterableOpsModule { else { val subLines = wrappedValue.split("\n").toList val head = keyWithPadding + separator + subLines.head - (head :: subLines.tail.map(subLine => - (" " * keyWithPadding.size) + separator + subLine - )).mkString("\n") + (head :: subLines + .tail + .map(subLine => + (" " * keyWithPadding.size) + separator + subLine + )).mkString("\n") } } result :+ line } } - } } diff --git a/src/main/scala/spells/LazyListOpsModule.scala b/src/main/scala/spells/LazyListOpsModule.scala index fa702b2..527e4e3 100644 --- a/src/main/scala/spells/LazyListOpsModule.scala +++ b/src/main/scala/spells/LazyListOpsModule.scala @@ -11,7 +11,9 @@ trait LazyListOpsModule { * In contrast to the LazyList factory from the standard library each element is evaluated on demand. */ def MakeLazyList[E](elements: Function0Wrapper[E]*): LazyList[E] = - scala.collection.immutable + scala + .collection + .immutable .LazyList[Function0Wrapper[E]](elements: _*) .map(_.function0()) } diff --git a/src/main/scala/spells/LocationAwarePropertyModule.scala b/src/main/scala/spells/LocationAwarePropertyModule.scala index 581ef2b..d1e4312 100644 --- a/src/main/scala/spells/LocationAwarePropertyModule.scala +++ b/src/main/scala/spells/LocationAwarePropertyModule.scala @@ -5,7 +5,8 @@ private[spells] trait LocationAwarePropertyModule { abstract class LocationAwareProperty[T]( implicit - materialised: (LocationAwareProperty[T] => T)) { + materialised: (LocationAwareProperty[T] => T) + ) { final lazy val value: T = materialised(this) def isValid: T => Boolean = _ => true @@ -22,7 +23,9 @@ private[spells] trait LocationAwarePropertyModule { def customValidationErrorMessage: T => String = _ => "" final lazy val location: String = - scala.reflect.NameTransformer + scala + .reflect + .NameTransformer .decode(getClass.getName) .replace("SpellsConfigModule$SpellsConfig$", "") .split('$') diff --git a/src/main/scala/spells/Spells.scala b/src/main/scala/spells/Spells.scala index e37591d..078b895 100644 --- a/src/main/scala/spells/Spells.scala +++ b/src/main/scala/spells/Spells.scala @@ -6,22 +6,22 @@ package spells */ trait Spells extends AnsiModule - with AnyOpsModule - with CalendarOpsModule - with ClearPrintModule - with ClipboardModule - with CustomRenderingModule - with DateOpsModule - with DurationOpsModule - with FunctionNOpsModule - with HumanRenderingModule - with IterableOpsModule - with LazyListOpsModule - with MiscModule - with SpellsConfigModule - with StackTraceElementModule - with StringOpsModule - with StylePrintModule - with ThrowableOpsModule - with Tuple2OpsModule - with XrayModule + with AnyOpsModule + with CalendarOpsModule + with ClearPrintModule + with ClipboardModule + with CustomRenderingModule + with DateOpsModule + with DurationOpsModule + with FunctionNOpsModule + with HumanRenderingModule + with IterableOpsModule + with LazyListOpsModule + with MiscModule + with SpellsConfigModule + with StackTraceElementModule + with StringOpsModule + with StylePrintModule + with ThrowableOpsModule + with Tuple2OpsModule + with XrayModule diff --git a/src/main/scala/spells/SpellsConfigModule.scala b/src/main/scala/spells/SpellsConfigModule.scala index 63f77d9..8dd53bb 100644 --- a/src/main/scala/spells/SpellsConfigModule.scala +++ b/src/main/scala/spells/SpellsConfigModule.scala @@ -6,7 +6,7 @@ package spells */ trait SpellsConfigModule extends LocationAwareConfigModule - with LocationAwarePropertyModule { + with LocationAwarePropertyModule { this: StylePrintModule with AnsiModule => object SpellsConfig { diff --git a/src/main/scala/spells/StylePrintModule.scala b/src/main/scala/spells/StylePrintModule.scala index 580d794..0b01db1 100644 --- a/src/main/scala/spells/StylePrintModule.scala +++ b/src/main/scala/spells/StylePrintModule.scala @@ -13,12 +13,10 @@ trait StylePrintModule { */ final def println( input: Any = "" - )( - implicit + )(implicit style: AnsiModule#AnsiStyle = AnsiStyle.Reset - ): Unit = { + ): Unit = Console println styled(input)(style) - } /** Prints an object to out using its toString method. * @param input the object to print; may be null @@ -26,19 +24,16 @@ trait StylePrintModule { */ final def print( input: Any = "" - )( - implicit + )(implicit style: AnsiModule#AnsiStyle = AnsiStyle.Reset - ): Unit = { + ): Unit = Console print styled(input)(style) - } /** Write to the `err` stream in `AnsiStyle.Red`. * @param error which will be written to the stream */ - final def printerr(error: Any): Unit = { + final def printerr(error: Any): Unit = Console.err println erred(error) - } /** Styles `Any in Red`. * @param error which will be styled @@ -56,8 +51,7 @@ trait StylePrintModule { */ final def styled( input: Any - )( - implicit + )(implicit style: AnsiModule#AnsiStyle = AnsiStyle.Reset ): String = { val rawValue = String valueOf input @@ -70,12 +64,14 @@ trait StylePrintModule { final private def restyle( input: String, style: AnsiModule#AnsiStyle - ): String = input match { - case StylePrint.AnsiPattern(before, alreadyStyled, after) => - restyle(before, style) + alreadyStyled + restyle(after, style) - case _ => - if (input.isEmpty) input else style.value + input + AnsiStyle.Reset.value - } + ): String = + input match { + case StylePrint.AnsiPattern(before, alreadyStyled, after) => + restyle(before, style) + alreadyStyled + restyle(after, style) + case _ => + if (input.isEmpty) input + else style.value + input + AnsiStyle.Reset.value + } object StylePrint { private val Anything: String = """.*?""" diff --git a/src/main/scala/spells/ThrowableOpsModule.scala b/src/main/scala/spells/ThrowableOpsModule.scala index f9a4334..bffde79 100644 --- a/src/main/scala/spells/ThrowableOpsModule.scala +++ b/src/main/scala/spells/ThrowableOpsModule.scala @@ -9,7 +9,7 @@ trait ThrowableOpsModule { with StringOpsModule with StylePrintModule => - import java.io.{PrintWriter, StringWriter} + import java.io.{ PrintWriter, StringWriter } final implicit class ThrowableOpsFromSpells(value: Throwable) extends CustomRendering { @@ -24,7 +24,8 @@ trait ThrowableOpsModule { val writer = new StringWriter val autoFlush = true value.printStackTrace(new PrintWriter(writer, autoFlush)) - writer.getBuffer + writer + .getBuffer .deleteCharAt(writer.getBuffer.length - 1) .toString .replace("\t", " ") diff --git a/src/main/scala/spells/Tuple2OpsModule.scala b/src/main/scala/spells/Tuple2OpsModule.scala index 4f70012..cc76c89 100644 --- a/src/main/scala/spells/Tuple2OpsModule.scala +++ b/src/main/scala/spells/Tuple2OpsModule.scala @@ -10,43 +10,42 @@ trait Tuple2OpsModule { final implicit def Tuple2OpsFromSpells[Key, Value]( tuple: (Key, Value) - )( - implicit + )(implicit keyRendering: Key => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any, valueRendering: Value => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any - ): CustomRenderingModule#CustomRendering = new CustomRendering { - val (key, value) = tuple + ): CustomRenderingModule#CustomRendering = + new CustomRendering { + val (key, value) = tuple - final override def rendered( - implicit - availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = - SpellsConfig.terminal.WidthInCharacters.value - ): String = { - render(key.rendered, value.rendered, availableWidthInCharacters) + final override def rendered( + implicit + availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = + SpellsConfig.terminal.WidthInCharacters.value + ): String = + render(key.rendered, value.rendered, availableWidthInCharacters) } - } final implicit def MapEntryOpsFromSpells[Key, Value]( entry: java.util.Map.Entry[Key, Value] - )( - implicit + )(implicit keyRendering: Key => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any, valueRendering: Value => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any - ): CustomRenderingModule#CustomRendering = new CustomRendering { - val key = entry.getKey - val value = entry.getValue + ): CustomRenderingModule#CustomRendering = + new CustomRendering { + val key = entry.getKey + val value = entry.getValue - final override def rendered( - implicit - availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = - SpellsConfig.terminal.WidthInCharacters.value - ): String = - render(key.rendered, value.rendered, availableWidthInCharacters) - } + final override def rendered( + implicit + availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = + SpellsConfig.terminal.WidthInCharacters.value + ): String = + render(key.rendered, value.rendered, availableWidthInCharacters) + } private def render( renderedKey: String, @@ -75,17 +74,21 @@ trait Tuple2OpsModule { .map(leftPadding + _) .mkString("\n") - if (!simpleRendering.contains("\n") && AnsiStyle - .removed(simpleRendering) - .size <= availableWidthInCharacters) + if ( + !simpleRendering.contains("\n") && AnsiStyle + .removed(simpleRendering) + .size <= availableWidthInCharacters + ) simpleRendering else if (renderedAndWrappedValue.contains("\n")) complexRendering - else if (AnsiStyle - .removed(renderedAndWrappedValue) - .size <= (availableWidthInCharacters - AnsiStyle - .removed(renderedAndWrappedKey.split("\n").last) - .size - separator.size)) + else if ( + AnsiStyle + .removed(renderedAndWrappedValue) + .size <= (availableWidthInCharacters - AnsiStyle + .removed(renderedAndWrappedKey.split("\n").last) + .size - separator.size) + ) simpleRendering else complexRendering diff --git a/src/main/scala/spells/XrayModule.scala b/src/main/scala/spells/XrayModule.scala index 9b5b53d..bcc2098 100644 --- a/src/main/scala/spells/XrayModule.scala +++ b/src/main/scala/spells/XrayModule.scala @@ -47,8 +47,7 @@ trait XrayModule { expression: => T, description: XrayModule#Description = Xray.Defaults.Description, increaseStackTraceDepthBy: Int = Xray.Defaults.StackTraceDepthOffset - )( - implicit + )(implicit typeTag: TypeTag[T], style: AnsiModule#AnsiStyle = AnsiStyle.Reset, rendering: T => CustomRenderingModule#CustomRendering = @@ -88,8 +87,7 @@ trait XrayModule { expression: => T, description: XrayModule#Description = Xray.Defaults.Description, increaseStackTraceDepthBy: Int = Xray.Defaults.StackTraceDepthOffset - )( - implicit + )(implicit style: AnsiModule#AnsiStyle = AnsiStyle.Reset ): XrayModule#XrayReport[T] = { val now = Calendar.getInstance @@ -121,7 +119,11 @@ trait XrayModule { implicit increaseStackTraceDepthBy: XrayModule#IncreaseStackTraceDepthBy = 0 ): StackTraceElement = - Thread.currentThread.getStackTrace apply increaseStackTraceDepthBy.value + Xray.Defaults.StackTraceDepthOffset + Thread + .currentThread + .getStackTrace apply increaseStackTraceDepthBy.value + Xray + .Defaults + .StackTraceDepthOffset /** Implicit conversion from `T` to `XrayFromSpells`, which contains methods like `xray` and `xrayIf`. * @param expression the expression to be evaluated @@ -133,15 +135,14 @@ trait XrayModule { */ final implicit class XrayFromSpells[T]( expression: => T - )( - implicit + )(implicit typeTag: TypeTag[T], style: AnsiModule#AnsiStyle = AnsiStyle.Reset, rendering: T => CustomRenderingModule#CustomRendering = CustomRendering.Defaults.Any, monitor: XrayModule#XrayReport[T] => Unit = - (report: XrayModule#XrayReport[T]) => - Console.println(report.rendered)) { + (report: XrayModule#XrayReport[T]) => Console.println(report.rendered) + ) { /** A DSL for producing `XrayReport`s. * @@ -178,8 +179,7 @@ trait XrayModule { */ def xrayIf( conditionFunction: XrayModule#XrayReport[T] => Boolean - )( - implicit + )(implicit description: XrayModule#Description = Xray.Defaults.Description ): T = { val report = xrayed( @@ -197,12 +197,11 @@ trait XrayModule { final implicit class XrayWeakFromSpells[T]( expression: => T - )( - implicit + )(implicit style: AnsiModule#AnsiStyle = AnsiStyle.Reset, monitor: XrayModule#XrayReport[T] => Unit = - (report: XrayModule#XrayReport[T]) => - Console.println(report.rendered)) { + (report: XrayModule#XrayReport[T]) => Console.println(report.rendered) + ) { /** A DSL for producing `XrayReport`s when `xray` does not compile, because of the `TypeTag`. * @@ -238,8 +237,7 @@ trait XrayModule { */ def xrayIfWeak( conditionFunction: XrayModule#XrayReport[T] => Boolean - )( - implicit + )(implicit description: XrayModule#Description = Xray.Defaults.Description ): T = { val report = @@ -272,7 +270,7 @@ trait XrayModule { final private[spells] val StackTraceDepthOffset: Int = { // $COVERAGE-OFF$ - if (`isScalaVersionSmallerThan 2.12`) 3 else 4 + if (`isScalaVersionSmallerThan 2.12`) 3 else 7 // $COVERAGE-ON$ } @@ -316,8 +314,8 @@ trait XrayModule { CustomRendering.Defaults.Any, typeTag: Option[TypeTag[T]], final val additionalContent: immutable.Seq[(String, String)] = - immutable.Seq.empty) - extends CustomRendering { + immutable.Seq.empty + ) extends CustomRendering { private lazy val safeAdditionalContent: immutable.Seq[(String, String)] = Option(additionalContent).getOrElse(immutable.Seq.empty) @@ -344,8 +342,14 @@ trait XrayModule { ): String = { def lines(availableWidthInCharacters: Int): Seq[(String, String)] = { def ifNotIgnored(key: String, value: String): Option[(String, String)] = - if (SpellsConfig.xray.report.IgnoredContentKeys.value - .contains(String.valueOf(key))) + if ( + SpellsConfig + .xray + .report + .IgnoredContentKeys + .value + .contains(String.valueOf(key)) + ) None else Some(String.valueOf(key) -> String.valueOf(value)) @@ -357,10 +361,9 @@ trait XrayModule { ) val valueRelatedContent = Vector( - ifNotIgnored("Location", stackTraceElement.rendered), { - if (value == null) None - else ifNotIgnored("HashCode", value.hashCode.toString) - }, + ifNotIgnored("Location", stackTraceElement.rendered), + if (value == null) None + else ifNotIgnored("HashCode", value.hashCode.toString), ifNotIgnored("Thread", thread.toString) ) @@ -372,10 +375,18 @@ trait XrayModule { val decodedTypeName = tag.tpe.toString.withDecodedScalaSymbols val typeTuple = ifNotIgnored("Type", decodedTypeName) val shouldNotIgnoreClass = - !SpellsConfig.xray.report.IgnoredContentKeys.value + !SpellsConfig + .xray + .report + .IgnoredContentKeys + .value .contains("Class") val shouldIgnoreType = - SpellsConfig.xray.report.IgnoredContentKeys.value + SpellsConfig + .xray + .report + .IgnoredContentKeys + .value .contains("Type") if (shouldIgnoreType && shouldNotIgnoreClass) Vector(classTuple) @@ -505,7 +516,8 @@ trait XrayModule { private[spells] object XrayReport { final private[spells] def customRenderedTableForXray( in: Int => Seq[(String, String)], - styles: Map[String, AnsiModule#AnsiStyle] = Map.empty withDefaultValue AnsiStyle.Reset, + styles: Map[String, AnsiModule#AnsiStyle] = + Map.empty withDefaultValue AnsiStyle.Reset, availableWidthInCharacters: Int ): (Seq[String], Int) = { val sizeOfTheBiggestKey = diff --git a/src/test/scala/spells/UnitTestConfiguration.scala b/src/test/scala/spells/UnitTestConfiguration.scala index c5a7411..bed0994 100644 --- a/src/test/scala/spells/UnitTestConfiguration.scala +++ b/src/test/scala/spells/UnitTestConfiguration.scala @@ -1,9 +1,11 @@ package spells import org.scalatest._ +import org.scalatest.funsuite.AnyFunSuite +import org.scalatest.matchers.should trait UnitTestConfiguration - extends FunSuite - with Matchers - with BeforeAndAfterEach - with Inspectors + extends AnyFunSuite + with should.Matchers + with BeforeAndAfterEach + with Inspectors diff --git a/src/test/scala/spells/configuration/ConfigurationTests.scala b/src/test/scala/spells/configuration/ConfigurationTests.scala index 18db94e..f037f83 100644 --- a/src/test/scala/spells/configuration/ConfigurationTests.scala +++ b/src/test/scala/spells/configuration/ConfigurationTests.scala @@ -5,7 +5,7 @@ import scala.concurrent.duration._ import scala.reflect.runtime.universe._ import spells._ -import com.typesafe.config.{Config, ConfigFactory} +import com.typesafe.config.{ Config, ConfigFactory } class ConfigurationTests extends UnitTestConfiguration { test("This is how config injection should work") { @@ -346,7 +346,12 @@ class ConfigurationTests extends UnitTestConfiguration { new StackTraceElement("declaringClass", "methodName", "fileName", 0) basic.rendered should be("(fileName:0)") - new StackTraceElement("declaringClass", "methodName", "fileName", -1).rendered should be( + new StackTraceElement( + "declaringClass", + "methodName", + "fileName", + -1 + ).rendered should be( "(fileName)" ) new StackTraceElement( @@ -355,13 +360,28 @@ class ConfigurationTests extends UnitTestConfiguration { "fileName", nativeMethod ).rendered should be("(Native Method)") - new StackTraceElement("declaringClass", "methodName", null, 0).rendered should be( + new StackTraceElement( + "declaringClass", + "methodName", + null, + 0 + ).rendered should be( "(Unknown Source)" ) - new StackTraceElement("declaringClass", "methodName", null, -1).rendered should be( + new StackTraceElement( + "declaringClass", + "methodName", + null, + -1 + ).rendered should be( "(Unknown Source)" ) - new StackTraceElement("declaringClass", "methodName", null, nativeMethod).rendered should be( + new StackTraceElement( + "declaringClass", + "methodName", + null, + nativeMethod + ).rendered should be( "(Native Method)" ) diff --git a/src/test/scala/spells/user/DoubleEntryConfigKeeping.scala b/src/test/scala/spells/user/DoubleEntryConfigKeeping.scala index 9db60f3..4e1fac6 100644 --- a/src/test/scala/spells/user/DoubleEntryConfigKeeping.scala +++ b/src/test/scala/spells/user/DoubleEntryConfigKeeping.scala @@ -8,7 +8,11 @@ class DoubleEntryConfigKeeping extends spells.UnitTestConfiguration { } test("The reference.conf file should be valid") { - SpellsConfig.`custom-rendering`.display.ShortStackTraceElements.value should be( + SpellsConfig + .`custom-rendering` + .display + .ShortStackTraceElements + .value should be( false ) diff --git a/src/test/scala/spells/user/FunctionNOpsTests.scala b/src/test/scala/spells/user/FunctionNOpsTests.scala index 07563fe..90aaf4e 100644 --- a/src/test/scala/spells/user/FunctionNOpsTests.scala +++ b/src/test/scala/spells/user/FunctionNOpsTests.scala @@ -4,13 +4,69 @@ class FunctionNTests extends spells.UnitTestConfiguration { test("FunctionN rendering tests") { (() => "").rendered should include regex """\(\) => .*String""" // ((_: Int) => "").rendered should include regex """.*Int => .*String""" - ((_: Int, _: Int) => "").rendered should include regex """\(.*Int, .*Int\) => .*String""" - ((_: Int, _: Int, _: Int) => "").rendered should include regex """\(.*Int, .*Int, .*Int\) => .*String""" - ((_: Int, _: Int, _: Int, _: Int) => "").rendered should include regex """\(.*Int, .*Int, .*Int, .*Int\) => .*String""" - ((_: Int, _: Int, _: Int, _: Int, _: Int) => "").rendered should include regex """\(.*Int, .*Int, .*Int, .*Int, .*Int\) => .*String""" - ((_: Int, _: Int, _: Int, _: Int, _: Int, _: Int) => "").rendered should include regex """\(.*Int, .*Int, .*Int, .*Int, .*Int, .*Int\) => .*String""" - ((_: Int, _: Int, _: Int, _: Int, _: Int, _: Int, _: Int) => "").rendered should include regex """\(.*Int, .*Int, .*Int, .*Int, .*Int, .*Int, .*Int\) => .*String""" - ((_: Int, _: Int, _: Int, _: Int, _: Int, _: Int, _: Int, _: Int) => "").rendered should include regex """\(.*Int, .*Int, .*Int, .*Int, .*Int, .*Int, .*Int, .*Int\) => .*String""" + ( + ( + _: Int, + _: Int + ) => "" + ).rendered should include regex """\(.*Int, .*Int\) => .*String""" + ( + ( + _: Int, + _: Int, + _: Int + ) => "" + ).rendered should include regex """\(.*Int, .*Int, .*Int\) => .*String""" + ( + ( + _: Int, + _: Int, + _: Int, + _: Int + ) => "" + ).rendered should include regex """\(.*Int, .*Int, .*Int, .*Int\) => .*String""" + ( + ( + _: Int, + _: Int, + _: Int, + _: Int, + _: Int + ) => "" + ).rendered should include regex """\(.*Int, .*Int, .*Int, .*Int, .*Int\) => .*String""" + ( + ( + _: Int, + _: Int, + _: Int, + _: Int, + _: Int, + _: Int + ) => "" + ).rendered should include regex """\(.*Int, .*Int, .*Int, .*Int, .*Int, .*Int\) => .*String""" + ( + ( + _: Int, + _: Int, + _: Int, + _: Int, + _: Int, + _: Int, + _: Int + ) => "" + ).rendered should include regex """\(.*Int, .*Int, .*Int, .*Int, .*Int, .*Int, .*Int\) => .*String""" + ( + ( + _: Int, + _: Int, + _: Int, + _: Int, + _: Int, + _: Int, + _: Int, + _: Int + ) => "" + ).rendered should include regex """\(.*Int, .*Int, .*Int, .*Int, .*Int, .*Int, .*Int, .*Int\) => .*String""" ( ( _: Int, diff --git a/src/test/scala/spells/user/HumanRenderingTests.scala b/src/test/scala/spells/user/HumanRenderingTests.scala index dcea61c..4440980 100644 --- a/src/test/scala/spells/user/HumanRenderingTests.scala +++ b/src/test/scala/spells/user/HumanRenderingTests.scala @@ -91,7 +91,9 @@ class HumanRenderingTests extends spells.UnitTestConfiguration { over(upperBound * 2).render.duration.months should be("2 years 1 month") } - test("""It should be possible to render human readble durations from days""") { + test( + """It should be possible to render human readble durations from days""" + ) { 0.render.duration.days should be("0 days") 1.render.duration.days should be("1 day") -1.render.duration.days should be("-1 days") @@ -109,7 +111,9 @@ class HumanRenderingTests extends spells.UnitTestConfiguration { over(upperBound * 2).render.duration.days should be("2 weeks 1 day") } - test("""It should be possible to render human readble durations from hours""") { + test( + """It should be possible to render human readble durations from hours""" + ) { 0.render.duration.hours should be("0 hours") 1.render.duration.hours should be("1 hour") -1.render.duration.hours should be("-1 hours") @@ -187,7 +191,8 @@ class HumanRenderingTests extends spells.UnitTestConfiguration { ) val previousUpperBoundPower = 24 - val upperBoundPowerPower = upperBound * previousUpperBound * previousUpperBoundPower + upperBoundPower + val upperBoundPowerPower = + upperBound * previousUpperBound * previousUpperBoundPower + upperBoundPower under(upperBoundPowerPower).render.duration.seconds should be( "1 day 1 hour 59 seconds" diff --git a/src/test/scala/spells/user/IterableOpsTests.scala b/src/test/scala/spells/user/IterableOpsTests.scala index a540bc0..c38e432 100644 --- a/src/test/scala/spells/user/IterableOpsTests.scala +++ b/src/test/scala/spells/user/IterableOpsTests.scala @@ -234,7 +234,7 @@ class IterableOpsTests extends spells.UnitTestConfiguration { ) { renderedTable( _ => Seq.empty, - availableWidthInCharacters = util.Random.nextInt + availableWidthInCharacters = util.Random.nextInt() ) should be(Vector.empty[String]) } } diff --git a/src/test/scala/spells/user/StylePrintTests.scala b/src/test/scala/spells/user/StylePrintTests.scala index 92625bf..4fb0310 100644 --- a/src/test/scala/spells/user/StylePrintTests.scala +++ b/src/test/scala/spells/user/StylePrintTests.scala @@ -90,7 +90,9 @@ class StylePrintTests extends spells.UnitTestConfiguration { test( """styled("yellow" + "red".red + "yellow" + "green".green + "yellow")(Yellow) should be("yellow".yellow + "red".red + "yellow".yellow + "green".green + "yellow".yellow)""" ) { - styled("yellow" + "red".red + "yellow" + "green".green + "yellow")(Yellow) should be( + styled("yellow" + "red".red + "yellow" + "green".green + "yellow")( + Yellow + ) should be( "yellow".yellow + "red".red + "yellow".yellow + "green".green + "yellow".yellow ) } @@ -132,7 +134,9 @@ class StylePrintTests extends spells.UnitTestConfiguration { """styled("yellow" + "red".red + "yellow" + "green".green + "yellow") should be("yellow".yellow + "red".red + "yellow".yellow + "green".green + "yellow".yellow)""" ) { implicit val customStyle = Yellow - styled("yellow" + "red".red + "yellow" + "green".green + "yellow") should be( + styled( + "yellow" + "red".red + "yellow" + "green".green + "yellow" + ) should be( "yellow".yellow + "red".red + "yellow".yellow + "green".green + "yellow".yellow ) } diff --git a/src/test/scala/spells/user/Tuple2OpsTests.scala b/src/test/scala/spells/user/Tuple2OpsTests.scala index 1e8ee1b..800d980 100644 --- a/src/test/scala/spells/user/Tuple2OpsTests.scala +++ b/src/test/scala/spells/user/Tuple2OpsTests.scala @@ -14,7 +14,8 @@ class Tuple2OpsTests extends spells.UnitTestConfiguration { val availableWidthInCharacters = SpellsConfig.terminal.WidthInCharacters.value val separatorWithSpacesWidthInCharacters = 4 - val equalSize = (availableWidthInCharacters / 2) - (separatorWithSpacesWidthInCharacters / 2) + val equalSize = + (availableWidthInCharacters / 2) - (separatorWithSpacesWidthInCharacters / 2) val key = "x" * equalSize val value = "y" * equalSize diff --git a/src/test/scala/spells/user/XrayReportRenderingTests.scala b/src/test/scala/spells/user/XrayReportRenderingTests.scala index 10a6960..0690e3c 100644 --- a/src/test/scala/spells/user/XrayReportRenderingTests.scala +++ b/src/test/scala/spells/user/XrayReportRenderingTests.scala @@ -1,7 +1,7 @@ package spells.user import java.text.SimpleDateFormat -import java.util.{Date, Calendar} +import java.util.{ Calendar, Date } import scala.concurrent.duration._ import scala.reflect.runtime.universe._ @@ -77,8 +77,10 @@ class XrayReportRenderingTests extends spells.UnitTestConfiguration { val tableWidth = report.split("\n").maxBy(_.size).size tableWidth should be < maxWidth - val description = ("x" * (tableWidth + 10)) + "\n" + ("y" * (tableWidth + 10)) - val hyphens = createReportOnSameLine(description).rendered + val description = + ("x" * (tableWidth + 10)) + "\n" + ("y" * (tableWidth + 10)) + val hyphens = createReportOnSameLine(description) + .rendered .split("\n") .find(_.forall(hyphensAndOtherSeparators)) .map(_.size) @@ -138,7 +140,9 @@ class XrayReportRenderingTests extends spells.UnitTestConfiguration { } test("HashCode should not be included in xray report") { - createReport(reportValue = null).rendered should not include (s"HashCode │ ${reportValue.hashCode}") + createReport(reportValue = + null + ).rendered should not include (s"HashCode │ ${reportValue.hashCode}") } test("If type and class are equal the class should not be rendered") { @@ -311,9 +315,8 @@ class XrayReportRenderingTests extends spells.UnitTestConfiguration { // format: ON SilentOutputStream out { - implicit def monitor(report: XrayReport[Any]): Unit = { + implicit def monitor(report: XrayReport[Any]): Unit = report.rendered should include(expected) - } Seq("I", "II", "III").xray } @@ -327,7 +330,7 @@ class XrayReportRenderingTests extends spells.UnitTestConfiguration { .customRenderedTableForXray( in = _ => Seq.empty, styles = Map.empty, - availableWidthInCharacters = util.Random.nextInt + availableWidthInCharacters = util.Random.nextInt() ) } } diff --git a/src/test/scala/spells/user/XrayTests.scala b/src/test/scala/spells/user/XrayTests.scala index 91475f7..5ade07c 100644 --- a/src/test/scala/spells/user/XrayTests.scala +++ b/src/test/scala/spells/user/XrayTests.scala @@ -5,10 +5,11 @@ import AnsiStyle._ class XrayTests extends spells.UnitTestConfiguration { test("The expression inside of xray should be evaluated only once") { var timesEvaluated = 0 - def expression() = timesEvaluated += 1 + def expression(): Unit = + timesEvaluated += 1 SilentOutputStream out { - expression.xray + expression().xray } timesEvaluated should be(1) @@ -21,7 +22,9 @@ class XrayTests extends spells.UnitTestConfiguration { } } - test("Monitor should only be called for xrayIf if the condition yields true") { + test( + "Monitor should only be called for xrayIf if the condition yields true" + ) { new MonitoringEnvironement { val condition: spells.XrayModule#XrayReport[Int] => Boolean = _ => true @@ -30,7 +33,9 @@ class XrayTests extends spells.UnitTestConfiguration { } } - test("Monitor should not be called for xrayIf if the condition yields false") { + test( + "Monitor should not be called for xrayIf if the condition yields false" + ) { new MonitoringEnvironement { val condition: spells.XrayModule#XrayReport[Int] => Boolean = _ => false @@ -45,7 +50,7 @@ class XrayTests extends spells.UnitTestConfiguration { private def assert(sample: String) = xrayed(sample).stackTraceElement should be( - currentLineStackTraceElement(increaseStackTraceDepthBy = 1) + currentLineStackTraceElement(increaseStackTraceDepthBy = 4) ) // dodgy test("""It should be possible to implicitly pass in styles to xrayed""") { diff --git a/test.sbt b/test.sbt index cdc9d3a..30eae16 100644 --- a/test.sbt +++ b/test.sbt @@ -7,11 +7,3 @@ Test / testOptions += Test / testOptions += Tests.Cleanup(UserConfigFileManager.deleteSpellsConfigFileForCurrentUser) - -Test / testOptions += - Tests.Argument( - TestFrameworks.ScalaTest, - "-oSD", - "-h", - "target/scalatest-reports" - )