From bc6c23d5de3a0f927793c0718d5e38f9092ebc73 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 30 Oct 2021 02:04:40 +0200 Subject: [PATCH 1/2] Update scalafmt-core to 3.0.8 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 4177db2..9da40d5 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.0.4" +version = "3.0.8" maxColumn = 140 align.preset = some align.tokens.add = [ From 8a2457c57fa53efd6be673805516033f9ab8984e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 30 Oct 2021 02:04:48 +0200 Subject: [PATCH 2/2] Reformat with scalafmt 3.0.8 --- build.sbt | 2 +- core/src/main/scala/flawless/api/dsl.scala | 4 ++-- core/src/main/scala/flawless/api/predicates.scala | 2 +- core/src/main/scala/flawless/data/data.scala | 4 ++-- core/src/main/scala/flawless/eval/eval.scala | 4 ++-- core/src/main/scala/flawless/eval/interpreter.scala | 8 ++++---- core/src/main/scala/flawless/eval/stats.scala | 2 +- .../src/main/scala/flawless/examples/ExampleTests.scala | 4 ++-- tests/src/main/scala/flawlessly/GetStatsTest.scala | 2 +- .../main/scala/flawlessly/InterpreterReportingTest.scala | 4 ++-- tests/src/main/scala/flawlessly/MonadicTestSuite.scala | 2 +- tests/src/main/scala/flawlessly/TestReporter.scala | 4 ++-- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/build.sbt b/build.sbt index e24348e..ad0e386 100644 --- a/build.sbt +++ b/build.sbt @@ -59,7 +59,7 @@ val examples = commonSettings, libraryDependencies ++= List( "org.typelevel" %% "cats-effect" % "3.2.9", - //this won't work for now + // this won't work for now "org.tpolecat" %% "doobie-hikari" % "1.0.0-M4", "org.postgresql" % "postgresql" % "42.2.20" ) diff --git a/core/src/main/scala/flawless/api/dsl.scala b/core/src/main/scala/flawless/api/dsl.scala index df8012f..94576e3 100644 --- a/core/src/main/scala/flawless/api/dsl.scala +++ b/core/src/main/scala/flawless/api/dsl.scala @@ -54,7 +54,7 @@ trait AllDsl { NonEmptyList.one(Test(name, TestRun.Lazy(Eval.later(assertions)))) object ensure { - //todo inconsistent with ensureM.apply + // todo inconsistent with ensureM.apply def apply[F[_], A](value: A, predicate: PredicateT[F, A]): F[Assertion] = predicate(value) def fun[F[_], A](value: A)(predicate: A => F[Assertion]): F[Assertion] = ensure(value, PredicateT(predicate)) } @@ -66,7 +66,7 @@ trait AllDsl { apply(value)(PredicateT[cats.Id, A](predicate)) } - //todo naming + // todo naming def ensureEqualEq[A: Eq: Show](actual: A, expected: A): Assertion = ensure(actual, flawless.predicates.equalToEq(expected)) diff --git a/core/src/main/scala/flawless/api/predicates.scala b/core/src/main/scala/flawless/api/predicates.scala index 155eb70..fa3d044 100644 --- a/core/src/main/scala/flawless/api/predicates.scala +++ b/core/src/main/scala/flawless/api/predicates.scala @@ -26,7 +26,7 @@ trait AllPredicates { Assertion .failed( show"$actual (actual) was not equal to $expected (expected). Diff: ${Console.RESET}$diff" - ) //this reset is a hacky hack, but works! + ) // this reset is a hacky hack, but works! } } diff --git a/core/src/main/scala/flawless/data/data.scala b/core/src/main/scala/flawless/data/data.scala index 1474d4e..5276d39 100644 --- a/core/src/main/scala/flawless/data/data.scala +++ b/core/src/main/scala/flawless/data/data.scala @@ -226,10 +226,10 @@ object Suite { implicit def suiteSemigroup[F[_]: Apply]: Semigroup[Suite[F]] = _ zip _ def renameEach[F[_]: FlatMap](modName: String => F[String]): Suite[F] => Suite[F] = { - //todo what about stack safety in the case of tests in Id? + // todo what about stack safety in the case of tests in Id? def go(self: Suite[F]): F[Suite[F]] = self match { case o: algebra.One[f] => - //typing newName manually is needed due to GADT limitation + // typing newName manually is needed due to GADT limitation Functor[f].map(modName(o.name))(algebra.One[f](_: String, o.tests)) case s: algebra.Sequence[f] => s.traversal.traverse(s.suites)(go) diff --git a/core/src/main/scala/flawless/eval/eval.scala b/core/src/main/scala/flawless/eval/eval.scala index feeb5a9..7fcabeb 100644 --- a/core/src/main/scala/flawless/eval/eval.scala +++ b/core/src/main/scala/flawless/eval/eval.scala @@ -10,7 +10,7 @@ package object eval { import cats.Applicative - //todo: show names of suites + // todo: show names of suites def toTerminalOutput(output: Output): (String, ExitCode) = { import scala.io.AnsiColor @@ -96,7 +96,7 @@ package object eval { def loadArgs[F[_]: Applicative](args: List[String]): F[Settings] = { val _ = args - //todo actually read the args + // todo actually read the args Settings(visual = true).pure[F] // Settings(visual = false).pure[F] // Settings(visual = args.contains("visual")).pure[F] diff --git a/core/src/main/scala/flawless/eval/interpreter.scala b/core/src/main/scala/flawless/eval/interpreter.scala index 8af3d23..5a8df6e 100644 --- a/core/src/main/scala/flawless/eval/interpreter.scala +++ b/core/src/main/scala/flawless/eval/interpreter.scala @@ -35,7 +35,7 @@ trait Interpreter[F[_]] { } object Interpreter { - //A type alias for an action that interprets a single instance of Algebra (e.g. suite or test) + // A type alias for an action that interprets a single instance of Algebra (e.g. suite or test) type InterpretOne[Algebra[_[_]], F[_]] = Algebra[F] => F[Algebra[NoEffect]] def defaultInterpreter[F[_]: MonadThrow]: Interpreter[F] = @@ -45,7 +45,7 @@ object Interpreter { def finish(results: Assertion): Test[NoEffect] = Test(test.name, TestRun.Pure(results)) val exec: F[Test[NoEffect]] = test.result match { - //this is a GADT skolem - you think I'd know what that means by now... + // this is a GADT skolem - you think I'd know what that means by now... case eval: TestRun.Eval[f] => (eval.effect.handleError(Assertion.thrown(_)): F[Assertion]).map(finish) case TestRun.Pure(result) => finish(result).pure[F] case TestRun.Lazy(e) => @@ -66,7 +66,7 @@ object Interpreter { reporter.publish(Reporter.Event.SuiteStarted(suite.name, id)) *> suite.tests.nonEmptyTraverse(interpretTest(reporter).apply(_)).map(finish).flatTap { suiteResult => - //todo duplicated logic!!!! + // todo duplicated logic!!!! val isSuccessful = suiteResult .tests @@ -142,7 +142,7 @@ object Reporter { final case class SuiteHistory(cells: Chain[SuiteHistory.Cell]) { - //reference implementation, will be overridden for more performance (and possibly no fs2 dependency in eval) + // reference implementation, will be overridden for more performance (and possibly no fs2 dependency in eval) def stringify: String = { val failedSuites = cells.count(_.status === SuiteHistory.Status.Failed) diff --git a/core/src/main/scala/flawless/eval/stats.scala b/core/src/main/scala/flawless/eval/stats.scala index ba17fb3..f01e92d 100644 --- a/core/src/main/scala/flawless/eval/stats.scala +++ b/core/src/main/scala/flawless/eval/stats.scala @@ -32,7 +32,7 @@ object RunStats { ) } - //Getters/folds for suite/test/assertion results + // Getters/folds for suite/test/assertion results private object optics { private val suiteTests: Getter[Suite[Id], NonEmptyList[Test[Id]]] = diff --git a/examples/src/main/scala/flawless/examples/ExampleTests.scala b/examples/src/main/scala/flawless/examples/ExampleTests.scala index bb3348c..d2875bf 100644 --- a/examples/src/main/scala/flawless/examples/ExampleTests.scala +++ b/examples/src/main/scala/flawless/examples/ExampleTests.scala @@ -39,10 +39,10 @@ object ExampleTests extends IOApp with TestApp { Suite .resource[IO] { xa.map { transactor => - new DoobieQueryTests(transactor).runSuite.parCombineN(5) //5 suites per allocation + new DoobieQueryTests(transactor).runSuite.parCombineN(5) // 5 suites per allocation } } - .parCombineN(2) //2 allocations + .parCombineN(2) // 2 allocations } override def run(args: List[String]): IO[ExitCode] = diff --git a/tests/src/main/scala/flawlessly/GetStatsTest.scala b/tests/src/main/scala/flawlessly/GetStatsTest.scala index d520cd6..a59f5a1 100644 --- a/tests/src/main/scala/flawlessly/GetStatsTest.scala +++ b/tests/src/main/scala/flawlessly/GetStatsTest.scala @@ -62,5 +62,5 @@ object GetStatsTest extends SuiteClass[NoEffect] { ) } - //todo property based tests - the total amount of each stat should be the sum of failed+succeeded + // todo property based tests - the total amount of each stat should be the sum of failed+succeeded } diff --git a/tests/src/main/scala/flawlessly/InterpreterReportingTest.scala b/tests/src/main/scala/flawlessly/InterpreterReportingTest.scala index bce8c1a..bc9a885 100644 --- a/tests/src/main/scala/flawlessly/InterpreterReportingTest.scala +++ b/tests/src/main/scala/flawlessly/InterpreterReportingTest.scala @@ -32,10 +32,10 @@ object InterpreterReportingTest { SuiteFinished("suite 1", id, succeeded = true) ).map(LogEvent.Report(_)) - //todo: why are these instances not visible? + // todo: why are these instances not visible? def simpleResource(suite: Suite[WC]): Suite[WC] = Suite.resource(suite.pure[Resource[WC, *]])(wcMonadCancel) - //todo: these would be good property tests + // todo: these would be good property tests suite("InterpreterReportingTest") { tests( test("single suite") { diff --git a/tests/src/main/scala/flawlessly/MonadicTestSuite.scala b/tests/src/main/scala/flawlessly/MonadicTestSuite.scala index 17e83a0..f665fb2 100644 --- a/tests/src/main/scala/flawlessly/MonadicTestSuite.scala +++ b/tests/src/main/scala/flawlessly/MonadicTestSuite.scala @@ -21,7 +21,7 @@ object MonadicTestSuite { tests( test("monadic tests fail when no assertions are given") { - //todo: tests shouldn't return lists anymore... I know, free monoid :( + // todo: tests shouldn't return lists anymore... I know, free monoid :( val NonEmptyList(theTest, _) = testMonadic[F]("demo")(_ => Applicative[F].unit) ensure(theTest, failedDueToAssertions) diff --git a/tests/src/main/scala/flawlessly/TestReporter.scala b/tests/src/main/scala/flawlessly/TestReporter.scala index 2d243d2..239225e 100644 --- a/tests/src/main/scala/flawlessly/TestReporter.scala +++ b/tests/src/main/scala/flawlessly/TestReporter.scala @@ -35,7 +35,7 @@ final class TestReporter[F[_]: MonadCancelThrow] { type WC[A] = ReaderWriterStateT[F, Unit, Chain[LogEvent], Int, A] implicit val wcMonadCancel: MonadCancel[WC, Throwable] = MonadCancel.monadCancelForReaderWriterStateT - //The instance shall not be used for parallelism! It's pretty much just a marker + // The instance shall not be used for parallelism! It's pretty much just a marker implicit val wcParallel: Parallel[WC] = Parallel.identity val reporter: Reporter.Aux[WC, Int] = { @@ -65,7 +65,7 @@ final class TestReporter[F[_]: MonadCancelThrow] { def reported[G[_]: Foldable](expectedWritten: G[LogEvent]): PredicateT[F, Suite[WC]] = reportedWith[G](equalTo(expectedWritten.toList)) - //todo naming + // todo naming def reportedWith[G[_]: Foldable](writtenPredicate: Predicate[List[LogEvent]]): PredicateT[F, Suite[WC]] = select[Suite[WC]](interpreter.interpret(reporter)(_).written.runA((), 0).map(_.toList))( writtenPredicate.liftM[F]