From fa076a4184818a44baf0b6d660166c8c8352719d Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Wed, 24 Jan 2024 13:05:32 -0500 Subject: [PATCH] chore: update linter simplifications Signed-off-by: Christopher Phillips --- cmd/grant/cli/internal/check/report.go | 37 -------------------------- cmd/grant/cli/internal/list/report.go | 2 +- grant/case.go | 9 ++----- 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/cmd/grant/cli/internal/check/report.go b/cmd/grant/cli/internal/check/report.go index 604c91e..7daece7 100644 --- a/cmd/grant/cli/internal/check/report.go +++ b/cmd/grant/cli/internal/check/report.go @@ -186,43 +186,6 @@ func (r *Report) renderCheckTree() error { return nil } -func (r *Report) renderList() error { - var uiLists []list.Writer - for _, res := range r.Results { - r.Monitor.Increment() - r.Monitor.AtomicStage.Set(res.Case.UserInput) - resulList := newList() - uiLists = append(uiLists, resulList) - resulList.AppendItem(color.Primary.Sprintf("%s", res.Case.UserInput)) - for _, license := range res.Evaluations.GetLicenses() { - resulList.Indent() - resulList.AppendItem(color.Light.Sprintf("%s", license)) - resulList.UnIndent() - if r.Config.Options.ShowPackages { - packages := res.Evaluations.Packages(license) - resulList.Indent() - resulList.Indent() - for _, pkg := range packages { - resulList.AppendItem(color.Secondary.Sprintf("%s", pkg)) - } - resulList.UnIndent() - resulList.UnIndent() - } - } - if r.Config.Options.ShowPackages { - renderOrphanPackages(resulList, res, true) - } - } - r.Monitor.AtomicStage.Set(strings.Join(r.Results.UserInputs(), ", ")) - - // segment the results into lists by user input - // lists can optionally show the packages that were evaluated - for _, l := range uiLists { - bus.Report(l.Render()) - } - return nil -} - func renderOrphanPackages(l list.Writer, res evalutation.Result, invert bool) { title := color.Secondary newItem := color.Light diff --git a/cmd/grant/cli/internal/list/report.go b/cmd/grant/cli/internal/list/report.go index a80d633..a93dd08 100644 --- a/cmd/grant/cli/internal/list/report.go +++ b/cmd/grant/cli/internal/list/report.go @@ -116,7 +116,7 @@ func (r *Report) renderList() error { licenses := c.GetLicenses() resultList.Indent() for _, l := range licenses { - resultList.AppendItem(fmt.Sprintf("%s", l.Name)) + resultList.AppendItem(l.Name) } resultList.UnIndent() } diff --git a/grant/case.go b/grant/case.go index 544504c..6f51b2b 100644 --- a/grant/case.go +++ b/grant/case.go @@ -65,16 +65,11 @@ func (c Case) GetLicenses() []License { continue } - for _, l := range grantPkg.Licenses { - licenses = append(licenses, l) - } + licenses = append(licenses, grantPkg.Licenses...) } } - for _, l := range c.Licenses { - licenses = append(licenses, l) - } - + licenses = append(licenses, c.Licenses...) return licenses }