horizoncd/horizon

View on GitHub
lib/gitlab/gitlab.go

Summary

Maintainability
D
1 day
Test Coverage

Showing 14 of 14 total issues

helper has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

type helper struct {
client *gitlab.Client
httpURL string
}
Severity: Minor
Found in lib/gitlab/gitlab.go - About 3 hrs to fix

    Method helper.WriteFiles has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (h *helper) WriteFiles(ctx context.Context, pid interface{}, branch, commitMsg string,
    startBranch *string, actions []CommitAction) (_ *gitlab.Commit, err error) {
    Severity: Minor
    Found in lib/gitlab/gitlab.go - About 35 mins to fix

      Method helper.GetCreatedGroup has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (h *helper) GetCreatedGroup(ctx context.Context, parentID int,
      parentFullPath string, name string, visibility string) (*gitlab.Group, error) {
      Severity: Minor
      Found in lib/gitlab/gitlab.go - About 35 mins to fix

        Method helper.AcceptMR has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (h *helper) AcceptMR(ctx context.Context, pid interface{}, mrID int,
        mergeCommitMsg *string, shouldRemoveSourceBranch *bool) (mr *gitlab.MergeRequest, err error) {
        Severity: Minor
        Found in lib/gitlab/gitlab.go - About 35 mins to fix

          Method helper.AcceptMR has 5 return statements (exceeds 4 allowed).
          Open

          func (h *helper) AcceptMR(ctx context.Context, pid interface{}, mrID int,
          mergeCommitMsg *string, shouldRemoveSourceBranch *bool) (mr *gitlab.MergeRequest, err error) {
          const op = "gitlab: accept mr"
          defer wlog.Start(ctx, op).StopPrint()
           
           
          Severity: Major
          Found in lib/gitlab/gitlab.go - About 35 mins to fix

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            func (h *helper) GetBranch(ctx context.Context, pid interface{}, branch string) (_ *gitlab.Branch, err error) {
            const op = "gitlab: get branch"
            defer wlog.Start(ctx, op).StopPrint()
             
            b, rsp, err := h.client.Branches.GetBranch(pid, branch, gitlab.WithContext(ctx))
            Severity: Major
            Found in lib/gitlab/gitlab.go and 2 other locations - About 1 hr to fix
            lib/gitlab/gitlab.go on lines 357..367
            lib/gitlab/gitlab.go on lines 369..379

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            func (h *helper) GetCommit(ctx context.Context, pid interface{}, commit string) (_ *gitlab.Commit, err error) {
            const op = "gitlab: get commit"
            defer wlog.Start(ctx, op).StopPrint()
             
            c, rsp, err := h.client.Commits.GetCommit(pid, commit, gitlab.WithContext(ctx))
            Severity: Major
            Found in lib/gitlab/gitlab.go and 2 other locations - About 1 hr to fix
            lib/gitlab/gitlab.go on lines 321..331
            lib/gitlab/gitlab.go on lines 369..379

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            func (h *helper) GetTag(ctx context.Context, pid interface{}, tag string) (_ *gitlab.Tag, err error) {
            const op = "gitlab: get tag"
            defer wlog.Start(ctx, op).StopPrint()
             
            c, rsp, err := h.client.Tags.GetTag(pid, tag, gitlab.WithContext(ctx))
            Severity: Major
            Found in lib/gitlab/gitlab.go and 2 other locations - About 1 hr to fix
            lib/gitlab/gitlab.go on lines 321..331
            lib/gitlab/gitlab.go on lines 357..367

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (h *helper) ListTag(ctx context.Context, pid interface{},
            listTagsOptions *gitlab.ListTagsOptions) (_ []*gitlab.Tag, err error) {
            const op = "gitlab: list tag"
            defer wlog.Start(ctx, op).StopPrint()
             
             
            Severity: Major
            Found in lib/gitlab/gitlab.go and 1 other location - About 1 hr to fix
            lib/gitlab/gitlab.go on lines 333..343

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (h *helper) ListBranch(ctx context.Context, pid interface{},
            listBranchOptions *gitlab.ListBranchesOptions) (_ []*gitlab.Branch, err error) {
            const op = "gitlab: list branch"
            defer wlog.Start(ctx, op).StopPrint()
             
             
            Severity: Major
            Found in lib/gitlab/gitlab.go and 1 other location - About 1 hr to fix
            lib/gitlab/gitlab.go on lines 345..355

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (h *helper) GetGroup(ctx context.Context, gid interface{}) (_ *gitlab.Group, err error) {
            const op = "gitlab: get group"
            defer wlog.Start(ctx, op).StopPrint()
             
            group, rsp, err := h.client.Groups.GetGroup(gid, nil, gitlab.WithContext(ctx))
            Severity: Major
            Found in lib/gitlab/gitlab.go and 1 other location - About 1 hr to fix
            lib/gitlab/gitlab.go on lines 279..288

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (h *helper) GetProject(ctx context.Context, pid interface{}) (_ *gitlab.Project, err error) {
            const op = "gitlab: get project"
            defer wlog.Start(ctx, op).StopPrint()
             
            project, rsp, err := h.client.Projects.GetProject(pid, nil, gitlab.WithContext(ctx))
            Severity: Major
            Found in lib/gitlab/gitlab.go and 1 other location - About 1 hr to fix
            lib/gitlab/gitlab.go on lines 212..222

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (h *helper) DeleteProject(ctx context.Context, pid interface{}) (err error) {
            const op = "gitlab: delete project"
            defer wlog.Start(ctx, op).StopPrint()
             
            rsp, err := h.client.Projects.DeleteProject(pid, gitlab.WithContext(ctx))
            Severity: Minor
            Found in lib/gitlab/gitlab.go and 1 other location - About 40 mins to fix
            lib/gitlab/gitlab.go on lines 270..277

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (h *helper) DeleteGroup(ctx context.Context, gid interface{}) (err error) {
            const op = "gitlab: delete group"
            defer wlog.Start(ctx, op).StopPrint()
             
            rsp, err := h.client.Groups.DeleteGroup(gid, gitlab.WithContext(ctx))
            Severity: Minor
            Found in lib/gitlab/gitlab.go and 1 other location - About 40 mins to fix
            lib/gitlab/gitlab.go on lines 312..319

            There are no issues that match your filters.

            Category
            Status