Showing 291 of 829 total issues
Function checkEventsFileHeader
has 5 return statements (exceeds 4 allowed). Open
func checkEventsFileHeader(reader io.Reader) error {
headerAndVersion := make([]byte, len(eventsFileHeader)+len(eventsFileVersion))
n, err := reader.Read(headerAndVersion)
if err != nil {
return err
Method Index.fetchSync
has 5 return statements (exceeds 4 allowed). Open
func (tt *Index) fetchSync(topics [][]common.Hash) (res []*types.Log, err error) {
if len(topics) > MaxCount {
err = ErrTooManyTopics
return
}
Method EthAPIBackend.GetFullEventID
has 5 return statements (exceeds 4 allowed). Open
func (b *EthAPIBackend) GetFullEventID(shortEventID string) (hash.Event, error) {
s := strings.Split(shortEventID, ":")
if len(s) == 1 {
// it's a full hash
return hash.HexToEventHash(shortEventID), nil
Method Emitter.createEvent
has a Cognitive Complexity of 22 (exceeds 20 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
}
- 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.isAllowedToEmit
has 5 return statements (exceeds 4 allowed). Open
func (em *Emitter) isAllowedToEmit(e *inter.Event, selfParent *inter.EventHeaderData) bool {
passedTime := e.ClaimedTime.Time().Sub(em.prevEmittedTime)
// Slow down emitting if power is low
{
threshold := em.config.NoTxsThreshold
Method Emitter.maxGasPowerToUse
has 5 return statements (exceeds 4 allowed). Open
func (em *Emitter) maxGasPowerToUse(e *inter.Event) uint64 {
// No txs in epoch tail, because tail events are unlikely to confirm
{
if em.isEpochTail(e) {
return 0
Method PublicFilterAPI.Logs
has 5 return statements (exceeds 4 allowed). Open
func (api *PublicFilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subscription, error) {
notifier, supported := rpc.NotifierFromContext(ctx)
if !supported {
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
}
Function lachesisOperaMigrationMain
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func lachesisOperaMigrationMain(ctx *cli.Context) error {
if args := ctx.Args(); len(args) > 0 {
return fmt.Errorf("invalid command: %q", args[0])
}
- 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.promoteExecutables
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Transaction {
// Track the promoted transactions to broadcast them at once
var promoted []*types.Transaction
// Iterate over all accounts and promote any executable transactions
- 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 Dir
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func Dir(src string, dst string) (err error) {
src = filepath.Clean(src)
dst = filepath.Clean(dst)
si, err := os.Stat(src)
- 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.addTxs
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (em *Emitter) addTxs(e *inter.Event, poolTxs map[common.Address]types.Transactions) *inter.Event {
if poolTxs == nil || len(poolTxs) == 0 {
return e
}
- 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"