aergoio/aergo

View on GitHub
p2p/p2pmock/mock_txnotice.go

Summary

Maintainability
A
2 hrs
Test Coverage

Similar blocks of code found in 18 locations. Consider refactoring.
Open

func (mr *MockTxNoticeTracerMockRecorder) RegisterTxNotice(txIDs, cnt, alreadySent interface{}) *gomock.Call {
    mr.mock.ctrl.T.Helper()
    return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterTxNotice", reflect.TypeOf((*MockTxNoticeTracer)(nil).RegisterTxNotice), txIDs, cnt, alreadySent)
}
Severity: Major
Found in p2p/p2pmock/mock_txnotice.go and 17 other locations - About 45 mins to fix
p2p/p2pmock/mock_actorcontext.go on lines 190..193
p2p/p2pmock/mock_actorservice.go on lines 72..75
p2p/p2pmock/mock_actorservice.go on lines 101..104
p2p/p2pmock/mock_consensus.go on lines 188..191
p2p/p2pmock/mock_consensus.go on lines 227..230
p2p/p2pmock/mock_handshake.go on lines 139..142
p2p/p2pmock/mock_host.go on lines 220..223
p2p/p2pmock/mock_message.go on lines 374..377
p2p/p2pmock/mock_msgorder.go on lines 166..169
p2p/p2pmock/mock_msgorder.go on lines 180..183
p2p/p2pmock/mock_msgorder.go on lines 194..197
p2p/p2pmock/mock_networktransport.go on lines 396..399
p2p/p2pmock/mock_peerrole.go on lines 124..127
p2p/p2pmock/mock_remotepeer.go on lines 47..50
p2p/p2pmock/mock_syncmanager.go on lines 57..60
p2p/p2pmock/mock_syncmanager.go on lines 71..74
p2p/p2pmock/mock_syncmanager.go on lines 95..98

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 115.

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

Further Reading

Similar blocks of code found in 42 locations. Consider refactoring.
Open

func (mr *MockTxNoticeTracerMockRecorder) ReportSend(txIDs, peerID interface{}) *gomock.Call {
    mr.mock.ctrl.T.Helper()
    return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportSend", reflect.TypeOf((*MockTxNoticeTracer)(nil).ReportSend), txIDs, peerID)
}
Severity: Major
Found in p2p/p2pmock/mock_txnotice.go and 41 other locations - About 45 mins to fix
p2p/p2pmock/mock_actorcontext.go on lines 58..61
p2p/p2pmock/mock_actorcontext.go on lines 176..179
p2p/p2pmock/mock_actorcontext.go on lines 283..286
p2p/p2pmock/mock_actorcontext.go on lines 297..300
p2p/p2pmock/mock_actorcontext.go on lines 321..324
p2p/p2pmock/mock_actorservice.go on lines 45..48
p2p/p2pmock/mock_actorservice.go on lines 57..60
p2p/p2pmock/mock_actorservice.go on lines 87..90
p2p/p2pmock/mock_actorservice.go on lines 115..118
p2p/p2pmock/mock_consensus.go on lines 200..203
p2p/p2pmock/mock_handshake.go on lines 49..52
p2p/p2pmock/mock_handshake.go on lines 87..90
p2p/p2pmock/mock_host.go on lines 94..97
p2p/p2pmock/mock_host.go on lines 208..211
p2p/p2pmock/mock_listmanager.go on lines 71..74
p2p/p2pmock/mock_message.go on lines 242..245
p2p/p2pmock/mock_message.go on lines 254..257
p2p/p2pmock/mock_message.go on lines 278..281
p2p/p2pmock/mock_message.go on lines 325..328
p2p/p2pmock/mock_message.go on lines 362..365
p2p/p2pmock/mock_message.go on lines 425..428
p2p/p2pmock/mock_metricsman.go on lines 70..73
p2p/p2pmock/mock_metricsman.go on lines 84..87
p2p/p2pmock/mock_msgio.go on lines 121..124
p2p/p2pmock/mock_msgio.go on lines 133..136
p2p/p2pmock/mock_msgorder.go on lines 250..253
p2p/p2pmock/mock_networktransport.go on lines 118..121
p2p/p2pmock/mock_networktransport.go on lines 188..191
p2p/p2pmock/mock_networktransport.go on lines 384..387
p2p/p2pmock/mock_peermanager.go on lines 220..223
p2p/p2pmock/mock_peerrole.go on lines 68..71
p2p/p2pmock/mock_peerrole.go on lines 110..113
p2p/p2pmock/mock_peerrole.go on lines 138..141
p2p/p2pmock/mock_remotepeer.go on lines 192..195
p2p/p2pmock/mock_remotepeer.go on lines 284..287
p2p/p2pmock/mock_remotepeer.go on lines 337..340
p2p/p2pmock/mock_remotepeer.go on lines 363..366
p2p/p2pmock/mock_syncmanager.go on lines 45..48
p2p/p2pmock/mock_syncmanager.go on lines 83..86
p2p/p2pmock/mock_syncmanager.go on lines 119..122
p2p/p2pmock/mock_txnotice.go on lines 67..70

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 113.

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

Further Reading

Similar blocks of code found in 42 locations. Consider refactoring.
Open

func (mr *MockTxNoticeTracerMockRecorder) ReportNotSend(txIDs, cnt interface{}) *gomock.Call {
    mr.mock.ctrl.T.Helper()
    return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportNotSend", reflect.TypeOf((*MockTxNoticeTracer)(nil).ReportNotSend), txIDs, cnt)
}
Severity: Major
Found in p2p/p2pmock/mock_txnotice.go and 41 other locations - About 45 mins to fix
p2p/p2pmock/mock_actorcontext.go on lines 58..61
p2p/p2pmock/mock_actorcontext.go on lines 176..179
p2p/p2pmock/mock_actorcontext.go on lines 283..286
p2p/p2pmock/mock_actorcontext.go on lines 297..300
p2p/p2pmock/mock_actorcontext.go on lines 321..324
p2p/p2pmock/mock_actorservice.go on lines 45..48
p2p/p2pmock/mock_actorservice.go on lines 57..60
p2p/p2pmock/mock_actorservice.go on lines 87..90
p2p/p2pmock/mock_actorservice.go on lines 115..118
p2p/p2pmock/mock_consensus.go on lines 200..203
p2p/p2pmock/mock_handshake.go on lines 49..52
p2p/p2pmock/mock_handshake.go on lines 87..90
p2p/p2pmock/mock_host.go on lines 94..97
p2p/p2pmock/mock_host.go on lines 208..211
p2p/p2pmock/mock_listmanager.go on lines 71..74
p2p/p2pmock/mock_message.go on lines 242..245
p2p/p2pmock/mock_message.go on lines 254..257
p2p/p2pmock/mock_message.go on lines 278..281
p2p/p2pmock/mock_message.go on lines 325..328
p2p/p2pmock/mock_message.go on lines 362..365
p2p/p2pmock/mock_message.go on lines 425..428
p2p/p2pmock/mock_metricsman.go on lines 70..73
p2p/p2pmock/mock_metricsman.go on lines 84..87
p2p/p2pmock/mock_msgio.go on lines 121..124
p2p/p2pmock/mock_msgio.go on lines 133..136
p2p/p2pmock/mock_msgorder.go on lines 250..253
p2p/p2pmock/mock_networktransport.go on lines 118..121
p2p/p2pmock/mock_networktransport.go on lines 188..191
p2p/p2pmock/mock_networktransport.go on lines 384..387
p2p/p2pmock/mock_peermanager.go on lines 220..223
p2p/p2pmock/mock_peerrole.go on lines 68..71
p2p/p2pmock/mock_peerrole.go on lines 110..113
p2p/p2pmock/mock_peerrole.go on lines 138..141
p2p/p2pmock/mock_remotepeer.go on lines 192..195
p2p/p2pmock/mock_remotepeer.go on lines 284..287
p2p/p2pmock/mock_remotepeer.go on lines 337..340
p2p/p2pmock/mock_remotepeer.go on lines 363..366
p2p/p2pmock/mock_syncmanager.go on lines 45..48
p2p/p2pmock/mock_syncmanager.go on lines 83..86
p2p/p2pmock/mock_syncmanager.go on lines 119..122
p2p/p2pmock/mock_txnotice.go on lines 55..58

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 113.

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

Further Reading

There are no issues that match your filters.

Category
Status