Showing 1,051 of 1,052 total issues
MockRemotePeerMockRecorder
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
type MockRemotePeerMockRecorder struct {
mock *MockRemotePeer
}
LiteContainerService
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
type LiteContainerService struct {
*component.BaseComponent
dummySetting p2pcommon.LocalSettings
chainID *types.ChainID
Function ExecuteEnterpriseTx
has 95 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ExecuteEnterpriseTx(bs *state.BlockState, ccc consensus.ChainConsensusCluster, scs *statedb.ContractState, txBody *types.TxBody,
sender, receiver *state.AccountState, blockNo types.BlockNo) ([]*types.Event, error) {
context, err := ValidateEnterpriseTx(txBody, sender, scs, blockNo)
if err != nil {
Method syncTxManager.handleTxReq
has 94 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (tm *syncTxManager) handleTxReq(remotePeer p2pcommon.RemotePeer, mID p2pcommon.MsgID, reqHashes [][]byte) {
// NOTE size estimation is tied to protobuf3 it should be changed when protobuf is changed.
// find transactions from chainservice
idx := 0
status := types.ResultStatus_OK
Function ValidateEnterpriseTx
has 31 return statements (exceeds 4 allowed). 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
Method SQLiteConn.RegisterAggregator
has 93 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *SQLiteConn) RegisterAggregator(name string, impl interface{}, pure bool) error {
var ai aggInfo
ai.constructor = reflect.ValueOf(impl)
t := ai.constructor.Type()
if t.Kind() != reflect.Func {
Function newExecutor
has 92 lines of code (exceeds 50 allowed). Consider refactoring. Open
func newExecutor(
contract []byte,
contractId []byte,
ctx *vmContext,
ci *types.CallInfo,
MockContextMockRecorder
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
type MockContextMockRecorder struct {
mock *MockContext
}
StateDB
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
type StateDB struct {
lock sync.RWMutex
Buffer *stateBuffer
Cache *storageCache
Trie *trie.Trie
Function luaCallContract
has 91 lines of code (exceeds 50 allowed). Consider refactoring. Open
func luaCallContract(L *LState, service C.int, contractId *C.char, fname *C.char, args *C.char,
amount *C.char, gas uint64) (C.int, *C.char) {
fnameStr := C.GoString(fname)
argsStr := C.GoString(args)
Function luaGovernance
has 90 lines of code (exceeds 50 allowed). Consider refactoring. Open
func luaGovernance(L *LState, service C.int, gType C.char, arg *C.char) *C.char {
ctx := contexts[service]
if ctx == nil {
return C.CString("[Contract.LuaGovernance] contract state not found")
Method HashFetcher.Start
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
func (hf *HashFetcher) Start() {
hf.waitGroup = &sync.WaitGroup{}
hf.waitGroup.Add(1)
hf.isRunning = true
- 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 ExecuteEnterpriseTx
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
func ExecuteEnterpriseTx(bs *state.BlockState, ccc consensus.ChainConsensusCluster, scs *statedb.ContractState, txBody *types.TxBody,
sender, receiver *state.AccountState, blockNo types.BlockNo) ([]*types.Event, error) {
context, err := ValidateEnterpriseTx(txBody, sender, scs, blockNo)
if err != 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
Function luaGetDB
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
func luaGetDB(L *LState, service C.int, key unsafe.Pointer, keyLen C.int, blkno *C.char) (*C.char, *C.char) {
ctx := contexts[service]
if ctx == nil {
return nil, C.CString("[System.LuaGetDB] contract state not found")
}
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ctx.traceFile != nil {
_, _ = ctx.traceFile.WriteString(fmt.Sprintf("[ret] : %s\n", ce.jsonRet))
_, _ = ctx.traceFile.WriteString(fmt.Sprintf("[usedFee] : %s\n", ctx.usedFee().String()))
events := ce.getEvents()
if events != nil {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 225.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ctx.traceFile != nil {
_, _ = ctx.traceFile.WriteString(fmt.Sprintf("[ret] : %s\n", ce.jsonRet))
_, _ = ctx.traceFile.WriteString(fmt.Sprintf("[usedFee] : %s\n", ctx.usedFee().String()))
events := ce.getEvents()
if events != nil {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 225.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File chaindb.go
has 523 lines of code (exceeds 500 allowed). Consider refactoring. Open
/**
* @file
* @copyright defined in aergo/LICENSE.txt
*/
Similar blocks of code found in 2 locations. Consider refactoring. Open
// Code generated by "stringer -type=OpSysTx"; DO NOT EDIT.
package types
import "strconv"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 222.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
// Code generated by "stringer -type=sysParamIndex"; DO NOT EDIT.
package system
import "strconv"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 222.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function ValidateSystemTx
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ValidateSystemTx(account []byte, txBody *types.TxBody, sender *state.AccountState,
scs *statedb.ContractState, blockInfo *types.BlockHeaderInfo) (*SystemContext, error) {
var ci types.CallInfo
if err := json.Unmarshal(txBody.Payload, &ci); err != nil {
return nil, types.ErrTxInvalidPayload