server/pkg/git/signatures.go

Summary

Maintainability
B
4 hrs
Test Coverage
D
69%

Function VerifyTagSignatures has 9 return statements (exceeds 4 allowed).
Open

func VerifyTagSignatures(repo *git.Repository, tagName string, trustedPGPPublicKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) error {
    tr, err := repo.Tag(tagName)
    if err != nil {
        return fmt.Errorf("unable to get tag: %w", err)
    }
Severity: Major
Found in server/pkg/git/signatures.go - About 55 mins to fix

    Function objectSignaturesFromNotes has 7 return statements (exceeds 4 allowed).
    Open

    func objectSignaturesFromNotes(repo *git.Repository, objectID string) ([]string, error) {
        ref, err := repo.Reference(notesReferenceName, true)
        if err != nil {
            if err == plumbing.ErrReferenceNotFound {
                return nil, nil
    Severity: Major
    Found in server/pkg/git/signatures.go - About 45 mins to fix

      Function verifyObjectSignatures has 7 return statements (exceeds 4 allowed).
      Open

      func verifyObjectSignatures(repo *git.Repository, objectID string, trustedPGPPublicKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) error {
          signatures, err := objectSignaturesFromNotes(repo, objectID)
          if err != nil {
              if strings.HasSuffix(err.Error(), plumbing.ErrObjectNotFound.Error()) {
                  logger.Debug(fmt.Sprintf("[DEBUG-SIGNATURES] git object not found (%s): exiting", err))
      Severity: Major
      Found in server/pkg/git/signatures.go - About 45 mins to fix

        Function VerifyCommitSignatures has 6 return statements (exceeds 4 allowed).
        Open

        func VerifyCommitSignatures(repo *git.Repository, commit string, trustedPGPPublicKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) error {
            co, err := repo.CommitObject(plumbing.NewHash(commit))
            if err != nil {
                return fmt.Errorf("unable to get commit %q: %w", commit, err)
            }
        Severity: Major
        Found in server/pkg/git/signatures.go - About 40 mins to fix

          Function VerifyTagSignatures has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func VerifyTagSignatures(repo *git.Repository, tagName string, trustedPGPPublicKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) error {
          Severity: Minor
          Found in server/pkg/git/signatures.go - About 35 mins to fix

            Function verifyObjectSignatures has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func verifyObjectSignatures(repo *git.Repository, objectID string, trustedPGPPublicKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) error {
            Severity: Minor
            Found in server/pkg/git/signatures.go - About 35 mins to fix

              Function VerifyCommitSignatures has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func VerifyCommitSignatures(repo *git.Repository, commit string, trustedPGPPublicKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) error {
              Severity: Minor
              Found in server/pkg/git/signatures.go - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status