Skip to content

Commit a47061d

Browse files
committed
Improve readability
1 parent d008373 commit a47061d

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

github/git/Commit.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ case class Commit(author: String, sha: String, date: String)
77
object Commit:
88
def commitsFromJson(json: String): List[Commit] =
99
for commit <- ujson.read(json).arr.toList
10+
author = Try(commit("author")("login").str)
11+
.orElse(Try(commit("commit")("author")("name").str))
12+
.getOrElse("Unknown")
13+
sha = commit("sha").str
14+
date = Try(commit("commit")("author")("date").str).getOrElse("")
1015
yield
11-
val author = Try(commit("author")("login").str)
12-
.orElse(Try(commit("commit")("author")("name").str))
13-
.getOrElse("Unknown")
14-
val sha = commit("sha").str
15-
val date = Try(commit("commit")("author")("date").str).getOrElse("")
16-
Commit(author, sha, date)
16+
Commit(author, sha, date)
1717

github/main.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ def main(operation: String, owner: String, repoName: String) =
2020
case "commits" => repo.getCommits()
2121
.foreach(commit => println(s"$commit.author,$commit.date"))
2222
case "lines" => repo.lineCountPerLanguage()
23-
.toSeq
24-
.sortWith(_._2 > _._2)
2523
.foreach((lang, lines) => println(s"$lang,$lines"))
2624
case "issues" => repo.getOpenIssuesWithoutAnswers()
2725
.foreach(println)

0 commit comments

Comments
 (0)