Skip to content

Commit

Permalink
refactor(bazel)!: Simplify code with an url not being nullable
Browse files Browse the repository at this point in the history
The only place where the function is called with theoretically
nullable arguments is from within a mock in a test, but the compiler
seems to accept this.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Aug 15, 2024
1 parent 6160df2 commit 37ea3e6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class LocalBazelModuleRegistryService(directory: File) : BazelModuleRegistryServ
* Create a [LocalBazelModuleRegistryService] if the given [url] points to a local file. In this case,
* also replace the placeholder for the workspace by the given [projectDir]. Return *null* for all other URLs.
*/
fun createForLocalUrl(url: String?, projectDir: File): LocalBazelModuleRegistryService? =
url.takeIf { it?.startsWith(FILE_URL_PREFIX) == true }?.let { fileUrl ->
fun createForLocalUrl(url: String, projectDir: File): LocalBazelModuleRegistryService? =
url.takeIf { it.startsWith(FILE_URL_PREFIX) }?.let { fileUrl ->
val directory = fileUrl.removePrefix(FILE_URL_PREFIX)
.replace(WORKSPACE_PLACEHOLDER, projectDir.absolutePath)

Expand Down

0 comments on commit 37ea3e6

Please sign in to comment.