Repository: scala-steward-org/scala-steward
Pull request #2441 (2021-12-30 12:23:28)

User supplied hooks should always be executed in a sandbox
Spotted by @fthomas:https://github.com/scala-steward-org/scala-steward/pull/2434#discussion_r776669075

codecov[bot]: # [Codecov](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org) Report
> Merging [#2441](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org) (5460217) into [master](https://codecov.io/gh/scala-steward-org/scala-steward/commit/9b1c09f5f987bb5fed4240c3187029c020caae24?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org) (9b1c09f) will **increase** coverage by `0.03%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441/graphs/tree.svg?width=650&height=150&src=pr&token=udzMsc1Dne&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org)](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org)

```diff
@@            Coverage Diff             @@
##           master    #2441      +/-   ##
==========================================
+ Coverage   81.04%   81.07%   +0.03%     
==========================================
  Files         142      141       -1     
  Lines        2458     2457       -1     
  Branches       41       41              
==========================================
  Hits         1992     1992              
+ Misses        466      465       -1     
```


| [Impacted Files](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org) | Coverage Δ | |
|---|---|---|
| [...steward/core/repoconfig/PostUpdateHookConfig.scala](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org#diff-bW9kdWxlcy9jb3JlL3NyYy9tYWluL3NjYWxhL29yZy9zY2FsYXN0ZXdhcmQvY29yZS9yZXBvY29uZmlnL1Bvc3RVcGRhdGVIb29rQ29uZmlnLnNjYWxh) | `91.66% <100.00%> (ø)` | |
| [...la-2.12/org/scalasteward/mill/plugin/package.scala](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org#diff-bW9kdWxlcy9taWxsLXBsdWdpbi9zcmMvbWFpbi9zY2FsYS0yLjEyL29yZy9zY2FsYXN0ZXdhcmQvbWlsbC9wbHVnaW4vcGFja2FnZS5zY2FsYQ==) | | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org). Last update [9b1c09f...5460217](https://codecov.io/gh/scala-steward-org/scala-steward/pull/2441?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scala-steward-org).


Patch:
diff --git a/docs/repo-specific-configuration.md b/docs/repo-specific-configuration.md
index b0e63995..7fcc645b 100644
--- a/docs/repo-specific-configuration.md
+++ b/docs/repo-specific-configuration.md
@@ -89,7 +89,6 @@ buildRoots = [ ".", "subfolder/projectA" ]
 # A groupId and/or artifactId can be defined to only execute after certain dependencies are updated. If neither is defined, the hook runs for every update.
 postUpdateHooks = [{
   command = "sbt protobufGenerate",
-  useSandbox = true,
   commitMessage = "Regenerated protobuf files",
   groupId = "com.github.sbt",
   artifiactId = "sbt-protobuf"
diff --git a/modules/core/src/main/scala/org/scalasteward/core/repoconfig/PostUpdateHookConfig.scala b/modules/core/src/main/scala/org/scalasteward/core/repoconfig/PostUpdateHookConfig.scala
index 2f200ae2..3d36aec2 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/repoconfig/PostUpdateHookConfig.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/repoconfig/PostUpdateHookConfig.scala
@@ -28,7 +28,6 @@ final case class PostUpdateHookConfig(
     groupId: Option[GroupId],
     artifactId: Option[String],
     command: String,
-    useSandbox: Boolean,
     commitMessage: String
 ) {
   def toHook: PostUpdateHook =
@@ -41,7 +40,7 @@ final case class PostUpdateHookConfig(
           groupId,
           artifactId.map(ArtifactId(_)),
           command = cmd,
-          useSandbox = useSandbox,
+          useSandbox = true,
           commitMessage = _ => CommitMsg(commitMessage),
           enabledByCache = _ => true,
           enabledByConfig = _ => true


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/edit/hooks/HookExecutorTest.scala b/modules/core/src/test/scala/org/scalasteward/core/edit/hooks/HookExecutorTest.scala
index e9811e8e..875c7238 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/edit/hooks/HookExecutorTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/edit/hooks/HookExecutorTest.scala
@@ -109,7 +109,6 @@ class HookExecutorTest extends CatsEffectSuite {
           groupId = None,
           artifactId = None,
           command = "sbt mySbtCommand",
-          useSandbox = true,
           commitMessage = "Updated with a hook!"
         )
       )
diff --git a/modules/core/src/test/scala/org/scalasteward/core/repoconfig/RepoConfigAlgTest.scala b/modules/core/src/test/scala/org/scalasteward/core/repoconfig/RepoConfigAlgTest.scala
index eda61673..4e398622 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/repoconfig/RepoConfigAlgTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/repoconfig/RepoConfigAlgTest.scala
@@ -196,7 +196,6 @@ class RepoConfigAlgTest extends FunSuite {
     val content =
       """|postUpdateHooks = [{
          |  command = "sbt mySbtCommand"
-         |  useSandbox = false,
          |  commitMessage = "Updated with a hook!"
          |  }]
          |""".stripMargin
@@ -207,7 +206,6 @@ class RepoConfigAlgTest extends FunSuite {
           groupId = None,
           artifactId = None,
           command = "sbt mySbtCommand",
-          useSandbox = false,
           commitMessage = "Updated with a hook!"
         )
       )
@@ -222,7 +220,6 @@ class RepoConfigAlgTest extends FunSuite {
          |  groupId = "eu.timepit"
          |  artifactId = "refined.1"
          |  command = "sbt mySbtCommand"
-         |  useSandbox = false,
          |  commitMessage = "Updated with a hook!"
          |  }]
          |""".stripMargin
@@ -233,7 +230,6 @@ class RepoConfigAlgTest extends FunSuite {
           groupId = Some("eu.timepit".g),
           artifactId = Some("refined.1"),
           command = "sbt mySbtCommand",
-          useSandbox = false,
           commitMessage = "Updated with a hook!"
         )
       )