diff --git a/.scalafmt.conf b/.scalafmt.conf index 219f972426..0ae0df53b0 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.8.3" +version = "3.8.4" runner.dialect = scala3 maxColumn = 120 diff --git a/common/shared/src/main/scala/org/specs2/control/Property.scala b/common/shared/src/main/scala/org/specs2/control/Property.scala index 30ff563c63..a982cac92b 100644 --- a/common/shared/src/main/scala/org/specs2/control/Property.scala +++ b/common/shared/src/main/scala/org/specs2/control/Property.scala @@ -59,9 +59,8 @@ case class Property[T](value: () => Option[T], evaluated: Boolean = false, evalu def map[U](f: T => U)(using CanEqual[U, U]): Property[U] = new Property(() => optionalValue.map(f)) /** option-like orElse */ - def orElse[U >: T](other: =>Property[U])(using CanEqual[U, U]): Property[U] = new Property(() => - optionalValue.orElse(other.optionalValue) - ) + def orElse[U >: T](other: =>Property[U])(using CanEqual[U, U]): Property[U] = + new Property(() => optionalValue.orElse(other.optionalValue)) /** option-like toLeft */ def toLeft[R](right: R): Either[T, R] = optionalValue.toLeft(right) diff --git a/common/shared/src/main/scala/org/specs2/execute/Snippets.scala b/common/shared/src/main/scala/org/specs2/execute/Snippets.scala index 7d484a9bb8..0a0a07c9b2 100644 --- a/common/shared/src/main/scala/org/specs2/execute/Snippets.scala +++ b/common/shared/src/main/scala/org/specs2/execute/Snippets.scala @@ -176,9 +176,7 @@ object Snippet: * 3 things need to be trimmed: * * - the "snippet" method call - * * - the expression from start and end accolades if it is a multiline expression - * * - in some case it is necessary to add a dummy expression so that the range position of the captured snippet is * correct. /**/;1/**/ is the smallest such expression */ diff --git a/common/shared/src/main/scala/org/specs2/main/Diffs.scala b/common/shared/src/main/scala/org/specs2/main/Diffs.scala index ff7ad2b69f..6d1cc34f96 100644 --- a/common/shared/src/main/scala/org/specs2/main/Diffs.scala +++ b/common/shared/src/main/scala/org/specs2/main/Diffs.scala @@ -66,9 +66,10 @@ case class SmartDiffs( /** @return the diffs for sequences */ def showSeqDiffs(actual: Seq[Any], expected: Seq[Any], ordered: Boolean): (Seq[String], Seq[String]) = - val (matched, missing) = BestMatching.findBestMatch(actual, expected, (t: Any, v: Any) => v == t, eachCheck = true)( - using AsResult.booleanAsResult - ) + val (matched, missing) = + BestMatching.findBestMatch(actual, expected, (t: Any, v: Any) => v == t, eachCheck = true)(using + AsResult.booleanAsResult + ) val (_, koValues) = matched.partition(_._3.isSuccess) val added = koValues.map(_._1) diff --git a/common/shared/src/main/scala/org/specs2/text/AnsiColors.scala b/common/shared/src/main/scala/org/specs2/text/AnsiColors.scala index e01ee584bc..dbef33c8bd 100644 --- a/common/shared/src/main/scala/org/specs2/text/AnsiColors.scala +++ b/common/shared/src/main/scala/org/specs2/text/AnsiColors.scala @@ -26,8 +26,7 @@ trait AnsiColors: /** @return a string with no color codes */ def removeColors(s: String, doIt: Boolean = true): String = - if doIt then all.foldLeft(s.notNull) { (res, cur) => res.replace(cur.color, "") } - else s.notNull + if doIt then all.foldLeft(s.notNull) { (res, cur) => res.replace(cur.color, "") } else s.notNull /** @return * a colored string (if args.color == true) color markers are inserted at the beginning and end of each line so diff --git a/common/shared/src/main/scala/org/specs2/text/ShowText.scala b/common/shared/src/main/scala/org/specs2/text/ShowText.scala index ae905b8e5d..ab0a953f88 100644 --- a/common/shared/src/main/scala/org/specs2/text/ShowText.scala +++ b/common/shared/src/main/scala/org/specs2/text/ShowText.scala @@ -328,8 +328,16 @@ open case class Show8[T1, T2, T3, T4, T5, T6, T7, T8]( def show10[T9, T10](show10: T10 => String): Show10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10] = Show10(show1, show2, show3, show4, show5, show6, show7, show8, (_: T9).notNull, show10) - def show(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8) - : (String, String, String, String, String, String, String, String) = + def show( + t1: T1, + t2: T2, + t3: T3, + t4: T4, + t5: T5, + t6: T6, + t7: T7, + t8: T8 + ): (String, String, String, String, String, String, String, String) = (show1(t1), show2(t2), show3(t3), show4(t4), show5(t5), show6(t6), show7(t7), show8(t8)) def showList(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8): List[String] = @@ -349,8 +357,17 @@ open case class Show9[T1, T2, T3, T4, T5, T6, T7, T8, T9]( def show10[T10](show10: T10 => String): Show10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10] = Show10(show1, show2, show3, show4, show5, show6, show7, show8, show9, show10) - def show(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9) - : (String, String, String, String, String, String, String, String, String) = + def show( + t1: T1, + t2: T2, + t3: T3, + t4: T4, + t5: T5, + t6: T6, + t7: T7, + t8: T8, + t9: T9 + ): (String, String, String, String, String, String, String, String, String) = (show1(t1), show2(t2), show3(t3), show4(t4), show5(t5), show6(t6), show7(t7), show8(t8), show9(t9)) def showList(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9): List[String] = @@ -369,8 +386,18 @@ case class Show10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]( show10: T10 => String = (_: T10).notNull ): - def show(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9, t10: T10) - : (String, String, String, String, String, String, String, String, String, String) = + def show( + t1: T1, + t2: T2, + t3: T3, + t4: T4, + t5: T5, + t6: T6, + t7: T7, + t8: T8, + t9: T9, + t10: T10 + ): (String, String, String, String, String, String, String, String, String, String) = (show1(t1), show2(t2), show3(t3), show4(t4), show5(t5), show6(t6), show7(t7), show8(t8), show9(t9), show10(t10)) def showList(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9, t10: T10): List[String] = diff --git a/core/shared/src/main/scala/org/specs2/specification/create/S2StringContext.scala b/core/shared/src/main/scala/org/specs2/specification/create/S2StringContext.scala index 305d1654c8..f52666c247 100644 --- a/core/shared/src/main/scala/org/specs2/specification/create/S2StringContext.scala +++ b/core/shared/src/main/scala/org/specs2/specification/create/S2StringContext.scala @@ -179,8 +179,7 @@ object S2StringContext: * We interpret it in the following way: * * 1. if there is a piece of text on 1 line then the text is the execution description - * - * 2. if there is some text on more than one line then + * 2. if there is some text on more than one line then * * 2.1 if the last line contains only spaces (followed by the execution line) then this is an auto-example which uses * its own 'sourceCode' as a Description diff --git a/core/shared/src/main/scala/org/specs2/specification/process/Executor.scala b/core/shared/src/main/scala/org/specs2/specification/process/Executor.scala index eb5ab84391..1a1628e01e 100644 --- a/core/shared/src/main/scala/org/specs2/specification/process/Executor.scala +++ b/core/shared/src/main/scala/org/specs2/specification/process/Executor.scala @@ -53,9 +53,7 @@ case class SteppedExecutor(env: Env) extends Executor: * * - "join" points are respected, i.e. when a Fragment is a join we must make sure that all previously executing * fragments have finished their execution - * * - the fragments execute sequentially when args.sequential is true - * * - the execution stops if one fragment indicates that the result of the previous executions is not correct */ private def sequencedExecution(specArguments: Arguments): AsyncTransducer[Fragment, Fragment] = { diff --git a/html/src/main/scala/org/specs2/reporter/HtmlBodyPrinter.scala b/html/src/main/scala/org/specs2/reporter/HtmlBodyPrinter.scala index 8942e75f3d..525df30c76 100755 --- a/html/src/main/scala/org/specs2/reporter/HtmlBodyPrinter.scala +++ b/html/src/main/scala/org/specs2/reporter/HtmlBodyPrinter.scala @@ -141,7 +141,8 @@ trait HtmlBodyPrinter: {r.message} - if level.incrementNext then + if level.incrementNext then + else example case f if Fragment.isStepOrAction(f) => @@ -218,7 +219,8 @@ trait HtmlBodyPrinter: case _ => NodeSeq.Empty val fullMessage = - if showTrace then
  • {message}{detailedFailure}
  • + if showTrace then +
  • {message}{detailedFailure}
  • else
  • {message}{detailedFailure}
  • val trace = diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/Matcher.scala b/matcher/shared/src/main/scala/org/specs2/matcher/Matcher.scala index 2a422e3453..972da773ea 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/Matcher.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/Matcher.scala @@ -25,7 +25,6 @@ import scala.annotation.* * Implementation notes: * - the parameter to the apply method must be a by-name parameter. This allows some values to be evaluated only when * necessary. - * * - However in the implementation of the apply function, it must be taken care of not evaluating the parameter * twice. Assigning it to a val is the solution to this issue. */ diff --git a/matcher/shared/src/main/scala/org/specs2/matcher/TraversableMatchers.scala b/matcher/shared/src/main/scala/org/specs2/matcher/TraversableMatchers.scala index e600805a7c..f6b48ceecc 100644 --- a/matcher/shared/src/main/scala/org/specs2/matcher/TraversableMatchers.scala +++ b/matcher/shared/src/main/scala/org/specs2/matcher/TraversableMatchers.scala @@ -610,8 +610,7 @@ case class ContainWithResultSeq[T]( else failures .map { case (value, rs) => "- " + value + "\n" + rs.map(" * " + _).mkString("\n") } - .mkString("\n", "\n", "\n") - ) + .mkString("\n", "\n", "\n")) ) val r = diff --git a/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala b/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala index 611d27e315..600764fd02 100644 --- a/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala +++ b/scalacheck/src/main/scala/org/specs2/scalacheck/ScalaCheckProperty.scala @@ -1172,8 +1172,16 @@ case class ScalaCheckFunction8[T1, T2, T3, T4, T5, T6, T7, T8, R]( def setGen6(g6: Gen[T6]): SelfType = setArbitrary6(Arbitrary(g6)) def setGen7(g7: Gen[T7]): SelfType = setArbitrary7(Arbitrary(g7)) def setGen8(g8: Gen[T8]): SelfType = setArbitrary8(Arbitrary(g8)) - def setGens(g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8]) - : SelfType = + def setGens( + g1: Gen[T1], + g2: Gen[T2], + g3: Gen[T3], + g4: Gen[T4], + g5: Gen[T5], + g6: Gen[T6], + g7: Gen[T7], + g8: Gen[T8] + ): SelfType = setGen1(g1).setGen2(g2).setGen3(g3).setGen4(g4).setGen5(g5).setGen6(g6).setGen7(g7).setGen8(g8) def setShrink1(s1: Shrink[T1]): SelfType = copy(argInstances1 = argInstances1.copy(shrink = Some(s1)))