@@ -5,7 +5,6 @@ import sttp.client3._
55import sttp .model ._
66import os .Path
77
8- import scala .collection .mutable .ArrayBuffer
98import scala .util .Try
109import scala .util .Success
1110
@@ -17,7 +16,7 @@ class Repo(val owner: String, val repoName: String):
1716 lazy val localRepo = cloneRepo()
1817 val client = SimpleHttpClient ()
1918
20- def getCommits (page : Int = 1 ): ArrayBuffer [Commit ] =
19+ def getCommits (page : Int = 1 ): List [Commit ] =
2120 val request = basicRequest
2221 .header(" Accept" , " application/vnd.github+json" )
2322 .get(uri " https://api.github.com/repos/ $owner/ $repoName/commits?per_page=100&page= $page" )
@@ -28,7 +27,7 @@ class Repo(val owner: String, val repoName: String):
2827 case Left (value) => error(value)
2928
3029 val commits = Commit .commitsFromJson(json)
31- if (isLast(response)) commits else commits ++= getCommits(page + 1 )
30+ if (isLast(response)) commits else commits ++ getCommits(page + 1 )
3231
3332 def getContributors (): List [Contributor ] =
3433 getCommits()
@@ -37,7 +36,7 @@ class Repo(val owner: String, val repoName: String):
3736 .map((author, commits) => Contributor (author, commits))
3837 .toList
3938
40- def getOpenIssuesWithoutAnswers (page : Int = 1 ): ArrayBuffer [Uri ] =
39+ def getOpenIssuesWithoutAnswers (page : Int = 1 ): List [Uri ] =
4140 val request = basicRequest
4241 .header(" Accept" , " application/vnd.github+json" )
4342 .get(uri " https://api.github.com/repos/ $owner/ $repoName/issues?per_page=100&page= $page" )
@@ -47,13 +46,14 @@ class Repo(val owner: String, val repoName: String):
4746 case Right (content) => content
4847 case Left (value) => error(value)
4948
50- val issues = for issue <- ujson.read(json).arr
51- if issue(" state" ).str == " open"
52- if Try (issue(" pull_request" )).isFailure
53- if hasNoComments(issue(" comments_url" ).str)
54- yield uri " ${issue(" html_url" ).str}"
49+ val issues =
50+ for issue <- ujson.read(json).arr.toList
51+ if issue(" state" ).str == " open"
52+ if Try (issue(" pull_request" )).isFailure
53+ if hasNoComments(issue(" comments_url" ).str)
54+ yield uri " ${issue(" html_url" ).str}"
5555
56- if (isLast(response)) issues else issues ++= getOpenIssuesWithoutAnswers(page + 1 )
56+ if (isLast(response)) issues else issues ++ getOpenIssuesWithoutAnswers(page + 1 )
5757
5858 def lineCountPerLanguage (): Map [Lang , Int ] =
5959 os.walk(localRepo, skip = _.last.equals(" .git" ))
0 commit comments