nuts-foundation/nuts-node

View on GitHub

Showing 140 of 165 total issues

Method OpenID4VPClient.PostAuthorizationResponse has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func (c *OpenID4VPClient) PostAuthorizationResponse(ctx context.Context, vp vc.VerifiablePresentation, presentationSubmission pe.PresentationSubmission, verifierResponseURI string, state string) (string, error) {
Severity: Minor
Found in auth/client/iam/openid4vp.go - About 35 mins to fix

    Method sqlWallet.BuildPresentation has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (h sqlWallet) BuildPresentation(ctx context.Context, credentials []vc.VerifiableCredential, options PresentationOptions, signerDID *did.DID, validateVC bool) (*vc.VerifiablePresentation, error) {
    Severity: Minor
    Found in vcr/holder/sql_wallet.go - About 35 mins to fix

      Method Wrapper.handleS2SAccessTokenRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (r Wrapper) handleS2SAccessTokenRequest(ctx context.Context, issuer did.DID, scope string, submissionJSON string, assertionJSON string) (HandleTokenRequestResponseObject, error) {
      Severity: Minor
      Found in auth/api/iam/s2s_vptoken.go - About 35 mins to fix

        Method sqlWallet.BuildSubmission has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (h sqlWallet) BuildSubmission(ctx context.Context, walletDID did.DID, presentationDefinition pe.PresentationDefinition, acceptedFormats map[string]map[string][]string, params BuildParams) (*vc.VerifiablePresentation, *pe.PresentationSubmission, error) {
        Severity: Minor
        Found in vcr/holder/sql_wallet.go - About 35 mins to fix

          Method presenter.buildJWTPresentation has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (p presenter) buildJWTPresentation(ctx context.Context, subjectDID did.DID, credentials []vc.VerifiableCredential, options PresentationOptions, keyID string) (*vc.VerifiablePresentation, error) {
          Severity: Minor
          Found in vcr/holder/presenter.go - About 35 mins to fix

            Method verifier.doVerifyVP has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (v verifier) doVerifyVP(vcVerifier Verifier, presentation vc.VerifiablePresentation, verifyVCs bool, allowUntrustedVCs bool, validAt *time.Time) ([]vc.VerifiableCredential, error) {
            Severity: Minor
            Found in vcr/verifier/verifier.go - About 35 mins to fix

              Method Crypto.SignJWS has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func (client *Crypto) SignJWS(ctx context.Context, payload []byte, headers map[string]interface{}, key interface{}, detached bool) (string, error) {
              Severity: Minor
              Found in crypto/jwx.go - About 35 mins to fix

                Method memoryWallet.BuildSubmission has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func (m memoryWallet) BuildSubmission(ctx context.Context, walletDID did.DID, presentationDefinition pe.PresentationDefinition, acceptedFormats map[string]map[string][]string, params BuildParams) (*vc.VerifiablePresentation, *pe.PresentationSubmission, error) {
                Severity: Minor
                Found in vcr/holder/memory_wallet.go - About 35 mins to fix

                  Method MemoryJWTSigner.SignJWS has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (m MemoryJWTSigner) SignJWS(_ context.Context, _ []byte, _ map[string]interface{}, _ interface{}, _ bool) (string, error) {
                  Severity: Minor
                  Found in crypto/memory.go - About 35 mins to fix

                    Method presenter.buildJSONLDPresentation has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func (p presenter) buildJSONLDPresentation(ctx context.Context, subjectDID did.DID, credentials []vc.VerifiableCredential, options PresentationOptions, keyID string) (*vc.VerifiablePresentation, error) {
                    Severity: Minor
                    Found in vcr/holder/presenter.go - About 35 mins to fix

                      Method HTTPClient.PostAuthorizationResponse has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func (hb HTTPClient) PostAuthorizationResponse(ctx context.Context, vp vc.VerifiablePresentation, presentationSubmission pe.PresentationSubmission, verifierResponseURI url.URL, state string) (string, error) {
                      Severity: Minor
                      Found in auth/client/iam/client.go - About 35 mins to fix

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

                            keyResolver resolver.KeyResolver, keyStore crypto.KeyStore, verifier verifier.Verifier, jsonldManager jsonld.JSONLD,
                            storageEngine storage.Engine) Wallet {
                        Severity: Minor
                        Found in vcr/holder/sql_wallet.go - About 35 mins to fix

                          Method didman.addService has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          func (d *didman) addService(ctx context.Context, id did.DID, serviceType string, serviceEndpoint interface{}, preprocessor func(*did.Document)) (*did.Service, error) {
                          Severity: Minor
                          Found in didman/didman.go - About 35 mins to fix

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

                            func (i *openidHandler) loadCredentialDefinitions() error {
                            
                                // retrieve the definitions from assets and add to the list of CredentialsSupported
                                definitionsDir, err := assets.FS.ReadDir("definitions")
                                if err != nil {
                            Severity: Minor
                            Found in vcr/issuer/openid.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

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

                            func (d dag) setNumberOfTransactions(tx stoabs.WriteTx, count uint64) error {
                                writer := tx.GetShelfWriter(metadataShelf)
                                bytes := make([]byte, 8)
                                binary.BigEndian.PutUint64(bytes[:], count)
                            
                            
                            Severity: Minor
                            Found in network/dag/dag.go and 1 other location - About 30 mins to fix
                            network/dag/dag.go on lines 339..345

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 102.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                            func (d dag) setHighestClockValue(tx stoabs.WriteTx, count uint32) error {
                                writer := tx.GetShelfWriter(metadataShelf)
                                bytes := make([]byte, 4)
                                binary.BigEndian.PutUint32(bytes[:], count)
                            
                            
                            Severity: Minor
                            Found in network/dag/dag.go and 1 other location - About 30 mins to fix
                            network/dag/dag.go on lines 271..277

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 102.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Method validator.validateCert has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (v *validator) validateCert(cert *x509.Certificate) error {
                                // Check if a denylist is in use
                                if v.denylist != nil {
                                    // Validate the cert against the denylist
                                    if err := v.denylist.ValidateCert(cert); err != nil {
                            Severity: Minor
                            Found in pki/validator.go - About 25 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 vcr.Untrusted has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (c *vcr) Untrusted(credentialType ssi.URI) ([]ssi.URI, error) {
                                didResolver := c.vdrInstance.Resolver()
                                trustMap := make(map[string]bool)
                                untrusted := make([]ssi.URI, 0)
                                for _, trusted := range c.trustConfig.List(credentialType) {
                            Severity: Minor
                            Found in vcr/vcr.go - About 25 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 PresentationDefinition.matchSubmissionRequirements has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (presentationDefinition PresentationDefinition) matchSubmissionRequirements(vcs []vc.VerifiableCredential) ([]InputDescriptorMappingObject, []vc.VerifiableCredential, error) {
                                // first we use the constraint matching algorithm to get the matching credentials
                                candidates, err := presentationDefinition.matchConstraints(vcs)
                                if err != nil {
                                    return nil, nil, err
                            Severity: Minor
                            Found in vcr/pe/presentation_definition.go - About 25 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

                            2: cannot find package "github.com/sirupsen/logrus" in any of:
                            Open

                                "github.com/sirupsen/logrus"
                            Severity: Minor
                            Found in audit/audit.go by govet
                            Severity
                            Category
                            Status
                            Source
                            Language