Showing 19 of 34 total issues
Function BroadcastThisNode
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func BroadcastThisNode() error {
s := "START BroadcastThisNode() - Broadcasts thisNode to the Network"
log.Debug("ROUTINGNODE: I/F " + s)
Function main
has 83 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func main() {
fmt.Printf("\nSTART...\n")
fmt.Printf("Press return to exit\n\n")
Function HandleRequest
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func HandleRequest(conn net.Conn) {
defer conn.Close()
rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
Function TransactionRequest
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Function RequestBlockchain
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Function RequestAddressBalance
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Function transactionRequestHandler
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func transactionRequestHandler(res http.ResponseWriter, req *http.Request) {
logReceivedAPICommand()
s := "START transactionRequestHandler() - GET: /transactionrequest/{destinationaddress}/{value}"
Function indexHandler
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func indexHandler(res http.ResponseWriter, req *http.Request) {
s := "----------------------------------------------------------------"
log.Info("WEBSERVER: " + s)
s = "HTTP SERVER - DISPLAY MAIN WEBPAGE"
Function RequestNodeList
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func RequestNodeList(networkIP string, networkTCPPort string) error {
s := "START RequestNodeList() - Requests the nodeList from a Network Node"
log.Debug("ROUTINGNODE: I/F " + s)
Method txRequestMessageSignedStruct.addTransactionToPendingBlock
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Function sendHandler
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func sendHandler(res http.ResponseWriter, req *http.Request) {
s := "----------------------------------------------------------------"
log.Info("WEBSERVER: " + s)
s = "HTTP SERVER - DISPLAY API COMMANDS"
Function validateHandler
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func validateHandler(res http.ResponseWriter, req *http.Request) {
s := "----------------------------------------------------------------"
log.Info("WEBSERVER: " + s)
s = "HTTP SERVER - DISPLAY VALIDATE"
Method txRequestMessageSignedStruct.processTxRequestMessage
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (trms txRequestMessageSignedStruct) processTxRequestMessage() string {
s := "START processTxRequestMessage() - Request to transfer jeffCoins to a jeffCoin Address"
log.Debug("TRANSACTION: " + s)
Function LoadTestDatatoBlockchain
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func LoadTestDatatoBlockchain() {
s := "START LoadTestDatatoBlockchain() - Load the blockchain with test data"
log.Debug("*** LOAD-TEST-DATA: " + s)
Function getAddressBalance
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func getAddressBalance(jeffCoinAddress string) (int64, []unspentOutputStruct) {
s := "START getAddressBalance() - Gets the jeffCoin Address balance"
log.Debug("BLOCKCHAIN: GUTS " + s)
- 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
Function BroadcastThisNode
has 6 return statements (exceeds 4 allowed). Open
Open
func BroadcastThisNode() error {
s := "START BroadcastThisNode() - Broadcasts thisNode to the Network"
log.Debug("ROUTINGNODE: I/F " + s)
Function RequestBlockchain
has 5 return statements (exceeds 4 allowed). Open
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)
Function RequestAddressBalance
has 5 return statements (exceeds 4 allowed). Open
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)
Function TransactionRequest
has 5 return statements (exceeds 4 allowed). Open
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)