Showing 291 of 829 total issues
Function init
has 138 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
overrideFlags()
overrideParams()
// Flags for testing purpose.
Method Database.meter
has 137 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (db *Database) meter(refresh time.Duration) {
// Create the counters to store current and previous compaction values
compactions := make([][]float64, 2)
for i := 0; i < 2; i++ {
compactions[i] = make([]float64, 4)
Function DoEstimateGas
has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring. Open
func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, gasCap uint64) (hexutil.Uint64, error) {
// Binary search the gas requirement, as it may be higher than the amount used
var (
lo uint64 = params.TxGas - 1
hi uint64
- 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
Method TxPool.truncatePending
has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring. Open
func (pool *TxPool) truncatePending() {
pending := uint64(0)
for _, list := range pool.pending {
pending += uint64(list.Len())
}
- 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
Method serverPool.eventLoop
has 121 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (pool *serverPool) eventLoop() {
lookupCnt := 0
var convTime mclock.AbsTime
if pool.discSetPeriod != nil {
pool.discSetPeriod <- time.Millisecond * 100
ContractTransactorSession
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
ContractTransactor
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
Function startNode
has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring. Open
func startNode(ctx *cli.Context, stack *node.Node) {
debug.Memsize.Add("node", stack)
// Start up the node itself
utils.StartNode(stack)
- 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
Method TxPool.reset
has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring. Open
func (pool *TxPool) reset(oldHead, newHead *EvmHeader) {
// If we're reorging an old state, reinject all dropped transactions
var reinject types.Transactions
if oldHead != nil && oldHead.Hash != newHead.ParentHash {
- 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
File ethapi_backend.go
has 570 lines of code (exceeds 500 allowed). Consider refactoring. Open
package gossip
import (
"context"
"errors"
File opera_export_state.go
has 557 lines of code (exceeds 500 allowed). Consider refactoring. Open
package main
import (
"bytes"
"context"
Method Fetcher.loop
has 105 lines of code (exceeds 50 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()
ContractTransactorSession
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
ContractTransactor
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
Function ForEachRandFork
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func ForEachRandFork(
nodes []idx.StakerID,
cheatersArr []idx.StakerID,
eventCount int,
parentCount int,
- 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
Method Emitter.createEvent
has 102 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (em *Emitter) createEvent(poolTxs map[common.Address]types.Transactions) *inter.Event {
if em.myStakerID == 0 {
// not a validator
return nil
}
ContractTransactorSession
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractTransactorSession struct {
Contract *ContractTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
ContractTransactor
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
peer
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
type peer struct {
id string
*p2p.Peer
rw p2p.MsgReadWriter
Method rows.String
has 87 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (rr *rows) String() string {
var (
res strings.Builder
out = func(s string) {
_, err := res.WriteString(s)