From 7951153dfc1accd9e873c6a680f0ab0b0512120f Mon Sep 17 00:00:00 2001 From: "egor.klimov" Date: Mon, 25 Dec 2023 15:50:25 +0100 Subject: [PATCH] fix: show forks by default --- .../riskypatterns/service/github/GitHubSearchService.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/jetbrains/research/ictl/riskypatterns/service/github/GitHubSearchService.kt b/src/main/kotlin/org/jetbrains/research/ictl/riskypatterns/service/github/GitHubSearchService.kt index a78a329..97d44cc 100644 --- a/src/main/kotlin/org/jetbrains/research/ictl/riskypatterns/service/github/GitHubSearchService.kt +++ b/src/main/kotlin/org/jetbrains/research/ictl/riskypatterns/service/github/GitHubSearchService.kt @@ -7,8 +7,12 @@ class GitHubSearchService( private val gitHubClient: GitHubClient, ) { suspend fun searchRepositories(q: String) = - gitHubClient.searchRepositories(q).groupBy { it.owner } - .map { RepositoriesByOwner(it.key, it.value) } + if (q.isNotBlank()) { + gitHubClient.searchRepositories("$q fork:true").groupBy { it.owner } + .map { RepositoriesByOwner(it.key, it.value) } + } else { + emptyList() + } } data class RepositoriesByOwner(