JeffDeCola/jeffCoin

View on GitHub

Showing 19 of 34 total issues

Function BroadcastThisNode has 88 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func BroadcastThisNode() error {

    s := "START  BroadcastThisNode() - Broadcasts thisNode to the Network"
    log.Debug("ROUTINGNODE: I/F      " + s)

Severity: Major
Found in routingnode/routingnode-interface.go - About 2 hrs to fix

    Function main has 83 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func main() {
    
        fmt.Printf("\nSTART...\n")
        fmt.Printf("Press return to exit\n\n")
    
    
    Severity: Major
    Found in jeffCoin.go - About 2 hrs to fix

      Function HandleRequest has 70 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func HandleRequest(conn net.Conn) {
      
          defer conn.Close()
          rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
      
      
      Severity: Minor
      Found in routingnode/requests.go - About 1 hr to fix

        Function TransactionRequest has 70 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TransactionRequest(nodeIP string, nodeTCPPort string, transactionRequestMessageSigned string) (string, error) {
        
            s := "START  TransactionRequest() - Request to transfer Coins to a jeffCoin Address"
            log.Debug("WALLET:      I/F      " + s)
        
        
        Severity: Minor
        Found in wallet/wallet-interface.go - About 1 hr to fix

          Function RequestBlockchain has 69 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func RequestBlockchain(networkIP string, networkTCPPort string) error {
          
              s := "START  RequestBlockchain() - Requests the blockchain and the pendingBlock from a Network Node"
              log.Debug("BLOCKCHAIN:  I/F      " + s)
          
          
          Severity: Minor
          Found in blockchain/blockchain-interface.go - About 1 hr to fix

            Function RequestAddressBalance has 69 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func RequestAddressBalance(IP string, TCPPort string, jeffCoinAddress string) (string, error) {
            
                s := "START  RequestAddressBalance() - Requests the jeffCoin balance for a jeffCoin Address"
                log.Debug("WALLET:      I/F      " + s)
            
            
            Severity: Minor
            Found in wallet/wallet-interface.go - About 1 hr to fix

              Function transactionRequestHandler has 68 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func transactionRequestHandler(res http.ResponseWriter, req *http.Request) {
              
                  logReceivedAPICommand()
              
                  s := "START  transactionRequestHandler() - GET: /transactionrequest/{destinationaddress}/{value}"
              Severity: Minor
              Found in webserver/handlers.go - About 1 hr to fix

                Function indexHandler has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func indexHandler(res http.ResponseWriter, req *http.Request) {
                
                    s := "----------------------------------------------------------------"
                    log.Info("WEBSERVER:                   " + s)
                    s = "HTTP SERVER - DISPLAY MAIN WEBPAGE"
                Severity: Minor
                Found in webserver/webpages.go - About 1 hr to fix

                  Function RequestNodeList has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func RequestNodeList(networkIP string, networkTCPPort string) error {
                  
                      s := "START  RequestNodeList() -  Requests the nodeList from a Network Node"
                      log.Debug("ROUTINGNODE: I/F      " + s)
                  
                  
                  Severity: Minor
                  Found in routingnode/routingnode-interface.go - About 1 hr to fix

                    Method txRequestMessageSignedStruct.addTransactionToPendingBlock has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (trms txRequestMessageSignedStruct) addTransactionToPendingBlock(unspentOutputSlice []unspentOutputStruct, change int64) {
                    
                        s := "START  addTransactionToPendingBlock() - Adds a transaction to the pendingBlock and makes change"
                        log.Debug("BLOCKCHAIN:  GUTS     " + s)
                    
                    
                    Severity: Minor
                    Found in blockchain/guts.go - About 1 hr to fix

                      Function sendHandler has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func sendHandler(res http.ResponseWriter, req *http.Request) {
                      
                          s := "----------------------------------------------------------------"
                          log.Info("WEBSERVER:                   " + s)
                          s = "HTTP SERVER - DISPLAY API COMMANDS"
                      Severity: Minor
                      Found in webserver/webpages.go - About 1 hr to fix

                        Function validateHandler has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func validateHandler(res http.ResponseWriter, req *http.Request) {
                        
                            s := "----------------------------------------------------------------"
                            log.Info("WEBSERVER:                   " + s)
                            s = "HTTP SERVER - DISPLAY VALIDATE"
                        Severity: Minor
                        Found in webserver/webpages.go - About 1 hr to fix

                          Method txRequestMessageSignedStruct.processTxRequestMessage has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (trms txRequestMessageSignedStruct) processTxRequestMessage() string {
                          
                              s := "START  processTxRequestMessage() - Request to transfer jeffCoins to a jeffCoin Address"
                              log.Debug("TRANSACTION:          " + s)
                          
                          
                          Severity: Minor
                          Found in blockchain/transactions.go - About 1 hr to fix

                            Function LoadTestDatatoBlockchain has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func LoadTestDatatoBlockchain() {
                            
                                s := "START  LoadTestDatatoBlockchain() - Load the blockchain with test data"
                                log.Debug("*** LOAD-TEST-DATA:   " + s)
                            
                            
                            Severity: Minor
                            Found in testblockchain/load-test-data.go - About 1 hr to fix

                              Function getAddressBalance has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                              Open

                              func getAddressBalance(jeffCoinAddress string) (int64, []unspentOutputStruct) {
                              
                                  s := "START  getAddressBalance() - Gets the jeffCoin Address balance"
                                  log.Debug("BLOCKCHAIN:  GUTS     " + s)
                              
                              
                              Severity: Minor
                              Found in blockchain/guts.go - About 55 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

                              Function BroadcastThisNode has 6 return statements (exceeds 4 allowed).
                              Open

                              func BroadcastThisNode() error {
                              
                                  s := "START  BroadcastThisNode() - Broadcasts thisNode to the Network"
                                  log.Debug("ROUTINGNODE: I/F      " + s)
                              
                              
                              Severity: Major
                              Found in routingnode/routingnode-interface.go - About 40 mins to fix

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

                                func RequestBlockchain(networkIP string, networkTCPPort string) error {
                                
                                    s := "START  RequestBlockchain() - Requests the blockchain and the pendingBlock from a Network Node"
                                    log.Debug("BLOCKCHAIN:  I/F      " + s)
                                
                                
                                Severity: Major
                                Found in blockchain/blockchain-interface.go - About 35 mins to fix

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

                                  func RequestAddressBalance(IP string, TCPPort string, jeffCoinAddress string) (string, error) {
                                  
                                      s := "START  RequestAddressBalance() - Requests the jeffCoin balance for a jeffCoin Address"
                                      log.Debug("WALLET:      I/F      " + s)
                                  
                                  
                                  Severity: Major
                                  Found in wallet/wallet-interface.go - About 35 mins to fix

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

                                    func TransactionRequest(nodeIP string, nodeTCPPort string, transactionRequestMessageSigned string) (string, error) {
                                    
                                        s := "START  TransactionRequest() - Request to transfer Coins to a jeffCoin Address"
                                        log.Debug("WALLET:      I/F      " + s)
                                    
                                    
                                    Severity: Major
                                    Found in wallet/wallet-interface.go - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language