Showing 85 of 107 total issues

Function VerifyPGPSignatures has 5 return statements (exceeds 4 allowed).
Open

func VerifyPGPSignatures(pgpSignatures []string, signedReaderFunc func() (io.Reader, error), pgpKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) ([]string, int, error) {
    if requiredNumberOfVerifiedSignatures == 0 {
        return pgpKeys, 0, nil
    }

Severity: Major
Found in server/pkg/pgp/util.go - About 35 mins to fix

    Method Metafile.reset has 5 return statements (exceeds 4 allowed).
    Open

    func (f Metafile) reset() error {
        if err := f.delete(); err != nil {
            return err
        }
    
    
    Severity: Major
    Found in client/pkg/util/metafile.go - About 35 mins to fix

      Method TufRepoRotator.Rotate has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

      func (rotator *TufRepoRotator) Rotate(logger hclog.Logger, now time.Time) error {
          var changedRoot, changedTargets, changedSnapshot, changedTimestamp bool
      
          logger.Debug("start rotating expiration timestamps and versions of TUF repository roles")
      
      
      Severity: Minor
      Found in server/pkg/publisher/tuf_repo_rotator.go - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method S3Repository.GenPrivKeys has 5 return statements (exceeds 4 allowed).
      Open

      func (repository *S3Repository) GenPrivKeys() error {
          if _, err := repository.TufRepo.GenKey("root"); err != nil {
              return fmt.Errorf("error generating tuf repository root key: %w", err)
          }
      
      
      Severity: Major
      Found in server/pkg/publisher/repository.go - About 35 mins to fix

        Function NewClient has 5 return statements (exceeds 4 allowed).
        Open

        func NewClient(repoUrl, metaLocalStoreDir, locksPath string) (*Client, error) {
            c := &Client{}
            c.metaLocalStoreDir = metaLocalStoreDir
            c.repoUrl = repoUrl
        
        
        Severity: Major
        Found in client/pkg/tuf/client.go - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language