From 048239b7eb798aeaeaba01513d3cf7fbbaad4247 Mon Sep 17 00:00:00 2001 From: Euan Meston Date: Sat, 28 Jun 2025 17:44:05 +0100 Subject: [PATCH] test and bug fixes --- cmd/modcheck/main.go | 7 ++++--- modcheck_test.go | 4 ++-- repo.go | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/modcheck/main.go b/cmd/modcheck/main.go index 215fa96..d312cca 100644 --- a/cmd/modcheck/main.go +++ b/cmd/modcheck/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "strconv" "github.com/euanwm/modcheck" "github.com/gdamore/tcell/v2" @@ -106,15 +107,15 @@ func populateTable(repos []modcheck.Repo, table *tview.Table) { SetTextColor(tview.Styles.PrimaryTextColor). SetAlign(tview.AlignCenter)) - table.SetCell(repo+1, OpenIssuesColumn, tview.NewTableCell(repos[repo].OSIData.OpenIssuesCount). + table.SetCell(repo+1, OpenIssuesColumn, tview.NewTableCell(strconv.Itoa(repos[repo].OSIData.OpenIssuesCount)). SetTextColor(tview.Styles.PrimaryTextColor). SetAlign(tview.AlignCenter)) - table.SetCell(repo+1, StarsColumn, tview.NewTableCell(repos[repo].OSIData.StarsCount). + table.SetCell(repo+1, StarsColumn, tview.NewTableCell(strconv.Itoa(repos[repo].OSIData.StarsCount)). SetTextColor(tview.Styles.PrimaryTextColor). SetAlign(tview.AlignCenter)) - table.SetCell(repo+1, ForksColumn, tview.NewTableCell(repos[repo].OSIData.ForksCount). + table.SetCell(repo+1, ForksColumn, tview.NewTableCell(strconv.Itoa(repos[repo].OSIData.ForksCount)). SetTextColor(tview.Styles.PrimaryTextColor). SetAlign(tview.AlignCenter)) diff --git a/modcheck_test.go b/modcheck_test.go index 555befe..8f347ca 100644 --- a/modcheck_test.go +++ b/modcheck_test.go @@ -74,8 +74,8 @@ func Test_UpdateAllRepos(t *testing.T) { } } - if count != 10 { - t.Errorf("expected 10, got %v", count) + if count != 11 { + t.Errorf("expected 11, got %v", count) } } diff --git a/repo.go b/repo.go index 093f48f..f0f50e9 100644 --- a/repo.go +++ b/repo.go @@ -20,9 +20,9 @@ type Project struct { ID string `json:"id"` } `json:"projectKey"` - OpenIssuesCount string `json:"openIssuesCount"` - StarsCount string `json:"starsCount"` - ForksCount string `json:"forksCount"` + OpenIssuesCount int `json:"openIssuesCount"` + StarsCount int `json:"starsCount"` + ForksCount int `json:"forksCount"` License string `json:"license"` Description string `json:"description"` Homepage string `json:"homepage"` @@ -42,7 +42,7 @@ type Project struct { ShortDescription string `json:"shortDescription"` URL string `json:"url"` } `json:"documentation"` - Score string `json:"score"` + Score int `json:"score"` Reason string `json:"reason"` Details []string `json:"details"` } `json:"checks"`