Showing 85 of 107 total issues
Function VerifyPGPSignatures
has 5 return statements (exceeds 4 allowed). Open
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
}
Method Metafile.reset
has 5 return statements (exceeds 4 allowed). Open
Open
func (f Metafile) reset() error {
if err := f.delete(); err != nil {
return err
}
Method TufRepoRotator.Rotate
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
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")
- Read upRead up
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
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)
}
Function NewClient
has 5 return statements (exceeds 4 allowed). Open
Open
func NewClient(repoUrl, metaLocalStoreDir, locksPath string) (*Client, error) {
c := &Client{}
c.metaLocalStoreDir = metaLocalStoreDir
c.repoUrl = repoUrl