Skip to content

Commit

Permalink
Revert "Reformat with scalafmt 3.1.1"
Browse files Browse the repository at this point in the history
This reverts commit 165231e.
  • Loading branch information
fthomas committed Nov 16, 2021
1 parent 165231e commit 0d3ef3b
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 257 deletions.
2 changes: 1 addition & 1 deletion scalafix/input/src/main/scala/fix/AkkaSink.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
rule = v1
*/
*/
package fix

import akka.stream.scaladsl.Sink
Expand Down
26 changes: 6 additions & 20 deletions scalafix/input/src/main/scala/fix/Bracket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import fs2._

object Bracket {
val myResource = Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit)
val myComplexResource = Stream.bracket(IO.pure("resource"))(
r => Stream.bracket(IO.pure(r + "2"))(r2 => Stream.emit(r2), _ => IO.unit),
_ => IO.unit
)
val myComplexResource = Stream.bracket(IO.pure("resource"))(r => Stream.bracket(IO.pure(r+"2"))(r2 => Stream.emit(r2), _ => IO.unit), _ => IO.unit)
val bracketFor = for {
r1 <- Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit)
r2 <- Stream.bracket(IO.pure("resource2"))(r => Stream.emit(r), _ => IO.unit)
Expand All @@ -23,30 +20,19 @@ object Bracket {

println(Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit))

(
Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit),
Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit)
)
(Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit), Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit))

def somewhereABracket: Stream[IO, String] = {
println("irrelevant")
val internal = Stream.bracket(IO.pure("internal"))(r => Stream.emit(r), _ => IO.unit)
for {
r <- Stream.bracket(IO.pure("resource"))(
r => Stream.bracket(IO.pure(r + "2"))(r2 => Stream.emit(r2), _ => IO.unit),
_ => IO.unit
)
r <- Stream.bracket(IO.pure("resource"))(r => Stream.bracket(IO.pure(r+"2"))(r2 => Stream.emit(r2), _ => IO.unit), _ => IO.unit)
} yield r
Stream.bracket(IO.pure("resource"))(
r => Stream.bracket(IO.pure(r + "2"))(r2 => Stream.emit(r2), _ => IO.unit),
_ => IO.unit
)
Stream.bracket(IO.pure("resource"))(r => Stream.bracket(IO.pure(r+"2"))(r2 => Stream.emit(r2), _ => IO.unit), _ => IO.unit)
}

def bracketDef: Stream[IO, String] =
Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit)
var bracketVar: Stream[IO, String] =
Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit)
def bracketDef: Stream[IO, String] = Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit)
var bracketVar: Stream[IO, String] = Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit)

def bracketDefFor: Stream[IO, String] = for {
r <- Stream.bracket(IO.pure("resource"))(r => Stream.emit(r), _ => IO.unit)
Expand Down
2 changes: 1 addition & 1 deletion scalafix/input/src/main/scala/fix/Chunk.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trait ChunkRules {

val segments = s.segments
val mapSegments = s.mapSegments(s => s)
val scanSegments = s.scanSegments(0) { case (s, seg) => seg.mapResult(_ => s) }
val scanSegments = s.scanSegments(0){case (s, seg) => seg.mapResult(_ => s)}
val scanSegmentsOpt = s.scanSegmentsOpt(0)(_ => None)
val unconsChunk = s.pull.unconsChunk
val pullOutput = Pull.outputChunk(Chunk(1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class ConcurrentDataTypes[F[_]: ConcurrentEffect: Timer] {
refOf[F, Int](1)
refOf(1)
ref.map(_.setSync(1))
ref.map(_.setAsync(1)) /* assert: v1.Removed
ref.map(_.setAsync(1))/* assert: v1.Removed
^^^^^^^^
This got removed. Consider revisiting the implementation */
val a = ref.flatMap(_.modify(_ + 1))
Expand Down
2 changes: 1 addition & 1 deletion scalafix/input/src/main/scala/fix/Fs2sinkremoval.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
rule = v1
*/
*/
package fix

import fs2._
Expand Down
8 changes: 3 additions & 5 deletions scalafix/input/src/main/scala/fix/MyAppClass.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ import cats.effect.{Effect, IO}
import fs2.{Stream, StreamApp}

class MyStreamApp[F[_]: Effect] extends StreamApp[F] {
override def stream(
args: List[String],
requestShutdown: F[Unit]
): fs2.Stream[F, StreamApp.ExitCode] =
override def stream(args: List[String],
requestShutdown: F[Unit]): fs2.Stream[F, StreamApp.ExitCode] =
Stream
.eval(Applicative[F].pure("hello"))
.flatMap(_ => Stream.eval(Applicative[F].pure(StreamApp.ExitCode.Success))) /* assert: v1.StreamAppExitCode
^^^^^^^
You can remove this
*/
*/
}

object MyApp extends MyStreamApp[IO]
8 changes: 3 additions & 5 deletions scalafix/input/src/main/scala/fix/MyAppObject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ import cats.effect.IO
import fs2.{Stream, StreamApp}

object MyAppObject extends StreamApp[IO] {
override def stream(
args: List[String],
requestShutdown: IO[Unit]
): fs2.Stream[IO, StreamApp.ExitCode] =
override def stream(args: List[String],
requestShutdown: IO[Unit]): fs2.Stream[IO, StreamApp.ExitCode] =
Stream
.eval(Applicative[IO].pure("hello"))
.flatMap(_ => Stream.eval(Applicative[IO].pure(StreamApp.ExitCode.Success))) /* assert: v1.StreamAppExitCode
^^^^^^^
You can remove this
*/
*/
}
23 changes: 6 additions & 17 deletions scalafix/output/src/main/scala/fix/Bracket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import fs2._

object Bracket {
val myResource = Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r))
val myComplexResource = Stream
.bracket(IO.pure("resource"))(_ => IO.unit)
.flatMap(r => Stream.bracket(IO.pure(r + "2"))(_ => IO.unit).flatMap(r2 => Stream.emit(r2)))
val myComplexResource = Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.bracket(IO.pure(r + "2"))(_ => IO.unit).flatMap(r2 => Stream.emit(r2)))
val bracketFor = for {
r1 <- Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r))
r2 <- Stream.bracket(IO.pure("resource2"))(_ => IO.unit).flatMap(r => Stream.emit(r))
Expand All @@ -19,28 +17,19 @@ object Bracket {

println(Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r)))

(
Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r)),
Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r))
)
(Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r)), Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r)))

def somewhereABracket: Stream[IO, String] = {
println("irrelevant")
val internal = Stream.bracket(IO.pure("internal"))(_ => IO.unit).flatMap(r => Stream.emit(r))
for {
r <- Stream
.bracket(IO.pure("resource"))(_ => IO.unit)
.flatMap(r => Stream.bracket(IO.pure(r + "2"))(_ => IO.unit).flatMap(r2 => Stream.emit(r2)))
r <- Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.bracket(IO.pure(r + "2"))(_ => IO.unit).flatMap(r2 => Stream.emit(r2)))
} yield r
Stream
.bracket(IO.pure("resource"))(_ => IO.unit)
.flatMap(r => Stream.bracket(IO.pure(r + "2"))(_ => IO.unit).flatMap(r2 => Stream.emit(r2)))
Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.bracket(IO.pure(r + "2"))(_ => IO.unit).flatMap(r2 => Stream.emit(r2)))
}

def bracketDef: Stream[IO, String] =
Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r))
var bracketVar: Stream[IO, String] =
Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r))
def bracketDef: Stream[IO, String] = Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r))
var bracketVar: Stream[IO, String] = Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r))

def bracketDefFor: Stream[IO, String] = for {
r <- Stream.bracket(IO.pure("resource"))(_ => IO.unit).flatMap(r => Stream.emit(r))
Expand Down
2 changes: 1 addition & 1 deletion scalafix/output/src/main/scala/fix/Chunk.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait ChunkRules {

val segments = s.chunks
val mapSegments = s.mapChunks(s => s)
val scanSegments = s.scanChunks(0) { case (s, seg) => seg.mapResult(_ => s) }
val scanSegments = s.scanChunks(0){case (s, seg) => seg.mapResult(_ => s)}
val scanSegmentsOpt = s.scanChunksOpt(0)(_ => None)
val unconsChunk = s.pull.uncons
val pullOutput = Pull.output(Chunk(1))
Expand Down
8 changes: 5 additions & 3 deletions scalafix/output/src/main/scala/fix/ConcurrentDataTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import cats.effect._
import cats.syntax.all._
import fs2._



import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import cats.effect.concurrent
import cats.effect.concurrent.{Deferred, Ref, Semaphore}
import cats.effect.concurrent.{ Deferred, Ref, Semaphore }
import cats.effect.syntax.concurrent._
import fs2.concurrent.{Signal, SignallingRef}
import fs2.concurrent.{ Signal, SignallingRef }

abstract class ConcurrentDataTypes[F[_]: ConcurrentEffect: Timer] {
// Ref
Expand Down Expand Up @@ -45,4 +47,4 @@ abstract class ConcurrentDataTypes[F[_]: ConcurrentEffect: Timer] {

// Topic
val t: F[fs2.concurrent.Topic[F, Int]] = fs2.concurrent.Topic(1)
}
}
16 changes: 6 additions & 10 deletions scalafix/output/src/main/scala/fix/MyAppClass.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@ package fix
import cats.Applicative
import cats.effect.{Effect, IO}
import fs2.Stream
import cats.effect.{ExitCode, IOApp}
import cats.effect.{ ExitCode, IOApp }
import cats.syntax.functor._

class MyStreamApp[F[_]: Effect] {
override def program(args: List[String]): F[ExitCode] =
class MyStreamApp[F[_]: Effect] {
override def program(args: List[String]
): F[ExitCode] =
Stream
.eval(Applicative[F].pure("hello"))
.flatMap(_ => Stream.eval(Applicative[F].pure(StreamApp.ExitCode.Success)))
.compile
.drain
.as(ExitCode.Success)
.flatMap(_ => Stream.eval(Applicative[F].pure(StreamApp.ExitCode.Success))).compile.drain.as(ExitCode.Success)
}

object MyApp extends MyStreamApp[IO] with IOApp {
def run(args: List[String]): IO[ExitCode] = program(args)
}
object MyApp extends MyStreamApp[IO] with IOApp { def run(args: List[String]): IO[ExitCode] = program(args) }
12 changes: 5 additions & 7 deletions scalafix/output/src/main/scala/fix/MyAppObject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ package fix
import cats.Applicative
import cats.effect.IO
import fs2.Stream
import cats.effect.{ExitCode, IOApp}
import cats.effect.{ ExitCode, IOApp }
import cats.syntax.functor._

object MyAppObject extends IOApp {
override def run(args: List[String]): IO[ExitCode] =
override def run(args: List[String]
): IO[ExitCode] =
Stream
.eval(Applicative[IO].pure("hello"))
.flatMap(_ => Stream.eval(Applicative[IO].pure(StreamApp.ExitCode.Success)))
.compile
.drain
.as(ExitCode.Success)
}
.flatMap(_ => Stream.eval(Applicative[IO].pure(StreamApp.ExitCode.Success))).compile.drain.as(ExitCode.Success)
}
2 changes: 1 addition & 1 deletion scalafix/output/src/main/scala/fix/Scheduler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ abstract class SchedulerTimer[F[_]: ConcurrentEffect: Timer] {
Stream.eval(Effect[F].unit).debounce(duration)
Concurrent[F].race(Effect[F].unit, scheduler.sleep(duration))
Stream.eval(Effect[F].unit).delayBy(duration)
}
}
1 change: 1 addition & 0 deletions scalafix/output/src/main/scala/fix/Usability.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ trait Usability {
val join = Stream.emit(s).parJoin(1)
val joinUnbounded = Stream.emit(s).parJoinUnbounded
}

Loading

0 comments on commit 0d3ef3b

Please sign in to comment.