Fantom-foundation/go-lachesis

View on GitHub

Showing 291 of 829 total issues

File contract.go has 4348 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.

package sfc202

Severity: Major
Found in gossip/sfc202/contract.go - About 1 wk to fix

    File contract.go has 4028 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // Code generated - DO NOT EDIT.
    // This file is a generated binding and any manual changes will be lost.
    
    package sfc204
    
    
    Severity: Major
    Found in gossip/sfc204/contract.go - About 1 wk to fix

      File contract.go has 3746 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      // Code generated - DO NOT EDIT.
      // This file is a generated binding and any manual changes will be lost.
      
      package sfc110
      
      
      Severity: Major
      Found in gossip/sfc110/contract.go - About 1 wk to fix

        Function ExportState has a Cognitive Complexity of 207 (exceeds 20 allowed). Consider refactoring.
        Open

        func ExportState(path string, gdb *gossip.Store, cdb *poset.Store, net *lachesis.Config) (*genesisstore.Store, error) {
            _ = os.RemoveAll(path)
        
            err := os.MkdirAll(path, 0700)
            if err != nil {
        Severity: Minor
        Found in cmd/lachesis/opera_export_state.go - About 3 days 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 api.go has 1526 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // Copyright 2015 The go-ethereum Authors
        // This file is part of the go-ethereum library.
        //
        // The go-ethereum library is free software: you can redistribute it and/or modify
        // it under the terms of the GNU Lesser General Public License as published by
        Severity: Major
        Found in ethapi/api.go - About 3 days to fix

          Method Service.processSfc has a Cognitive Complexity of 145 (exceeds 20 allowed). Consider refactoring.
          Open

          func (s *Service) processSfc(block *inter.Block, receipts types.Receipts, blockFee *big.Int, sealEpoch bool, cheaters inter.Cheaters, statedb *state.StateDB) {
              // s.engineMu is locked here
          
              // process SFC contract logs
              epoch := s.engine.GetEpoch()
          Severity: Minor
          Found in gossip/sfc_index.go - About 2 days 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 ProtocolManager.handleMsg has a Cognitive Complexity of 127 (exceeds 20 allowed). Consider refactoring.
          Open

          func (pm *ProtocolManager) handleMsg(p *peer) error {
              // Read the next message from the remote peer, and ensure it's fully consumed
              msg, err := p.rw.ReadMsg()
              if err != nil {
                  return err
          Severity: Minor
          Found in gossip/handler.go - About 2 days 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 tx_pool.go has 1137 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          // Copyright 2015 The go-ethereum Authors
          // This file is part of the go-ethereum library.
          //
          // The go-ethereum library is free software: you can redistribute it and/or modify
          // it under the terms of the GNU Lesser General Public License as published by
          Severity: Major
          Found in evmcore/tx_pool.go - About 2 days to fix

            Function ExportState has 395 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func ExportState(path string, gdb *gossip.Store, cdb *poset.Store, net *lachesis.Config) (*genesisstore.Store, error) {
                _ = os.RemoveAll(path)
            
                err := os.MkdirAll(path, 0700)
                if err != nil {
            Severity: Major
            Found in cmd/lachesis/opera_export_state.go - About 1 day to fix

              ContractSession has 83 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type ContractSession struct {
                  Contract     *Contract         // Generic contract binding to set the session for
                  CallOpts     bind.CallOpts     // Call options to use throughout this session
                  TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
              }
              Severity: Major
              Found in gossip/sfc202/contract.go - About 1 day to fix

                Function ASCIIschemeForEach has a Cognitive Complexity of 93 (exceeds 20 allowed). Consider refactoring.
                Open

                func ASCIIschemeForEach(
                    scheme string,
                    callback ForEachEvent,
                ) (
                    nodes []idx.StakerID,
                Severity: Minor
                Found in inter/ascii_scheme.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

                ContractFilterer has 81 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type ContractFilterer struct {
                    contract *bind.BoundContract // Generic contract wrapper for the low level calls
                }
                Severity: Major
                Found in gossip/sfc202/contract.go - About 1 day to fix

                  ContractSession has 78 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type ContractSession struct {
                      Contract     *Contract         // Generic contract binding to set the session for
                      CallOpts     bind.CallOpts     // Call options to use throughout this session
                      TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
                  }
                  Severity: Major
                  Found in gossip/sfc204/contract.go - About 1 day to fix

                    ContractFilterer has 75 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type ContractFilterer struct {
                        contract *bind.BoundContract // Generic contract wrapper for the low level calls
                    }
                    Severity: Major
                    Found in gossip/sfc204/contract.go - About 1 day to fix

                      ContractSession has 71 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type ContractSession struct {
                          Contract     *Contract         // Generic contract binding to set the session for
                          CallOpts     bind.CallOpts     // Call options to use throughout this session
                          TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
                      }
                      Severity: Major
                      Found in gossip/sfc110/contract.go - About 1 day to fix

                        ContractFilterer has 69 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type ContractFilterer struct {
                            contract *bind.BoundContract // Generic contract wrapper for the low level calls
                        }
                        Severity: Major
                        Found in gossip/sfc110/contract.go - About 1 day to fix

                          Method Service.processSfc has 262 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (s *Service) processSfc(block *inter.Block, receipts types.Receipts, blockFee *big.Int, sealEpoch bool, cheaters inter.Cheaters, statedb *state.StateDB) {
                              // s.engineMu is locked here
                          
                              // process SFC contract logs
                              epoch := s.engine.GetEpoch()
                          Severity: Major
                          Found in gossip/sfc_index.go - About 1 day to fix

                            Method Fetcher.loop has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (f *Fetcher) loop() {
                                defer f.wg.Done()
                                // Iterate the event fetching until a quit is requested
                                fetchTimer := time.NewTimer(0)
                                defer fetchTimer.Stop()
                            Severity: Minor
                            Found in gossip/fetcher/fetcher.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

                            EthAPIBackend has 61 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            type EthAPIBackend struct {
                                extRPCEnabled bool
                                svc           *Service
                                state         *EvmStateReader
                                gpo           *gasprice.Oracle
                            Severity: Major
                            Found in gossip/ethapi_backend.go - About 1 day to fix

                              Method rows.Optimize has a Cognitive Complexity of 71 (exceeds 20 allowed). Consider refactoring.
                              Open

                              func (rr *rows) Optimize() {
                              
                                  for curr, row := range rr.rows {
                                  REFS:
                                      for iRef, ref := range row.Refs {
                              Severity: Minor
                              Found in inter/ascii_scheme.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

                              Severity
                              Category
                              Status
                              Source
                              Language