aergoio/aergo

View on GitHub

Showing 1,051 of 1,052 total issues

Method WalDB.convertFromRaft has 10 return statements (exceeds 4 allowed).
Open

func (wal *WalDB) convertFromRaft(entries []raftpb.Entry) ([]*consensus.WalEntry, []*types.Block, []*raftpb.ConfChange) {
    lenEnts := len(entries)
    if lenEnts == 0 {
        return nil, nil, nil
    }
Severity: Major
Found in consensus/impl/raftv2/waldb.go - About 1 hr to fix

    Method v1Strategy.Decrypt has 10 return statements (exceeds 4 allowed).
    Open

    func (ks *v1Strategy) Decrypt(encrypted []byte, passphrase string) (*PrivateKey, error) {
        keyFormat := new(v1KeyStoreFormat)
        err := json.Unmarshal(encrypted, keyFormat)
        if nil != err {
            return nil, err
    Severity: Major
    Found in account/key/crypto/v1strategy.go - About 1 hr to fix

      Method AergoRPCService.GetReceipts has 10 return statements (exceeds 4 allowed).
      Open

      func (rpc *AergoRPCService) GetReceipts(ctx context.Context, in *types.ReceiptsParams) (*types.ReceiptsPaged, error) {
          if err := rpc.checkAuth(ctx, ReadBlockChain); err != nil {
              return nil, err
          }
      
      
      Severity: Major
      Found in rpc/grpcserver.go - About 1 hr to fix

        Method AergoRPCService.getChainInfo has 10 return statements (exceeds 4 allowed).
        Open

        func (rpc *AergoRPCService) getChainInfo(ctx context.Context) (*types.ChainInfo, error) {
            chainInfo := &types.ChainInfo{}
        
            if genesisInfo := rpc.actorHelper.GetChainAccessor().GetGenesisInfo(); genesisInfo != nil {
                ca := rpc.actorHelper.GetChainAccessor()
        Severity: Major
        Found in rpc/grpcserver.go - About 1 hr to fix

          Method Trie.merkleProof has 10 return statements (exceeds 4 allowed).
          Open

          func (s *Trie) merkleProof(root, key []byte, batch [][]byte, height, iBatch int) ([][]byte, bool, []byte, []byte, error) {
              if len(root) == 0 {
                  // proove that an empty subtree is on the path of the key
                  return nil, false, nil, nil, nil
              }
          Severity: Major
          Found in pkg/trie/trie_merkle_proof.go - About 1 hr to fix

            Function validateNameTx has 10 return statements (exceeds 4 allowed).
            Open

            func validateNameTx(tx *TxBody) error {
                var ci CallInfo
                if err := json.Unmarshal(tx.Payload, &ci); err != nil {
                    return ErrTxInvalidPayload
                }
            Severity: Major
            Found in types/transaction.go - About 1 hr to fix

              Function ValidateSystemTx has 10 return statements (exceeds 4 allowed).
              Open

              func ValidateSystemTx(tx *TxBody) error {
                  var ci CallInfo
                  if err := json.Unmarshal(tx.Payload, &ci); err != nil {
                      return ErrTxInvalidPayload
                  }
              Severity: Major
              Found in types/transaction.go - About 1 hr to fix

                Method SQLiteDriver.Open has 10 return statements (exceeds 4 allowed).
                Open

                func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
                    if C.sqlite3_threadsafe() == 0 {
                        return nil, errors.New("sqlite library was not compiled for thread-safe operation")
                    }
                
                
                Severity: Major
                Found in contract/sqlite3.go - About 1 hr to fix

                  Method BlockProcessor.isValidResponse has 10 return statements (exceeds 4 allowed).
                  Open

                  func (bproc *BlockProcessor) isValidResponse(msg interface{}) error {
                      validateBlockChunksRsp := func(msg *message.GetBlockChunksRsp) error {
                          var prev []byte
                          blocks := msg.Blocks
                  
                  
                  Severity: Major
                  Found in syncer/blockprocessor.go - About 1 hr to fix

                    Function luaDelegateCallContract has 10 return statements (exceeds 4 allowed).
                    Open

                    func luaDelegateCallContract(L *LState, service C.int, contractId *C.char,
                        fname *C.char, args *C.char, gas uint64) (C.int, *C.char) {
                        contractIdStr := C.GoString(contractId)
                        fnameStr := C.GoString(fname)
                        argsStr := C.GoString(args)
                    Severity: Major
                    Found in contract/vm_callback.go - About 1 hr to fix

                      Function luaGovernance has 10 return statements (exceeds 4 allowed).
                      Open

                      func luaGovernance(L *LState, service C.int, gType C.char, arg *C.char) *C.char {
                      
                          ctx := contexts[service]
                          if ctx == nil {
                              return C.CString("[Contract.LuaGovernance] contract state not found")
                      Severity: Major
                      Found in contract/vm_callback.go - About 1 hr to fix

                        Function ParseTxBody has 10 return statements (exceeds 4 allowed).
                        Open

                        func ParseTxBody(tb *InOutTxBody) (msg *types.TxBody, err error) {
                            if tb == nil {
                                return nil, errors.New("tx body is empty")
                            }
                            msg = &types.TxBody{}
                        Severity: Major
                        Found in types/jsonrpc/tx.go - About 1 hr to fix

                          Function verifyEthStorageProof has 10 return statements (exceeds 4 allowed).
                          Open

                          func verifyEthStorageProof(key []byte, value rlpObject, expectedHash []byte, proof [][]byte) bool {
                              if len(key) == 0 || value == nil || len(proof) == 0 {
                                  return false
                              }
                              key = []byte(hex.Encode(keccak256(key)))
                          Severity: Major
                          Found in contract/ethstorageproof.go - About 1 hr to fix

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

                            func ConvQueryContractState(msg *types.StateQueryProof) *InOutQueryContractState {
                                if msg == nil {
                                    return nil
                                }
                                qcs := &InOutQueryContractState{}
                            Severity: Minor
                            Found in types/jsonrpc/query.go and 1 other location - About 1 hr to fix
                            types/jsonrpc/governance.go on lines 11..23

                            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 129.

                            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

                                v.prepare(id, addr,
                                    func(lhs *big.Int) {
                                        if vprLogger.IsDebugEnabled() {
                                            vprLogger.Debug().
                                                Str("op", "add").
                            Severity: Minor
                            Found in contract/system/vprt.go and 1 other location - About 1 hr to fix
                            contract/system/vprt.go on lines 629..641

                            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 129.

                            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

                                v.prepare(id, addr,
                                    func(lhs *big.Int) {
                                        if vprLogger.IsDebugEnabled() {
                                            vprLogger.Debug().
                                                Str("op", "sub").
                            Severity: Minor
                            Found in contract/system/vprt.go and 1 other location - About 1 hr to fix
                            contract/system/vprt.go on lines 609..621

                            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 129.

                            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 ConvInOutAccountVoteInfo(msg *types.AccountVoteInfo) *InOutAccountVoteInfo {
                                if msg == nil {
                                    return nil
                                }
                            
                            
                            Severity: Minor
                            Found in types/jsonrpc/governance.go and 1 other location - About 1 hr to fix
                            types/jsonrpc/query.go on lines 40..53

                            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 129.

                            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 NewBlkNoticeDiscardHandler(pm p2pcommon.PeerManager, peer p2pcommon.RemotePeer, logger *log.Logger, actor p2pcommon.ActorService, sm p2pcommon.SyncManager) p2pcommon.MessageHandler {
                                bh := &raftNewBlkNoticeDiscardHandler{BaseMsgHandler: BaseMsgHandler{protocol: p2pcommon.NewBlockNotice, pm: pm, sm: sm, peer: peer, actor: actor, logger: logger}}
                                return bh
                            }
                            Severity: Minor
                            Found in p2p/subproto/raftstub.go and 1 other location - About 55 mins to fix
                            p2p/subproto/raftstub.go on lines 24..27

                            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 127.

                            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 DecodePrivKey(encodedKey string) ([]byte, error) {
                                decodedString, err := base58check.Decode(encodedKey)
                                if err != nil {
                                    return nil, err
                                }
                            Severity: Minor
                            Found in types/account.go and 1 other location - About 55 mins to fix
                            cmd/aergoluac/encoding/codeEncoding.go on lines 18..33

                            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 127.

                            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 DecodeCode(encodedCode string) ([]byte, error) {
                                decodedString, err := base58check.Decode(encodedCode)
                                if err != nil {
                                    return nil, err
                                }
                            Severity: Minor
                            Found in cmd/aergoluac/encoding/codeEncoding.go and 1 other location - About 55 mins to fix
                            types/account.go on lines 102..117

                            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 127.

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language