Repository: scala-steward-org/scala-steward (scala)

Issue:
URLs without scheme produce relative links
Homepages / SCM URLs in `pom.xml`s or `ivy.xml`s without a scheme produce broken relative links in PR bodies. One example is https://github.com/sangria-graphql-org/sangria-msgpack/pull/15. The [msgpack-core POM](https://repo1.maven.org/maven2/org/msgpack/msgpack-core/0.8.20/msgpack-core-0.8.20.pom) contains `github.com/msgpack/msgpack-java.git` as SCM URL which is then interpreted as relative link in the PR body pointing to `https://github.com/sangria-graphql-org/sangria-msgpack/pull/github.com/msgpack/msgpack-java.git` which of course does not exist. I think we should just reject URLs without a scheme in `CoursierAlg.getScmUrlOrHomePage`.

Pull request description:
fixes #1171

Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/coursier/CoursierAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/coursier/CoursierAlg.scala
index ad19aeefe6..18f58c7029 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/coursier/CoursierAlg.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/coursier/CoursierAlg.scala
@@ -107,6 +107,6 @@ object CoursierAlg {
   private def getScmUrlOrHomePage(info: Info): Option[Uri] =
     (info.scm.flatMap(_.url).toList :+ info.homePage)
       .filterNot(url => url.isEmpty || url.startsWith("git@"))
-      .flatMap(Uri.fromString(_).toList)
+      .flatMap(Uri.fromString(_).toList.filter(_.scheme.isDefined))
       .headOption
 }


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/coursier/CoursierAlgTest.scala b/modules/core/src/test/scala/org/scalasteward/core/coursier/CoursierAlgTest.scala
index 83d8528192..fcea16bafb 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/coursier/CoursierAlgTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/coursier/CoursierAlgTest.scala
@@ -34,6 +34,20 @@ class CoursierAlgTest extends AnyFunSuite with Matchers {
     result shouldBe Some(uri"https://github.com/playframework/play-ws")
   }
 
+  test("getArtifactUrl: URL without a scheme") {
+    val dep = Dependency(
+      GroupId("org.msgpack"),
+      ArtifactId("msgpack-core"),
+      "0.8.20"
+    )
+    val (state, result) = coursierAlg
+      .getArtifactUrl(dep)
+      .run(MockState.empty)
+      .unsafeRunSync()
+    state shouldBe MockState.empty
+    result shouldBe Some(uri"http://msgpack.org/")
+  }
+
   test("getArtifactUrl: sbt plugin on Maven Central") {
     val dep = Dependency(
       GroupId("org.xerial.sbt"),