nuts-foundation/nuts-node

View on GitHub
vcr/revocation/statuslist2021_issuer.go

Summary

Maintainability
B
6 hrs
Test Coverage
B
80%

Method StatusList2021.Entry has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
Open

func (cs *StatusList2021) Entry(ctx context.Context, issuer did.DID, purpose StatusPurpose) (*StatusList2021Entry, error) {
    if purpose != StatusPurposeRevocation {
        return nil, errUnsupportedPurpose
    }

Severity: Minor
Found in vcr/revocation/statuslist2021_issuer.go - About 1 hr 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 StatusList2021.Revoke has 62 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (cs *StatusList2021) Revoke(ctx context.Context, credentialID ssi.URI, entry StatusList2021Entry) error {
    // parse StatusListIndex
    statusListIndex, err := strconv.Atoi(entry.StatusListIndex)
    if err != nil {
        return err
Severity: Minor
Found in vcr/revocation/statuslist2021_issuer.go - About 1 hr to fix

    Method StatusList2021.Entry has 60 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (cs *StatusList2021) Entry(ctx context.Context, issuer did.DID, purpose StatusPurpose) (*StatusList2021Entry, error) {
        if purpose != StatusPurposeRevocation {
            return nil, errUnsupportedPurpose
        }
    
    
    Severity: Minor
    Found in vcr/revocation/statuslist2021_issuer.go - About 1 hr to fix

      Method StatusList2021.Credential has 56 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (cs *StatusList2021) Credential(ctx context.Context, issuerDID did.DID, page int) (*vc.VerifiableCredential, error) {
          statusListCredentialURL, err := toStatusListCredential(issuerDID, page)
          if err != nil {
              return nil, err
          }
      Severity: Minor
      Found in vcr/revocation/statuslist2021_issuer.go - About 1 hr to fix

        Method StatusList2021.Revoke has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
        Open

        func (cs *StatusList2021) Revoke(ctx context.Context, credentialID ssi.URI, entry StatusList2021Entry) error {
            // parse StatusListIndex
            statusListIndex, err := strconv.Atoi(entry.StatusListIndex)
            if err != nil {
                return err
        Severity: Minor
        Found in vcr/revocation/statuslist2021_issuer.go - About 45 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

        There are no issues that match your filters.

        Category
        Status