From 37f4aa5de5e6f4fc387933cab6536eea9defc3c9 Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Mon, 1 Jul 2024 13:11:39 +0200 Subject: [PATCH] refactor(bazel): Simplify `expandRepositoryUrl()` a bit Signed-off-by: Frank Viernau --- plugins/package-managers/bazel/src/main/kotlin/Bazel.kt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt b/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt index c23f98e5e6b55..ef20644328108 100644 --- a/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt +++ b/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt @@ -196,13 +196,7 @@ class Bazel( ) } -private fun String.expandRepositoryUrl(): String = - if (startsWith("github:")) { - val path = substringAfter("github:") - "https://github.com/$path" - } else { - this - } +private fun String.expandRepositoryUrl(): String = withoutPrefix("github:")?.let { "https://github.com/$it" } ?: this private fun ModuleMetadata.toVcsInfo() = VcsInfo(