nuts-foundation/nuts-consent-cordapp

View on GitHub

Showing 12 of 50 total issues

File ConsentFlows.kt has 457 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *     Nuts consent cordapp
 *     Copyright (C) 2019 Nuts community
 *
 *     This program is free software: you can redistribute it and/or modify
Severity: Minor
Found in flows/src/main/kotlin/nl/nuts/consent/flow/ConsentFlows.kt - About 7 hrs to fix

    File ConsentContract.kt has 283 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     *     Nuts consent cordapp
     *     Copyright (C) 2019 Nuts community
     *
     *     This program is free software: you can redistribute it and/or modify
    Severity: Minor
    Found in contract/src/main/kotlin/nl/nuts/consent/contract/ConsentContract.kt - About 2 hrs to fix

      Method call has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              @Suspendable
              override fun call(): SignedTransaction {
                  // Obtain a reference to the notary we want to use.
                  val notary = serviceHub.networkMapCache.notaryIdentities[0]
      
      
      Severity: Major
      Found in flows/src/main/kotlin/nl/nuts/consent/flow/ConsentFlows.kt - About 2 hrs to fix

        Method verifyStates has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    override fun verifyStates(tx: LedgerTransaction) {
                        val command = tx.commands.single { it.value == this }
                        val attachments = tx.attachments.filter { it !is ContractAttachment }
        
                        requireThat {

          Method verifyStates has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      override fun verifyStates(tx: LedgerTransaction) {
                          val command = tx.commands.single { it.value == this }
                          val attachments = tx.attachments.filter { it !is ContractAttachment }
          
                          requireThat {

            Method copy has 13 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                fun copy(uuid: UniqueIdentifier = this.uuid,
                         branchPoint: UniqueIdentifier = this.branchPoint,
                         attachments: Set<SecureHash> = this.attachments,
                         legalEntities: Set<String> = this.legalEntities,
                         signatures: List<AttachmentSignature> = this.signatures,
            Severity: Major
            Found in contract/src/main/kotlin/nl/nuts/consent/state/ConsentBranch.kt - About 1 hr to fix

              Method call has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      @Suspendable
                      override fun call(): SignedTransaction {
                          // Obtain a reference to the notary we want to use.
                          val notary = serviceHub.networkMapCache.notaryIdentities[0]
              
              
              Severity: Minor
              Found in flows/src/main/kotlin/nl/nuts/consent/flow/ConsentFlows.kt - About 1 hr to fix

                Method call has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        @Suspendable
                        override fun call(): SignedTransaction {
                            // Obtain a reference to the notary we want to use.
                            val notary = serviceHub.networkMapCache.notaryIdentities[0]
                
                
                Severity: Minor
                Found in flows/src/main/kotlin/nl/nuts/consent/flow/ConsentFlows.kt - About 1 hr to fix

                  Method verifyStates has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              override fun verifyStates(tx: LedgerTransaction) {
                                  val command = tx.commands.single { it.value == this }
                                  val attachments = tx.attachments.filter { it !is ContractAttachment }
                  
                                  requireThat {

                    Method call has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            @Suspendable
                            override fun call(): SignedTransaction {
                                // Obtain a reference to the notary we want to use.
                                val notary = serviceHub.networkMapCache.notaryIdentities[0]
                    
                    
                    Severity: Minor
                    Found in flows/src/main/kotlin/nl/nuts/consent/flow/ConsentFlows.kt - About 1 hr to fix

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

                                  override fun verifyStates(tx: LedgerTransaction) {
                                      val command = tx.commands.single { it.value == this }
                                      val attachments = tx.attachments.filter { it !is ContractAttachment }
                      
                                      requireThat {
                      Severity: Minor
                      Found in contract/src/main/kotlin/nl/nuts/consent/contract/ConsentContract.kt - 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

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

                          private fun raiseOnDuplicateConsentRecordsRec(stateRef: StateRef, consentRecordHashes: Set<String>, attachments: Set<SecureHash>, serviceHub: ServiceHub, side:String = "origin") {
                      Severity: Minor
                      Found in flows/src/main/kotlin/nl/nuts/consent/flow/ConsentFlows.kt - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language