diff --git a/clients/gitlabrepo/branches.go b/clients/gitlabrepo/branches.go index 724d395f8f7..5230a1f18fe 100644 --- a/clients/gitlabrepo/branches.go +++ b/clients/gitlabrepo/branches.go @@ -43,6 +43,7 @@ func (handler *branchesHandler) init(repourl *repoURL) { handler.once = new(sync.Once) } +// nolint: nestif func (handler *branchesHandler) setup() error { handler.once.Do(func() { if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) { @@ -225,10 +226,9 @@ func makeBranchRefFrom(branch *gitlab.Branch, protectedBranch *gitlab.ProtectedB projectApprovalRule *gitlab.ProjectApprovals, ) *clients.BranchRef { requiresStatusChecks := newFalse() - if projectStatusChecks != nil { - if len(projectStatusChecks) > 0 { - requiresStatusChecks = newTrue() - } + + if len(projectStatusChecks) > 0 { + requiresStatusChecks = newTrue() } statusChecksRule := clients.StatusChecksRule{ diff --git a/clients/gitlabrepo/client.go b/clients/gitlabrepo/client.go index 20f30afda1b..ce38f5fa7ce 100644 --- a/clients/gitlabrepo/client.go +++ b/clients/gitlabrepo/client.go @@ -121,6 +121,7 @@ func (client *Client) InitRepo(inputRepo clients.Repo, commitSHA string) error { // Init tarballHandler. client.tarball.init(client.ctx, client.repourl, client.repo, commitSHA) + return nil } diff --git a/clients/gitlabrepo/commits.go b/clients/gitlabrepo/commits.go index a31ea8a5de7..796c003d563 100644 --- a/clients/gitlabrepo/commits.go +++ b/clients/gitlabrepo/commits.go @@ -38,6 +38,7 @@ func (handler *commitsHandler) init(repourl *repoURL) { handler.once = new(sync.Once) } +// nolint: gocognit func (handler *commitsHandler) setup() error { handler.once.Do(func() { commits, _, err := handler.glClient.Commits.ListCommits(handler.repourl.projectID, &gitlab.ListCommitsOptions{})