Repository: scala-steward-org/scala-steward
Pull request #2881 (2023-01-04 14:07:36)

Rename `WorkspaceAlg#cleanWorkspace`
This renames `WorkspaceAlg#cleanWorkspace` to `cleanReposDir` since this is what this method actually does. The log message is also changed from "Clean workspace" to "Clean $reposDir". The former message is misleading since the workspace needs to be persisted between runs for certain features to work, but Scala Steward says on every run that it is cleaning this workspace.

codecov[bot]: # [Codecov](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2881?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org) Report
Base: **88.23**% // Head: **88.32**% // Increases project coverage by **`+0.08%`** :tada:
> Coverage data is based on head [(`d80cd24`)](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2881?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org) compared to base [(`2157fae`)](https://codecov.io/gh/scala-steward-org/scala-steward/commit/2157fae0deb9acba10526f8dfc898776db804f67?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org).
> Patch coverage: 33.33% of modified lines in pull request are covered.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main    #2881      +/-   ##
==========================================
+ Coverage   88.23%   88.32%   +0.08%     
==========================================
  Files         157      157              
  Lines        3018     3015       -3     
  Branches      203      197       -6     
==========================================
  Hits         2663     2663              
+ Misses        355      352       -3     
```


| [Impacted Files](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2881?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org) | Coverage Δ | |
|---|---|---|
| [.../scala/org/scalasteward/core/io/WorkspaceAlg.scala](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2881/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org#diff-bW9kdWxlcy9jb3JlL3NyYy9tYWluL3NjYWxhL29yZy9zY2FsYXN0ZXdhcmQvY29yZS9pby9Xb3Jrc3BhY2VBbGcuc2NhbGE=) | `42.85% <20.00%> (+12.85%)` | :arrow_up: |
| [...org/scalasteward/core/application/StewardAlg.scala](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2881/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org#diff-bW9kdWxlcy9jb3JlL3NyYy9tYWluL3NjYWxhL29yZy9zY2FsYXN0ZXdhcmQvY29yZS9hcHBsaWNhdGlvbi9TdGV3YXJkQWxnLnNjYWxh) | `42.42% <100.00%> (ø)` | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2881?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org).


Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/application/Context.scala b/modules/core/src/main/scala/org/scalasteward/core/application/Context.scala
index 7c52d0ac..5478d527 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/application/Context.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/application/Context.scala
@@ -110,7 +110,7 @@ object Context {
       logger0 <- Resource.eval(Slf4jLogger.fromName[F]("org.scalasteward.core"))
       _ <- Resource.eval(printBanner(logger0))
       _ <- Resource.eval(F.delay(System.setProperty("http.agent", userAgentString)))
-      userAgent <- Resource.eval(F.fromEither(`User-Agent`.parse(userAgentString)))
+      userAgent <- Resource.eval(F.fromEither(`User-Agent`.parse(1)(userAgentString)))
       middleware = ClientConfiguration
         .setUserAgent[F](userAgent)
         .andThen(ClientConfiguration.retryAfter[F](maxAttempts = 5))
diff --git a/modules/core/src/main/scala/org/scalasteward/core/application/StewardAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/application/StewardAlg.scala
index 2fc2e50e..43fa03e8 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/application/StewardAlg.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/application/StewardAlg.scala
@@ -92,7 +92,7 @@ final class StewardAlg[F[_]](config: Config)(implicit
     logger.infoTotalTime("run") {
       for {
         _ <- selfCheckAlg.checkAll
-        _ <- workspaceAlg.cleanWorkspace
+        _ <- workspaceAlg.cleanReposDir
         exitCode <-
           (config.githubApp.map(getGitHubAppRepos).getOrElse(Stream.empty) ++
             readRepos(config.reposFile))
diff --git a/modules/core/src/main/scala/org/scalasteward/core/io/WorkspaceAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/io/WorkspaceAlg.scala
index bca9111e..ea0fc130 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/io/WorkspaceAlg.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/io/WorkspaceAlg.scala
@@ -24,7 +24,7 @@ import org.scalasteward.core.vcs.data.{BuildRoot, Repo}
 import org.typelevel.log4cats.Logger
 
 trait WorkspaceAlg[F[_]] {
-  def cleanWorkspace: F[Unit]
+  def cleanReposDir: F[Unit]
 
   def rootDir: F[File]
 
@@ -40,24 +40,25 @@ object WorkspaceAlg {
       F: FlatMap[F]
   ): WorkspaceAlg[F] =
     new WorkspaceAlg[F] {
-      private[this] val reposDir = config.workspace / "repos"
+      private val reposDir: File =
+        config.workspace / "repos"
 
-      private[this] def repoDirUnsafe(repo: Repo) = reposDir / repo.owner / repo.repo
+      private def toFile(repo: Repo): File =
+        reposDir / repo.owner / repo.repo
 
-      override def cleanWorkspace: F[Unit] =
-        for {
-          _ <- logger.info(s"Clean workspace ${config.workspace}")
-          _ <- fileAlg.deleteForce(reposDir)
-          _ <- rootDir
-        } yield ()
+      private def toFile(buildRoot: BuildRoot): File =
+        toFile(buildRoot.repo) / buildRoot.relativePath
+
+      override def cleanReposDir: F[Unit] =
+        logger.info(s"Clean $reposDir") >> fileAlg.deleteForce(reposDir)
 
       override def rootDir: F[File] =
         fileAlg.ensureExists(config.workspace)
 
       override def repoDir(repo: Repo): F[File] =
-        fileAlg.ensureExists(repoDirUnsafe(repo))
+        fileAlg.ensureExists(toFile(repo))
 
       override def buildRootDir(buildRoot: BuildRoot): F[File] =
-        fileAlg.ensureExists(repoDirUnsafe(buildRoot.repo) / buildRoot.relativePath)
+        fileAlg.ensureExists(toFile(buildRoot))
     }
 }
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index 506f3b89..c6bcf15a 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -20,7 +20,7 @@ object Dependencies {
   val disciplineMunit = "org.typelevel" %% "discipline-munit" % "1.0.9"
   val fs2Core = "co.fs2" %% "fs2-core" % "3.4.0"
   val fs2Io = "co.fs2" %% "fs2-io" % fs2Core.revision
-  val http4sCore = "org.http4s" %% "http4s-core" % "1.0.0-M37"
+  val http4sCore = "org.http4s" %% "http4s-core" % "1.0.0-M38"
   val http4sCirce = "org.http4s" %% "http4s-circe" % http4sCore.revision
   val http4sClient = "org.http4s" %% "http4s-client" % http4sCore.revision
   val http4sDsl = "org.http4s" %% "http4s-dsl" % http4sCore.revision


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/client/ClientConfigurationTest.scala b/modules/core/src/test/scala/org/scalasteward/core/client/ClientConfigurationTest.scala
index dd47b48c..93183ff6 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/client/ClientConfigurationTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/client/ClientConfigurationTest.scala
@@ -15,7 +15,7 @@ class ClientConfigurationTest extends CatsEffectSuite {
 
   private val userAgentValue = "my-user-agent"
   private val dummyUserAgent =
-    `User-Agent`.parse(userAgentValue).getOrElse(fail("unable to create user agent"))
+    `User-Agent`.parse(1)(userAgentValue).getOrElse(fail("unable to create user agent"))
 
   private val routes: HttpRoutes[IO] = {
     import org.http4s.dsl.io._
diff --git a/modules/core/src/test/scala/org/scalasteward/core/io/MockWorkspaceAlg.scala b/modules/core/src/test/scala/org/scalasteward/core/io/MockWorkspaceAlg.scala
index 75a22901..0d476277 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/io/MockWorkspaceAlg.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/io/MockWorkspaceAlg.scala
@@ -6,7 +6,7 @@ import org.scalasteward.core.mock.{MockConfig, MockEff}
 import org.scalasteward.core.vcs.data.{BuildRoot, Repo}
 
 class MockWorkspaceAlg extends WorkspaceAlg[MockEff] {
-  override def cleanWorkspace: MockEff[Unit] =
+  override def cleanReposDir: MockEff[Unit] =
     Kleisli.pure(())
 
   override def rootDir: MockEff[File] =