Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalafmt 3.8.6 #2183

Merged
merged 2 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
8c04f656ec5e21d6142ebde4539a00003b27a499
f6e03013f4c4a29074f528ac468129bdd2df63d3
13d6c997bb231bbae2bb1a9427d0fc4eb226e853

# Upgrade to scalafmt 3.8.6
1c373a90e8fd788b666b037150e8912427708726
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.8.2
version=3.8.6
maxColumn = 120
assumeStandardLibraryStripMargin = true

Expand Down
13 changes: 11 additions & 2 deletions modules/bench/src/main/scala/doobie/bench/large.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class LargeRow {
col8 VARCHAR(50)
);""".update.run
_ <- sql"select setseed(0.5)".query[Unit].unique // deterministic seed
_ <- sql"""INSERT INTO data (col1, col2, col3, col4, col5, col6, col7, col8)
_ <-
sql"""INSERT INTO data (col1, col2, col3, col4, col5, col6, col7, col8)
SELECT random(), random() :: text, (random() * 1000) :: int, random() :: text, random(), random(), random() :: text, random() :: text
FROM generate_series(1, 10000)
""".update.run
Expand All @@ -74,7 +75,15 @@ class LargeRow {
@Benchmark
def tupleOpt(bh: Blackhole): Unit = {
bh.consume(sql"""SELECT col1, col2, col3, col4, col5, col6, col7, col8 FROM data"""
.query[Option[(Double, String, Int, String, Double, Double, String, String)]].to[List].transact(xa).unsafeRunSync())
.query[Option[(
Double,
String,
Int,
String,
Double,
Double,
String,
String)]].to[List].transact(xa).unsafeRunSync())
}

@Benchmark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ trait MkWritePlatform:
new Derived(
new MkWrite(Write.Composite(
List(headInstance),
{ case h *: EmptyTuple => List(h) }
{ case h *: EmptyTuple =>
List(h)
}
))
)
}
Expand All @@ -49,7 +51,9 @@ trait MkWritePlatform:
new Derived(
new MkWrite(Write.Composite(
List(headWrite, tailWrite),
{ case h *: t => List(h, t) }
{ case h *: t =>
List(h, t)
}
))
)
}
4 changes: 3 additions & 1 deletion modules/core/src/main/scala/doobie/util/analysis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ object analysis {
override def msg = this match {
case ColumnMisalignment(_, Left((get, n))) =>
s"""|Too few columns are selected, which will result in a runtime failure. Add a column or
|remove mapped ${typeName(get.typeStack.last, n)} from the result type.""".stripMargin.linesIterator.mkString(
|remove mapped ${typeName(
get.typeStack.last,
n)} from the result type.""".stripMargin.linesIterator.mkString(
" ")
case ColumnMisalignment(_, Right(_)) =>
s"""Column is unused. Remove it from the SELECT statement."""
Expand Down
6 changes: 4 additions & 2 deletions modules/core/src/main/scala/doobie/util/invariant.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ object invariant {
final case class NonNullableColumnUpdate(index: Int, jdbcType: JdbcType)
extends MappingViolation(
show"Scala `null` value passed as update to column $index (JDBC type $jdbcType); use an Option type here. $oneBasedDisclaimer")
final case class NonNullableColumnRead(index: Int, jdbcType: JdbcType)
extends MappingViolation(show"SQL `NULL` read at column $index (JDBC type $jdbcType) but mapping is to a non-Option type; use Option here. $oneBasedDisclaimer")
final case class NonNullableColumnRead(
index: Int,
jdbcType: JdbcType
) extends MappingViolation(show"SQL `NULL` read at column $index (JDBC type $jdbcType) but mapping is to a non-Option type; use Option here. $oneBasedDisclaimer")

/** Array violations. Not terribly illuminating at this point. */
sealed abstract class ArrayStructureViolation(msg: String) extends InvariantViolation(msg)
Expand Down
6 changes: 4 additions & 2 deletions modules/core/src/main/scala/doobie/util/meta/meta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ trait MetaInstances {
List(TinyInt, Integer, BigInt, Real, Float, Double, Decimal, Numeric, Bit, Char, VarChar, LongVarChar),
_.getShort(_),
_.setShort(_, _),
_.updateShort(_, _))
_.updateShort(_, _)
)

/** @group Instances */
implicit val IntMeta: Meta[Int] =
Expand All @@ -208,7 +209,8 @@ trait MetaInstances {
List(TinyInt, Integer, SmallInt, BigInt, Float, Double, Decimal, Numeric, Bit, Char, VarChar, LongVarChar),
_.getFloat(_),
_.setFloat(_, _),
_.updateFloat(_, _))
_.updateFloat(_, _)
)

/** @group Instances */
implicit val DoubleMeta: Meta[Double] =
Expand Down
3 changes: 2 additions & 1 deletion modules/example/src/main/scala/example/StreamingCopy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ object StreamingCopy extends IOApp.Simple {
url = "jdbc:postgresql:world",
user = "postgres",
password = "password",
logHandler = None
logHandler =
None
))

// An h2 transactor for our sink.
Expand Down
2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/blob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,6 @@ object blob { module =>
implicit def SemigroupBlobIO[A : Semigroup]: Semigroup[BlobIO[A]] = new Semigroup[BlobIO[A]] {
override def combine(x: BlobIO[A], y: BlobIO[A]): BlobIO[A] =
Applicative[BlobIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,6 @@ object callablestatement { module =>
implicit def SemigroupCallableStatementIO[A : Semigroup]: Semigroup[CallableStatementIO[A]] = new Semigroup[CallableStatementIO[A]] {
override def combine(x: CallableStatementIO[A], y: CallableStatementIO[A]): CallableStatementIO[A] =
Applicative[CallableStatementIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/clob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,6 @@ object clob { module =>
implicit def SemigroupClobIO[A : Semigroup]: Semigroup[ClobIO[A]] = new Semigroup[ClobIO[A]] {
override def combine(x: ClobIO[A], y: ClobIO[A]): ClobIO[A] =
Applicative[ClobIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/connection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,6 @@ object connection { module =>
implicit def SemigroupConnectionIO[A : Semigroup]: Semigroup[ConnectionIO[A]] = new Semigroup[ConnectionIO[A]] {
override def combine(x: ConnectionIO[A], y: ConnectionIO[A]): ConnectionIO[A] =
Applicative[ConnectionIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,6 @@ object databasemetadata { module =>
implicit def SemigroupDatabaseMetaDataIO[A : Semigroup]: Semigroup[DatabaseMetaDataIO[A]] = new Semigroup[DatabaseMetaDataIO[A]] {
override def combine(x: DatabaseMetaDataIO[A], y: DatabaseMetaDataIO[A]): DatabaseMetaDataIO[A] =
Applicative[DatabaseMetaDataIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/driver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,6 @@ object driver { module =>
implicit def SemigroupDriverIO[A : Semigroup]: Semigroup[DriverIO[A]] = new Semigroup[DriverIO[A]] {
override def combine(x: DriverIO[A], y: DriverIO[A]): DriverIO[A] =
Applicative[DriverIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ class KleisliInterpreter[M[_]](logHandler: LogHandler[M])(implicit val asyncM: W
def forceR[G[_], J, A, B](interpreter: G ~> Kleisli[M, J, *])(fa: Free[G, A])(fb: Free[G, B]): Kleisli[M, J, B] = Kleisli (j =>
asyncM.forceR(fa.foldMap(interpreter).run(j))(fb.foldMap(interpreter).run(j))
)
def uncancelable[G[_], J, A](interpreter: G ~> Kleisli[M, J, *], capture: Poll[M] => Poll[Free[G, *]])(body: Poll[Free[G, *]] => Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
def uncancelable[G[_], J, A](interpreter: G ~> Kleisli[M, J, *], capture: Poll[M] => Poll[Free[G, *]])(body: Poll[Free[G, *]] => Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
asyncM.uncancelable(body.compose(capture).andThen(_.foldMap(interpreter).run(j)))
)
def poll[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(mpoll: Any, fa: Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
def poll[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(mpoll: Any, fa: Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
mpoll.asInstanceOf[Poll[M]].apply(fa.foldMap(interpreter).run(j))
)
def onCancel[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(fa: Free[G, A], fin: Free[G, Unit]): Kleisli[M, J, A] = Kleisli (j =>
Expand Down
2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/nclob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,6 @@ object nclob { module =>
implicit def SemigroupNClobIO[A : Semigroup]: Semigroup[NClobIO[A]] = new Semigroup[NClobIO[A]] {
override def combine(x: NClobIO[A], y: NClobIO[A]): NClobIO[A] =
Applicative[NClobIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,6 @@ object preparedstatement { module =>
implicit def SemigroupPreparedStatementIO[A : Semigroup]: Semigroup[PreparedStatementIO[A]] = new Semigroup[PreparedStatementIO[A]] {
override def combine(x: PreparedStatementIO[A], y: PreparedStatementIO[A]): PreparedStatementIO[A] =
Applicative[PreparedStatementIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/ref.scala
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,6 @@ object ref { module =>
implicit def SemigroupRefIO[A : Semigroup]: Semigroup[RefIO[A]] = new Semigroup[RefIO[A]] {
override def combine(x: RefIO[A], y: RefIO[A]): RefIO[A] =
Applicative[RefIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/resultset.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,6 @@ object resultset { module =>
implicit def SemigroupResultSetIO[A : Semigroup]: Semigroup[ResultSetIO[A]] = new Semigroup[ResultSetIO[A]] {
override def combine(x: ResultSetIO[A], y: ResultSetIO[A]): ResultSetIO[A] =
Applicative[ResultSetIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/sqldata.scala
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,6 @@ object sqldata { module =>
implicit def SemigroupSQLDataIO[A : Semigroup]: Semigroup[SQLDataIO[A]] = new Semigroup[SQLDataIO[A]] {
override def combine(x: SQLDataIO[A], y: SQLDataIO[A]): SQLDataIO[A] =
Applicative[SQLDataIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/sqlinput.scala
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,6 @@ object sqlinput { module =>
implicit def SemigroupSQLInputIO[A : Semigroup]: Semigroup[SQLInputIO[A]] = new Semigroup[SQLInputIO[A]] {
override def combine(x: SQLInputIO[A], y: SQLInputIO[A]): SQLInputIO[A] =
Applicative[SQLInputIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/sqloutput.scala
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,6 @@ object sqloutput { module =>
implicit def SemigroupSQLOutputIO[A : Semigroup]: Semigroup[SQLOutputIO[A]] = new Semigroup[SQLOutputIO[A]] {
override def combine(x: SQLOutputIO[A], y: SQLOutputIO[A]): SQLOutputIO[A] =
Applicative[SQLOutputIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

2 changes: 1 addition & 1 deletion modules/free/src/main/scala/doobie/free/statement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,6 @@ object statement { module =>
implicit def SemigroupStatementIO[A : Semigroup]: Semigroup[StatementIO[A]] = new Semigroup[StatementIO[A]] {
override def combine(x: StatementIO[A], y: StatementIO[A]): StatementIO[A] =
Applicative[StatementIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,6 @@ object copyin { module =>
implicit def SemigroupCopyInIO[A : Semigroup]: Semigroup[CopyInIO[A]] = new Semigroup[CopyInIO[A]] {
override def combine(x: CopyInIO[A], y: CopyInIO[A]): CopyInIO[A] =
Applicative[CopyInIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,6 @@ object copymanager { module =>
implicit def SemigroupCopyManagerIO[A : Semigroup]: Semigroup[CopyManagerIO[A]] = new Semigroup[CopyManagerIO[A]] {
override def combine(x: CopyManagerIO[A], y: CopyManagerIO[A]): CopyManagerIO[A] =
Applicative[CopyManagerIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,6 @@ object copyout { module =>
implicit def SemigroupCopyOutIO[A : Semigroup]: Semigroup[CopyOutIO[A]] = new Semigroup[CopyOutIO[A]] {
override def combine(x: CopyOutIO[A], y: CopyOutIO[A]): CopyOutIO[A] =
Applicative[CopyOutIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ class KleisliInterpreter[M[_]](logHandler: LogHandler[M])(implicit val asyncM: W
def forceR[G[_], J, A, B](interpreter: G ~> Kleisli[M, J, *])(fa: Free[G, A])(fb: Free[G, B]): Kleisli[M, J, B] = Kleisli (j =>
asyncM.forceR(fa.foldMap(interpreter).run(j))(fb.foldMap(interpreter).run(j))
)
def uncancelable[G[_], J, A](interpreter: G ~> Kleisli[M, J, *], capture: Poll[M] => Poll[Free[G, *]])(body: Poll[Free[G, *]] => Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
def uncancelable[G[_], J, A](interpreter: G ~> Kleisli[M, J, *], capture: Poll[M] => Poll[Free[G, *]])(body: Poll[Free[G, *]] => Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
asyncM.uncancelable(body.compose(capture).andThen(_.foldMap(interpreter).run(j)))
)
def poll[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(mpoll: Any, fa: Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
def poll[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(mpoll: Any, fa: Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
mpoll.asInstanceOf[Poll[M]].apply(fa.foldMap(interpreter).run(j))
)
def onCancel[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(fa: Free[G, A], fin: Free[G, Unit]): Kleisli[M, J, A] = Kleisli (j =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,6 @@ object largeobject { module =>
implicit def SemigroupLargeObjectIO[A : Semigroup]: Semigroup[LargeObjectIO[A]] = new Semigroup[LargeObjectIO[A]] {
override def combine(x: LargeObjectIO[A], y: LargeObjectIO[A]): LargeObjectIO[A] =
Applicative[LargeObjectIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,6 @@ object largeobjectmanager { module =>
implicit def SemigroupLargeObjectManagerIO[A : Semigroup]: Semigroup[LargeObjectManagerIO[A]] = new Semigroup[LargeObjectManagerIO[A]] {
override def combine(x: LargeObjectManagerIO[A], y: LargeObjectManagerIO[A]): LargeObjectManagerIO[A] =
Applicative[LargeObjectManagerIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,6 @@ object pgconnection { module =>
implicit def SemigroupPGConnectionIO[A : Semigroup]: Semigroup[PGConnectionIO[A]] = new Semigroup[PGConnectionIO[A]] {
override def combine(x: PGConnectionIO[A], y: PGConnectionIO[A]): PGConnectionIO[A] =
Applicative[PGConnectionIO].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ object CheckerTests extends IOSuite with IOChecker {
url = "jdbc:h2:mem:queryspec;DB_CLOSE_DELAY=-1",
user = "sa",
password = "",
logHandler = None
logHandler =
None
))

test("trivial") { implicit transactor =>
Expand Down
6 changes: 3 additions & 3 deletions project/FreeGen2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class FreeGen2(
| implicit def Semigroup$ioname[A : Semigroup]: Semigroup[$ioname[A]] = new Semigroup[$ioname[A]] {
| override def combine(x: $ioname[A], y: $ioname[A]): $ioname[A] =
| Applicative[$ioname].product(x, y).map { case (x, y) => Semigroup[A].combine(x, y) }
| }
| }
|}
|""".trim.stripMargin
}
Expand Down Expand Up @@ -587,10 +587,10 @@ class FreeGen2(
| def forceR[G[_], J, A, B](interpreter: G ~> Kleisli[M, J, *])(fa: Free[G, A])(fb: Free[G, B]): Kleisli[M, J, B] = Kleisli (j =>
| asyncM.forceR(fa.foldMap(interpreter).run(j))(fb.foldMap(interpreter).run(j))
| )
| def uncancelable[G[_], J, A](interpreter: G ~> Kleisli[M, J, *], capture: Poll[M] => Poll[Free[G, *]])(body: Poll[Free[G, *]] => Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
| def uncancelable[G[_], J, A](interpreter: G ~> Kleisli[M, J, *], capture: Poll[M] => Poll[Free[G, *]])(body: Poll[Free[G, *]] => Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
| asyncM.uncancelable(body.compose(capture).andThen(_.foldMap(interpreter).run(j)))
| )
| def poll[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(mpoll: Any, fa: Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
| def poll[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(mpoll: Any, fa: Free[G, A]): Kleisli[M, J, A] = Kleisli(j =>
| mpoll.asInstanceOf[Poll[M]].apply(fa.foldMap(interpreter).run(j))
| )
| def onCancel[G[_], J, A](interpreter: G ~> Kleisli[M, J, *])(fa: Free[G, A], fin: Free[G, Unit]): Kleisli[M, J, A] = Kleisli (j =>
Expand Down