Showing 1,051 of 1,052 total issues
Function GetDebuggerCode
has 916 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetDebuggerCode() *C.char {
return C.CString(`
package.preload['__debugger'] = function()
File grpcserver.go
has 1174 lines of code (exceeds 500 allowed). Consider refactoring. Open
/**
* @file
* @copyright defined in aergo/LICENSE.txt
*/
File vm_callback.go
has 1172 lines of code (exceeds 500 allowed). Consider refactoring. Open
package contract
/*
#cgo CFLAGS: -I${SRCDIR}/../libtool/include/luajit-2.1
#cgo LDFLAGS: ${SRCDIR}/../libtool/lib/libluajit-5.1.a -lm
File hook_dbg.go
has 1161 lines of code (exceeds 500 allowed). Consider refactoring. Open
//go:build Debug
// +build Debug
package contract
File raftserver.go
has 1151 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
File vm.go
has 1085 lines of code (exceeds 500 allowed). Consider refactoring. Open
/**
* @file
* @copyright defined in aergo/LICENSE.txt
*/
File v1.go
has 1065 lines of code (exceeds 500 allowed). Consider refactoring. Open
package web3
import (
"bytes"
"crypto/sha256"
File chainhandle.go
has 958 lines of code (exceeds 500 allowed). Consider refactoring. Open
/**
* @file
* @copyright defined in aergo/LICENSE.txt
*/
File sqlite3.go
has 953 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
// Copyright (C) 2018 G.J.R. Timmer <gjr.timmer@gmail.com>.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
File mempool.go
has 898 lines of code (exceeds 500 allowed). Consider refactoring. Open
/**
* @file
* @copyright defined in aergo/LICENSE.txt
*/
Function ValidateEnterpriseTx
has a Cognitive Complexity of 87 (exceeds 20 allowed). Consider refactoring. Open
func ValidateEnterpriseTx(tx *types.TxBody, sender *state.AccountState,
scs *statedb.ContractState, blockNo types.BlockNo) (*EnterpriseContext, error) {
var ci types.CallInfo
if err := json.Unmarshal(tx.Payload, &ci); err != nil {
return nil, 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
File chainservice.go
has 836 lines of code (exceeds 500 allowed). Consider refactoring. Open
/**
* @file
* @copyright defined in aergo/LICENSE.txt
*/
File cluster.go
has 830 lines of code (exceeds 500 allowed). Consider refactoring. Open
package raftv2
import (
"bytes"
"context"
File receipt.go
has 816 lines of code (exceeds 500 allowed). Consider refactoring. Open
package types
import (
"bytes"
"encoding/binary"
Function executeTx
has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring. Open
func executeTx(
execCtx context.Context,
ccc consensus.ChainConsensusCluster,
cdb contract.ChainAccessor,
bs *state.BlockState,
- 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 MemPool.validateTx
has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring. Open
func (mp *MemPool) validateTx(tx types.Transaction, account types.Address) error {
if !mp.whitelist.Check(types.EncodeAddress(account)) {
return types.ErrTxNotAllowedAccount
}
ns, err := mp.getAccountState(account)
- 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
AergoRPCService
has 55 methods (exceeds 20 allowed). Consider refactoring. Open
type AergoRPCService struct {
hub *component.ComponentHub
actorHelper p2pcommon.ActorService
consensusAccessor consensus.ConsensusAccessor //TODO refactor with actorHelper
msgHelper message.Helper
Method ChainWorker.Receive
has 219 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (cw *ChainWorker) Receive(context actor.Context) {
var sdb *statedb.StateDB
getAccProof := func(sdb *statedb.StateDB, account, root []byte, compressed bool) (*types.AccountProof, error) {
address, err := getAddressNameResolved(sdb, account)
raftServer
has 53 methods (exceeds 20 allowed). Consider refactoring. Open
type raftServer struct {
*component.ComponentHub
sync.RWMutex
pa p2pcommon.PeerAccessor
Method RPC.Receive
has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring. Open
func (ns *RPC) Receive(context actor.Context) {
switch msg := context.Message().(type) {
case *types.Block:
server := ns.actualServer
server.BroadcastToListBlockStream(msg)
- 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"