horizoncd/horizon

View on GitHub
pkg/git/gitlab/gitlab.go

Summary

Maintainability
B
6 hrs
Test Coverage

Showing 4 of 4 total issues

Method Helper.GetCommit has 7 return statements (exceeds 4 allowed).
Open

func (h Helper) GetCommit(ctx context.Context, gitURL string, refType string, ref string) (*git.Commit, error) {
pid, err := git.ExtractProjectPathFromURL(gitURL)
if err != nil {
return nil, err
}
Severity: Major
Found in pkg/git/gitlab/gitlab.go - About 45 mins to fix

    Method Helper.GetTagArchive has 5 return statements (exceeds 4 allowed).
    Open

    func (h Helper) GetTagArchive(ctx context.Context, gitURL, tagName string) (*git.Tag, error) {
    URL, err := url.Parse(gitURL)
    if err != nil || gitURL == "" {
    return nil, perror.Wrap(herrors.ErrParamInvalid,
    fmt.Sprintf("failed to parse gitlab url: %s", err))
    Severity: Major
    Found in pkg/git/gitlab/gitlab.go - About 35 mins to fix

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

      func (h Helper) ListTag(ctx context.Context, gitURL string, params *git.SearchParams) ([]string, error) {
      pid, err := git.ExtractProjectPathFromURL(gitURL)
      if err != nil {
      return nil, err
      }
      Severity: Major
      Found in pkg/git/gitlab/gitlab.go and 1 other location - About 2 hrs to fix
      pkg/git/gitlab/gitlab.go on lines 129..150

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

      func (h Helper) ListBranch(ctx context.Context, gitURL string, params *git.SearchParams) ([]string, error) {
      pid, err := git.ExtractProjectPathFromURL(gitURL)
      if err != nil {
      return nil, err
      }
      Severity: Major
      Found in pkg/git/gitlab/gitlab.go and 1 other location - About 2 hrs to fix
      pkg/git/gitlab/gitlab.go on lines 152..173
      Category
      Status