Showing 291 of 829 total issues
Method ProtocolManager.handleMsg
has 233 lines of code (exceeds 50 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
Method serverPool.eventLoop
has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring. Open
func (pool *serverPool) eventLoop() {
lookupCnt := 0
var convTime mclock.AbsTime
if pool.discSetPeriod != nil {
pool.discSetPeriod <- time.Millisecond * 100
- 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 handler.go
has 740 lines of code (exceeds 500 allowed). Consider refactoring. Open
package gossip
import (
"fmt"
"math"
Method Database.meter
has a Cognitive Complexity of 63 (exceeds 20 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)
- 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
ContractCaller
has 52 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
ContractCallerSession
has 52 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
ContractCaller
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
ContractCallerSession
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
Method FilterCriteria.UnmarshalJSON
has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring. Open
func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
type input struct {
BlockHash *common.Hash `json:"blockHash"`
FromBlock *rpc.BlockNumber `json:"fromBlock"`
ToBlock *rpc.BlockNumber `json:"toBlock"`
- 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
ContractCaller
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
ContractCallerSession
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
type ContractCallerSession struct {
Contract *ContractCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
File serverpool.go
has 678 lines of code (exceeds 500 allowed). Consider refactoring. Open
package gossip
import (
"crypto/ecdsa"
"fmt"
Method Index.fillEventVectors
has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring. Open
func (vi *Index) fillEventVectors(e *inter.EventHeaderData) allVecs {
meIdx := vi.validatorIdxs[e.Creator]
myVecs := allVecs{
beforeSeq: NewHighestBeforeSeq(len(vi.bi.BranchIDCreatorIdxs)),
beforeTime: NewHighestBeforeTime(len(vi.bi.BranchIDCreatorIdxs)),
- 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 emitter.go
has 643 lines of code (exceeds 500 allowed). Consider refactoring. Open
package gossip
import (
"fmt"
"math/big"
Method rows.String
has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring. Open
func (rr *rows) String() string {
var (
res strings.Builder
out = func(s string) {
_, err := res.WriteString(s)
- 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
TxPool
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
type TxPool struct {
config TxPoolConfig
chainconfig *params.ChainConfig
chain stateReader
gasPrice *big.Int
Function DAGtoASCIIscheme
has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring. Open
func DAGtoASCIIscheme(events Events) (string, error) {
events = events.ByParents()
var (
scheme rows
- 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 Election.ProcessRoot
has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring. Open
func (el *Election) ProcessRoot(newRoot RootAndSlot) (*Res, error) {
res, err := el.chooseAtropos()
if err != nil || res != nil {
return res, err
}
- 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
Function ASCIIschemeForEach
has 152 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ASCIIschemeForEach(
scheme string,
callback ForEachEvent,
) (
nodes []idx.StakerID,
Method iterator.Next
has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring. Open
func (it *iterator) Next() bool {
it.lock.Lock()
defer it.lock.Unlock()
if it.Error() != nil {
- 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"