From 7fa4f01a9d10a0cd1c26567fb79acb16c9edfcc7 Mon Sep 17 00:00:00 2001 From: djeebus Date: Wed, 20 Dec 2023 19:49:55 -0500 Subject: [PATCH] remove dead and confusing code --- pkg/diff/diff.go | 6 +----- pkg/vcs/github_client/client.go | 18 ------------------ pkg/vcs/gitlab_client/client.go | 9 --------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/pkg/diff/diff.go b/pkg/diff/diff.go index c2bfabce..efc198de 100644 --- a/pkg/diff/diff.go +++ b/pkg/diff/diff.go @@ -38,11 +38,7 @@ type objKeyLiveTarget struct { } func isAppMissingErr(err error) bool { - if strings.Contains(err.Error(), "PermissionDenied") { - return true - } - - return false + return strings.Contains(err.Error(), "PermissionDenied") } /* diff --git a/pkg/vcs/github_client/client.go b/pkg/vcs/github_client/client.go index fda0fb8b..09b14f99 100644 --- a/pkg/vcs/github_client/client.go +++ b/pkg/vcs/github_client/client.go @@ -116,24 +116,6 @@ func (c *Client) ParseHook(r *http.Request, request []byte) (*repo.Repo, error) } } -// We need an email and username for authenticating our local git repository -// Grab the current authenticated client login and email -func (c *Client) getUserDetails() (string, string, error) { - user, _, err := c.Users.Get(context.Background(), "") - if err != nil { - return "", "", err - } - - // Some users on GitHub don't have an email listed; if so, catch that and return empty string - if user.Email == nil { - log.Error().Msg("could not load Github user email") - return *user.Login, "", nil - } - - return *user.Login, *user.Email, nil - -} - func (c *Client) buildRepoFromEvent(event *github.PullRequestEvent) *repo.Repo { var labels []string for _, label := range event.PullRequest.Labels { diff --git a/pkg/vcs/gitlab_client/client.go b/pkg/vcs/gitlab_client/client.go index 8bb07b57..27b3bbd5 100644 --- a/pkg/vcs/gitlab_client/client.go +++ b/pkg/vcs/gitlab_client/client.go @@ -56,15 +56,6 @@ func CreateGitlabClient() (*Client, error) { return &Client{Client: c, username: user.Username, email: user.Email}, nil } -func (c *Client) getTokenUser() (string, string) { - user, _, err := c.Users.CurrentUser() - if err != nil { - log.Fatal().Err(err).Msg("could not create Gitlab token user") - } - - return user.Username, user.Email -} - func (c *Client) Email() string { return c.email } func (c *Client) Username() string { return c.username } func (c *Client) GetName() string {