Skip to content

Commit

Permalink
chore: update linter simplifications
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Phillips <[email protected]>
  • Loading branch information
spiffcs committed Jan 24, 2024
1 parent 988e972 commit fa076a4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
37 changes: 0 additions & 37 deletions cmd/grant/cli/internal/check/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/grant/cli/internal/list/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
9 changes: 2 additions & 7 deletions grant/case.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit fa076a4

Please sign in to comment.