Skip to content

Commit

Permalink
Merge pull request #3532 from xuwei-k/new-syntax
Browse files Browse the repository at this point in the history
update scalafmt and scalacOptions setting. use new syntax
  • Loading branch information
exoego authored Jan 10, 2025
2 parents cae6c58 + 38e377f commit c75d82f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = 3.8.3
runner.dialect = scala213
runner.dialect = scala213source3
assumeStandardLibraryStripMargin = true
align.openParenCallSite = false
align.openParenDefnSite = false
Expand Down
8 changes: 8 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,14 @@ lazy val commonSettings = Def.settings(

lazy val compileSettings = Def.settings(
scalaVersion := Scala213,
scalacOptions ++= {
scalaBinaryVersion.value match {
case "2.13" =>
Seq("-Xsource:3-cross")
case _ =>
Nil
}
},
doctestTestFramework := DoctestTestFramework.Munit
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object parser {
val chunks = fs2.Stream.emits(lines).map(removeSbtNoise).split(_ === "--- snip ---")
val decoder = Decoder[Dependency].either(Decoder[Resolver])
chunks.mapFilter { chunk =>
val (dependencies, resolvers) = chunk.toList.flatMap(decode(_)(decoder).toList).separate
val (dependencies, resolvers) = chunk.toList.flatMap(decode(_)(using decoder).toList).separate
Option.when(dependencies.nonEmpty && resolvers.nonEmpty)(
Scope(dependencies, resolvers.sorted)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ final case class Version(value: String) {
case _ => false
} || Rfc5234.hexdig.rep(8).string.filterNot(startsWithDate).parse(value).isRight

private[this] def alnumComponentsWithoutPreRelease: List[Version.Component] =
private def alnumComponentsWithoutPreRelease: List[Version.Component] =
alnumComponents.takeWhile {
case a: Version.Component.Alpha => !a.isPreReleaseIdent
case _ => true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class GitHubAppApiAlg[F[_]](
F: Concurrent[F]
) {

private[this] val acceptHeader =
private val acceptHeader =
Header.Raw(ci"Accept", "application/vnd.github.v3+json")

private[this] def addHeaders(jwt: String): client.ModReq =
private def addHeaders(jwt: String): client.ModReq =
req =>
F.point(
req.putHeaders(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ final class FileGitAlg[F[_]](config: Config)(implicit
): F[Commit] = {
val messages = message.paragraphs.foldMap(m => List("-m", m))
val trailers = message.trailers.foldMap { case (k, v) => List("--trailer", s"$k=$v") }
git_("commit" :: "--all" :: sign :: signoff(signoffCommits) :: messages ++ trailers: _*)(
git_(("commit" :: "--all" :: sign :: signoff(signoffCommits) :: messages ++ trailers)*)(
repo
) >>
latestSha1(repo, Branch.head).map(Commit.apply)
Expand Down Expand Up @@ -181,7 +181,7 @@ final class FileGitAlg[F[_]](config: Config)(implicit
}

private def git_(args: String*)(repo: File): F[List[String]] =
git(args: _*)(repo, SlurpOptions.ignoreBufferOverflow)
git(args*)(repo, SlurpOptions.ignoreBufferOverflow)

private val sign: String =
if (config.gitCfg.signCommits) "--gpg-sign" else "--no-gpg-sign"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ object process {
)(implicit F: Async[F]): F[List[String]] =
createProcess(args).flatMap { process =>
F.delay(new ListBuffer[String]).flatMap { buffer =>
val raiseError = F.raiseError[List[String]] _
val raiseError = F.raiseError[List[String]]

val result =
readLinesIntoBuffer(process.getInputStream, buffer, maxBufferSize, log)
Expand Down Expand Up @@ -91,7 +91,7 @@ object process {

private def createProcessBuilder[F[_]](args: Args)(implicit F: Sync[F]): F[ProcessBuilder] =
F.blocking {
val pb = new ProcessBuilder(args.command.toList: _*)
val pb = new ProcessBuilder(args.command.toList*)
args.workingDirectory.foreach(file => pb.directory(file.toJava))
val env = pb.environment()
if (args.slurpOptions(SlurpOption.ClearEnvironment)) env.clear()
Expand Down

0 comments on commit c75d82f

Please sign in to comment.