aergoio/aergo

View on GitHub

Showing 1,051 of 1,052 total issues

Method recoveryEntry.recovery has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
Open

func (re *recoveryEntry) recovery(bs *state.BlockState) error {
    var zero big.Int
    cs := re.callState
    if re.amount.Cmp(&zero) > 0 {
        if re.senderState != nil {
Severity: Minor
Found in contract/vm_state.go - About 1 hr 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 luaCallContract has 13 return statements (exceeds 4 allowed).
Open

func luaCallContract(L *LState, service C.int, contractId *C.char, fname *C.char, args *C.char,
    amount *C.char, gas uint64) (C.int, *C.char) {
    fnameStr := C.GoString(fname)
    argsStr := C.GoString(args)

Severity: Major
Found in contract/vm_callback.go - About 1 hr to fix

    Method SQLiteStmt.bind has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *SQLiteStmt) bind(args []namedValue) error {
        rv := C.sqlite3_reset(s.s)
        if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE {
            return s.c.lastError()
        }
    Severity: Minor
    Found in contract/sqlite3.go - About 1 hr 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.removeOnBlockArrival has 56 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (mp *MemPool) removeOnBlockArrival(block *types.Block) error {
        var ag [2]time.Duration
        start := time.Now()
        mp.Lock()
        defer mp.Unlock()
    Severity: Minor
    Found in mempool/mempool.go - About 1 hr to fix

      Method Trie.maybeDeleteSubTree has 56 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (s *Trie) maybeDeleteSubTree(original, maybeDelete []byte, height, iBatch int, batch, batch2 [][]byte, ch chan<- (error)) {
          if height == 0 {
              if !bytes.Equal(original, maybeDelete) && len(maybeDelete) != 0 {
                  s.maybeDeleteRevertedNode(maybeDelete, 0)
              }
      Severity: Minor
      Found in pkg/trie/trie_revert.go - About 1 hr to fix

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

            if len(conf.NetProtocolAddr) != 0 {
                ipAddress, err = network.GetSingleIPAddress(protocolAddr)
                if err != nil {
                    panic("Invalid protocol address " + protocolAddr + " : " + err.Error())
                }
        Severity: Major
        Found in cmd/polaris/server/litentcontainer.go and 1 other location - About 1 hr to fix
        p2p/pi.go on lines 30..45

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

        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 (c *delb) Run(args string) (string, uint64, []*types.Event, error) {
            line, contractIDHex, _ := c.parse(args)
        
            err := contract.DelBreakPoint(contractIDHex, line)
            if err != nil {
        Severity: Major
        Found in cmd/brick/exec/debug.go and 1 other location - About 1 hr to fix
        cmd/brick/exec/debug.go on lines 72..85

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

        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 (c *setb) Run(args string) (string, uint64, []*types.Event, error) {
            line, contractIDHex, _ := c.parse(args)
        
            err := contract.SetBreakPoint(contractIDHex, line)
            if err != nil {
        Severity: Major
        Found in cmd/brick/exec/debug.go and 1 other location - About 1 hr to fix
        cmd/brick/exec/debug.go on lines 130..143

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

        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

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

            if len(conf.NetProtocolAddr) != 0 {
                ipAddress, err = network.GetSingleIPAddress(protocolAddr)
                if err != nil {
                    panic("Invalid protocol address " + protocolAddr + " : " + err.Error())
                }
        Severity: Major
        Found in p2p/pi.go and 1 other location - About 1 hr to fix
        cmd/polaris/server/litentcontainer.go on lines 221..236

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

        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

        Method PeerMapService.handleQuery has 55 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (pms *PeerMapService) handleQuery(conn p2pcommon.RemoteConn, container p2pcommon.Message, query *types.MapQuery) (*types.MapResponse, error) {
            if query.Status == nil {
                return nil, fmt.Errorf("malformed query %v", query)
            }
            receivedMeta := p2pcommon.NewMetaFromStatus(query.Status)
        Severity: Minor
        Found in cmd/polaris/server/mapservice.go - About 1 hr to fix

          Method ChainService.Receive has 55 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (cs *ChainService) Receive(context actor.Context) {
              if !cs.isRecovered() {
                  err := cs.Recover()
                  if err != nil {
                      logger.Fatal().Err(err).Msg("CHAIN DATA IS CRASHED, BUT CAN'T BE RECOVERED")
          Severity: Minor
          Found in chain/chainservice.go - About 1 hr to fix

            Method Web3APIv1.ListBlockHeaders has 55 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (api *Web3APIv1) ListBlockHeaders() (handler http.Handler, ok bool) {
                values, err := url.ParseQuery(api.request.URL.RawQuery)
                if err != nil {
                    return commonResponseHandler(&types.Empty{}, err), true
                }
            Severity: Minor
            Found in rpc/web3/v1.go - About 1 hr to fix

              Method Web3APIv1.GetVotes has 55 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (api *Web3APIv1) GetVotes() (handler http.Handler, ok bool) {
                  values, err := url.ParseQuery(api.request.URL.RawQuery)
                  if err != nil {
                      return commonResponseHandler(&types.Empty{}, err), true
                  }
              Severity: Minor
              Found in rpc/web3/v1.go - About 1 hr to fix

                Method AergoRPCService.SendTX has 12 return statements (exceeds 4 allowed).
                Open

                func (rpc *AergoRPCService) SendTX(ctx context.Context, tx *types.Tx) (*types.CommitResult, error) {
                    if err := rpc.checkAuth(ctx, WriteBlockChain); err != nil {
                        return nil, err
                    }
                    if tx.Body.Nonce == 0 {
                Severity: Major
                Found in rpc/grpcserver.go - About 1 hr to fix

                  Function Execute has 12 return statements (exceeds 4 allowed).
                  Open

                  func Execute(execCtx context.Context, bs *state.BlockState, cdb ChainAccessor, tx *types.Tx, sender, receiver *state.AccountState, bi *types.BlockHeaderInfo, executionMode int, isFeeDelegation bool) (rv string, events []*types.Event, usedFee *big.Int, err error) {
                  
                      var (
                          txBody     = tx.GetBody()
                          txType     = txBody.GetType()
                  Severity: Major
                  Found in contract/contract.go - About 1 hr to fix

                    Function luaGetDB has 12 return statements (exceeds 4 allowed).
                    Open

                    func luaGetDB(L *LState, service C.int, key unsafe.Pointer, keyLen C.int, blkno *C.char) (*C.char, *C.char) {
                        ctx := contexts[service]
                        if ctx == nil {
                            return nil, C.CString("[System.LuaGetDB] contract state not found")
                        }
                    Severity: Major
                    Found in contract/vm_callback.go - About 1 hr to fix

                      Function ExecuteEnterpriseTx has 12 return statements (exceeds 4 allowed).
                      Open

                      func ExecuteEnterpriseTx(bs *state.BlockState, ccc consensus.ChainConsensusCluster, scs *statedb.ContractState, txBody *types.TxBody,
                          sender, receiver *state.AccountState, blockNo types.BlockNo) ([]*types.Event, error) {
                      
                          context, err := ValidateEnterpriseTx(txBody, sender, scs, blockNo)
                          if err != nil {
                      Severity: Major
                      Found in contract/enterprise/execute.go - About 1 hr to fix

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

                        func (mr *MockAergoRPCServiceClientMockRecorder) ExportAccount(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
                            mr.mock.ctrl.T.Helper()
                            varargs := append([]interface{}{arg0, arg1}, arg2...)
                            return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportAccount", reflect.TypeOf((*MockAergoRPCServiceClient)(nil).ExportAccount), varargs...)
                        }
                        Severity: Major
                        Found in cmd/aergocli/cmd/mock_types/mock_types.go and 45 other locations - About 1 hr to fix
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 53..57
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 73..77
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 93..97
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 113..117
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 133..137
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 173..177
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 193..197
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 213..217
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 233..237
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 253..257
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 273..277
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 293..297
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 313..317
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 333..337
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 353..357
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 373..377
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 393..397
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 413..417
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 433..437
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 453..457
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 473..477
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 493..497
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 513..517
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 533..537
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 553..557
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 573..577
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 593..597
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 613..617
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 633..637
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 653..657
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 673..677
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 693..697
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 713..717
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 733..737
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 753..757
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 773..777
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 793..797
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 813..817
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 833..837
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 853..857
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 873..877
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 893..897
                        p2p/p2pmock/mock_host.go on lines 169..173
                        p2p/p2pmock/mock_networktransport.go on lines 269..273
                        p2p/p2pmock/mock_networktransport.go on lines 331..335

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

                        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 46 locations. Consider refactoring.
                        Open

                        func (mr *MockAergoRPCServiceClientMockRecorder) ImportAccount(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
                            mr.mock.ctrl.T.Helper()
                            varargs := append([]interface{}{arg0, arg1}, arg2...)
                            return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportAccount", reflect.TypeOf((*MockAergoRPCServiceClient)(nil).ImportAccount), varargs...)
                        }
                        Severity: Major
                        Found in cmd/aergocli/cmd/mock_types/mock_types.go and 45 other locations - About 1 hr to fix
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 53..57
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 73..77
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 93..97
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 113..117
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 133..137
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 153..157
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 173..177
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 193..197
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 213..217
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 233..237
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 253..257
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 273..277
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 293..297
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 313..317
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 333..337
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 353..357
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 373..377
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 393..397
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 413..417
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 433..437
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 453..457
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 473..477
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 493..497
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 513..517
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 533..537
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 553..557
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 573..577
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 613..617
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 633..637
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 653..657
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 673..677
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 693..697
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 713..717
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 733..737
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 753..757
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 773..777
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 793..797
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 813..817
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 833..837
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 853..857
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 873..877
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 893..897
                        p2p/p2pmock/mock_host.go on lines 169..173
                        p2p/p2pmock/mock_networktransport.go on lines 269..273
                        p2p/p2pmock/mock_networktransport.go on lines 331..335

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

                        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 46 locations. Consider refactoring.
                        Open

                        func (mr *MockAergoRPCServiceClientMockRecorder) GetPeers(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
                            mr.mock.ctrl.T.Helper()
                            varargs := append([]interface{}{arg0, arg1}, arg2...)
                            return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPeers", reflect.TypeOf((*MockAergoRPCServiceClient)(nil).GetPeers), varargs...)
                        }
                        Severity: Major
                        Found in cmd/aergocli/cmd/mock_types/mock_types.go and 45 other locations - About 1 hr to fix
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 53..57
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 73..77
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 93..97
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 113..117
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 133..137
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 153..157
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 173..177
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 193..197
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 213..217
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 233..237
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 253..257
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 273..277
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 293..297
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 313..317
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 333..337
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 353..357
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 373..377
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 393..397
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 413..417
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 453..457
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 473..477
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 493..497
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 513..517
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 533..537
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 553..557
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 573..577
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 593..597
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 613..617
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 633..637
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 653..657
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 673..677
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 693..697
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 713..717
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 733..737
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 753..757
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 773..777
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 793..797
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 813..817
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 833..837
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 853..857
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 873..877
                        cmd/aergocli/cmd/mock_types/mock_types.go on lines 893..897
                        p2p/p2pmock/mock_host.go on lines 169..173
                        p2p/p2pmock/mock_networktransport.go on lines 269..273
                        p2p/p2pmock/mock_networktransport.go on lines 331..335

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

                        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