aergoio/aergo

View on GitHub

Showing 1,051 of 1,052 total issues

Function GetDebuggerCode has 916 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func GetDebuggerCode() *C.char {

    return C.CString(`
    package.preload['__debugger'] = function()

Severity: Major
Found in contract/hook_dbg.go - About 4 days to fix

    File grpcserver.go has 1174 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    /**
     *  @file
     *  @copyright defined in aergo/LICENSE.txt
     */
    
    
    Severity: Major
    Found in rpc/grpcserver.go - About 2 days to fix

      File vm_callback.go has 1172 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package contract
      
      /*
      #cgo CFLAGS: -I${SRCDIR}/../libtool/include/luajit-2.1
      #cgo LDFLAGS: ${SRCDIR}/../libtool/lib/libluajit-5.1.a -lm
      Severity: Major
      Found in contract/vm_callback.go - About 2 days to fix

        File hook_dbg.go has 1161 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        //go:build Debug
        // +build Debug
        
        package contract
        
        
        Severity: Major
        Found in contract/hook_dbg.go - About 2 days to fix

          File raftserver.go has 1151 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          // Copyright 2015 The etcd Authors
          //
          // Licensed under the Apache License, Version 2.0 (the "License");
          // you may not use this file except in compliance with the License.
          // You may obtain a copy of the License at
          Severity: Major
          Found in consensus/impl/raftv2/raftserver.go - About 2 days to fix

            File vm.go has 1085 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            /**
             *  @file
             *  @copyright defined in aergo/LICENSE.txt
             */
            
            
            Severity: Major
            Found in contract/vm.go - About 2 days to fix

              File v1.go has 1065 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              package web3
              
              import (
                  "bytes"
                  "crypto/sha256"
              Severity: Major
              Found in rpc/web3/v1.go - About 1 day to fix

                File chainhandle.go has 958 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                /**
                 *  @file
                 *  @copyright defined in aergo/LICENSE.txt
                 */
                
                
                Severity: Major
                Found in chain/chainhandle.go - About 1 day to fix

                  File sqlite3.go has 953 lines of code (exceeds 500 allowed). Consider refactoring.
                  Open

                  // Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
                  // Copyright (C) 2018 G.J.R. Timmer <gjr.timmer@gmail.com>.
                  //
                  // Use of this source code is governed by an MIT-style
                  // license that can be found in the LICENSE file.
                  Severity: Major
                  Found in contract/sqlite3.go - About 1 day to fix

                    File mempool.go has 898 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    /**
                     *  @file
                     *  @copyright defined in aergo/LICENSE.txt
                     */
                    
                    
                    Severity: Major
                    Found in mempool/mempool.go - About 1 day to fix

                      Function ValidateEnterpriseTx has a Cognitive Complexity of 87 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func ValidateEnterpriseTx(tx *types.TxBody, sender *state.AccountState,
                          scs *statedb.ContractState, blockNo types.BlockNo) (*EnterpriseContext, error) {
                          var ci types.CallInfo
                          if err := json.Unmarshal(tx.Payload, &ci); err != nil {
                              return nil, err
                      Severity: Minor
                      Found in contract/enterprise/validate.go - About 1 day 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

                      File chainservice.go has 836 lines of code (exceeds 500 allowed). Consider refactoring.
                      Open

                      /**
                       *  @file
                       *  @copyright defined in aergo/LICENSE.txt
                       */
                      
                      
                      Severity: Major
                      Found in chain/chainservice.go - About 1 day to fix

                        File cluster.go has 830 lines of code (exceeds 500 allowed). Consider refactoring.
                        Open

                        package raftv2
                        
                        import (
                            "bytes"
                            "context"
                        Severity: Major
                        Found in consensus/impl/raftv2/cluster.go - About 1 day to fix

                          File receipt.go has 816 lines of code (exceeds 500 allowed). Consider refactoring.
                          Open

                          package types
                          
                          import (
                              "bytes"
                              "encoding/binary"
                          Severity: Major
                          Found in types/receipt.go - About 1 day to fix

                            Function executeTx has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func executeTx(
                                execCtx context.Context,
                                ccc consensus.ChainConsensusCluster,
                                cdb contract.ChainAccessor,
                                bs *state.BlockState,
                            Severity: Minor
                            Found in contract/vm_direct/vm_direct.go - About 1 day 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 MemPool.validateTx has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (mp *MemPool) validateTx(tx types.Transaction, account types.Address) error {
                                if !mp.whitelist.Check(types.EncodeAddress(account)) {
                                    return types.ErrTxNotAllowedAccount
                                }
                                ns, err := mp.getAccountState(account)
                            Severity: Minor
                            Found in mempool/mempool.go - About 1 day 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

                            AergoRPCService has 55 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            type AergoRPCService struct {
                                hub               *component.ComponentHub
                                actorHelper       p2pcommon.ActorService
                                consensusAccessor consensus.ConsensusAccessor //TODO refactor with actorHelper
                                msgHelper         message.Helper
                            Severity: Major
                            Found in rpc/grpcserver.go - About 7 hrs to fix

                              Method ChainWorker.Receive has 219 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (cw *ChainWorker) Receive(context actor.Context) {
                                  var sdb *statedb.StateDB
                              
                                  getAccProof := func(sdb *statedb.StateDB, account, root []byte, compressed bool) (*types.AccountProof, error) {
                                      address, err := getAddressNameResolved(sdb, account)
                              Severity: Major
                              Found in chain/chainservice.go - About 7 hrs to fix

                                raftServer has 53 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                type raftServer struct {
                                    *component.ComponentHub
                                    sync.RWMutex
                                
                                    pa p2pcommon.PeerAccessor
                                Severity: Major
                                Found in consensus/impl/raftv2/raftserver.go - About 7 hrs to fix

                                  Method RPC.Receive has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  func (ns *RPC) Receive(context actor.Context) {
                                      switch msg := context.Message().(type) {
                                      case *types.Block:
                                          server := ns.actualServer
                                          server.BroadcastToListBlockStream(msg)
                                  Severity: Minor
                                  Found in rpc/rpc.go - About 7 hrs 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language