Skip to content

Commit

Permalink
v0.1.1 misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
geemus committed Aug 20, 2024
1 parent a4aecb2 commit da1adb8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
12 changes: 12 additions & 0 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net/url"
"os"
"os/exec"
"runtime"
"strings"
"time"
Expand All @@ -17,6 +18,7 @@ import (

"github.com/anchordotdev/cli/models"
"github.com/anchordotdev/cli/stacktrace"
"github.com/anchordotdev/cli/truststore"
"github.com/anchordotdev/cli/ui"
)

Expand Down Expand Up @@ -172,6 +174,16 @@ func isReportable(err error) bool {
return false
}

var terr truststore.Error
if errors.As(err, &terr) {
return false
}

eerr := new(exec.ExitError)
if errors.As(err, &eerr) {
return false
}

switch err {
case context.Canceled:
return false
Expand Down
2 changes: 2 additions & 0 deletions detection/detection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func TestDefaultDetectors(t *testing.T) {
fakeFS := fstest.MapFS{
"Gemfile": &fstest.MapFile{Data: []byte(""), Mode: 0644},
"Gemfile.lock": &fstest.MapFile{Data: []byte(""), Mode: 0644},
"Pipfile": &fstest.MapFile{Data: []byte(""), Mode: 0644},
"Pipfile.lock": &fstest.MapFile{Data: []byte(""), Mode: 0644},
"package.json": &fstest.MapFile{Data: []byte(""), Mode: 0644},
"requirements.txt": &fstest.MapFile{Data: []byte(""), Mode: 0644},
"main.go": &fstest.MapFile{Data: []byte(""), Mode: 0644},
Expand Down
2 changes: 1 addition & 1 deletion detection/languages.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (

Python = &FileDetector{
Title: "Python",
Paths: []string{"requirements.txt"},
Paths: []string{"Pipfile", "Pipfile.lock", "requirements.txt"},
FollowUpDetectors: []Detector{Django, Flask},
AnchorCategory: anchorcli.CategoryPython,
}
Expand Down
10 changes: 1 addition & 9 deletions lcl/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ var CmdBootstrap = cli.NewCmd[Bootstrap](CmdLcl, "bootstrap", func(cmd *cobra.Co
var loopbackAddrs = []string{"127.0.0.1", "::1"}

type Bootstrap struct {
anc *api.Session
orgSlug, realmSlug string
anc *api.Session

auditInfo *truststore.AuditInfo
}
Expand Down Expand Up @@ -168,10 +167,6 @@ func (c Bootstrap) perform(ctx context.Context, drv *ui.Driver) error {
}

func (c Bootstrap) personalOrgAPID(ctx context.Context) (string, error) {
if c.orgSlug != "" {
return c.orgSlug, nil
}

userInfo, err := c.anc.UserInfo(ctx)
if err != nil {
return "", err
Expand All @@ -180,9 +175,6 @@ func (c Bootstrap) personalOrgAPID(ctx context.Context) (string, error) {
}

func (c Bootstrap) localhostRealmAPID() (string, error) {
if c.realmSlug != "" {
return c.realmSlug, nil // TODO: is this used?
}
return "localhost", nil
}

Expand Down
3 changes: 0 additions & 3 deletions lcl/lcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ func (c *Command) systemConfig(ctx context.Context, drv *ui.Driver) error {

cmdBootstrap := &Bootstrap{
anc: c.anc,
orgSlug: orgSlug,
realmSlug: realmSlug,

auditInfo: auditInfo,
}

Expand Down

0 comments on commit da1adb8

Please sign in to comment.