synapsecns/sanguine

View on GitHub
services/scribe/testutil/typecast.go

Summary

Maintainability
A
40 mins
Test Coverage

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

func (d *DeployManager) GetTestContract(ctx context.Context, backend backends.SimulatedTestBackend) (contract contracts.DeployedContract, handle *testcontract.TestContractRef) {
    d.T().Helper()

    return manager.GetContract[*testcontract.TestContractRef](ctx, d.T(), d, backend, TestContractType)
}
Severity: Major
Found in services/scribe/testutil/typecast.go and 29 other locations - About 40 mins to fix
services/cctp-relayer/testutil/typecast.go on lines 17..21
services/cctp-relayer/testutil/typecast.go on lines 24..28
services/cctp-relayer/testutil/typecast.go on lines 31..35
services/cctp-relayer/testutil/typecast.go on lines 38..42
services/cctp-relayer/testutil/typecast.go on lines 45..49
services/explorer/testutil/testcontracts/typecast.go on lines 28..32
services/explorer/testutil/testcontracts/typecast.go on lines 35..39
services/explorer/testutil/testcontracts/typecast.go on lines 42..46
services/explorer/testutil/testcontracts/typecast.go on lines 49..53
services/explorer/testutil/testcontracts/typecast.go on lines 56..60
services/explorer/testutil/testcontracts/typecast.go on lines 63..67
services/explorer/testutil/testcontracts/typecast.go on lines 70..74
services/explorer/testutil/typecast.go on lines 20..24
services/explorer/testutil/typecast.go on lines 27..31
services/explorer/testutil/typecast.go on lines 34..38
services/explorer/testutil/typecast.go on lines 41..45
services/explorer/testutil/typecast.go on lines 48..52
services/explorer/testutil/typecast.go on lines 55..59
services/explorer/testutil/typecast.go on lines 62..66
services/explorer/testutil/typecast.go on lines 69..73
services/rfq/testutil/typecast.go on lines 19..23
services/rfq/testutil/typecast.go on lines 26..30
services/rfq/testutil/typecast.go on lines 33..37
services/rfq/testutil/typecast.go on lines 40..44
services/rfq/testutil/typecast.go on lines 47..51
services/rfq/testutil/typecast.go on lines 54..58
services/rfq/testutil/typecast.go on lines 61..65
agents/testutil/typecast.go on lines 199..203
ethergo/examples/contracttests/deploymanager.go on lines 26..30

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

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