Skip to content

Commit

Permalink
Fix lint and integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehsan-saradar committed Jan 8, 2024
1 parent 9b0014e commit b9a8a18
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
6 changes: 4 additions & 2 deletions integration/marketplace/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"os"
"path/filepath"
"regexp"
"strings"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -69,5 +69,7 @@ func TestMarketplace(t *testing.T) {
step.Stdout(buf),
)),
))
assert.Regexp(regexp.MustCompile("🎉 Found [0-9]+ results"), buf.String())
assert.Condition(func() bool {
return strings.HasPrefix(buf.String(), "❌") || strings.HasPrefix(buf.String(), "📦")
}, "unexpected output: %s", buf.String())
}
2 changes: 0 additions & 2 deletions marketplace/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"github.com/spf13/cobra"
)

const igniteCLIPackage = "github.com/ignite/cli"

var (
linkStyle = lipgloss.NewStyle().
Foreground(lipgloss.Color("10")).
Expand Down
3 changes: 1 addition & 2 deletions marketplace/cmd/marketplace.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ func NewMarketplace() *cobra.Command {
Long: `Marketplace is a command line tool that helps you to search for ignite apps
using GitHub search API. It also helps you to get more information about an app.
Please note that Github API has a very limited rate limit for unauthenticated requests
so it's recommended to set GITHUB_TOKEN environment variable to your GitHub access token
if you want to use marketplace commands frequently.`,
so it's recommended to use the --github-token flag you want to use marketplace commands frequently.`,
SilenceUsage: true,
SilenceErrors: true,
}
Expand Down
10 changes: 5 additions & 5 deletions marketplace/pkg/apps/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ func Search(ctx context.Context, client *xgithub.Client, query string, minStars

result = append(result, AppRepository{
PackageURL: fmt.Sprintf("github.com/%s/%s", repo.GetOwner().GetLogin(), repo.GetName()),
Name: repo.GetName(),
Owner: repo.GetOwner().GetLogin(),
Stars: repo.GetStargazersCount(),
UpdatedAt: repo.GetPushedAt().Time,
Apps: apps,
Name: repo.GetName(),
Owner: repo.GetOwner().GetLogin(),
Stars: repo.GetStargazersCount(),
UpdatedAt: repo.GetPushedAt().Time,
Apps: apps,
})
}

Expand Down
10 changes: 5 additions & 5 deletions marketplace/pkg/tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func (n *Node) AddChild(child *Node) {
}

// Format implements fmt.Formatter.
func (n *Node) Format(f fmt.State, verb rune) {
fprintNode(f, verb, "", n)
func (n *Node) Format(f fmt.State, _ rune) {
fprintNode(f, "", n)
}

func fprintNode(f fmt.State, verb rune, prefix string, n *Node) {
func fprintNode(f fmt.State, prefix string, n *Node) {
fmt.Fprintln(f, n.Text)

width := 2
Expand All @@ -47,10 +47,10 @@ func fprintNode(f fmt.State, verb rune, prefix string, n *Node) {
}
if i < len(n.Children)-1 {
fmt.Fprintf(f, "%s├%s ", prefix, strings.Repeat("─", width))
fprintNode(f, verb, prefix+"│"+strings.Repeat(" ", width+1), child)
fprintNode(f, prefix+"│"+strings.Repeat(" ", width+1), child)
} else {
fmt.Fprintf(f, "%s└%s ", prefix, strings.Repeat("─", width))
fprintNode(f, verb, prefix+strings.Repeat(" ", width+2), child)
fprintNode(f, prefix+strings.Repeat(" ", width+2), child)
}
}
}

0 comments on commit b9a8a18

Please sign in to comment.