synapsecns/sanguine

View on GitHub
services/omnirpc/proxy/response_test.go

Summary

Maintainability
F
3 days
Test Coverage

ProxySuite has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

func (p *ProxySuite) captureResponse(backendURL string, makeReq func(client ethClient.EVMClient), checkResp func(req []rpc.Request, response proxy.JSONRPCMessage, rawResponse []byte)) {
    doneChan := make(chan bool)

    parsedURL, err := url.Parse(backendURL)
    Nil(p.T(), err)
Severity: Minor
Found in services/omnirpc/proxy/response_test.go - About 2 hrs to fix

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

    func (p *ProxySuite) TestBlockByNumber() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        latestNumber, err := backend.BlockNumber(p.GetTestContext())
        Nil(p.T(), err)
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 1 other location - About 4 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 350..374

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

    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 2 locations. Consider refactoring.
    Open

    func (p *ProxySuite) TestHeaderByNumber() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        latestNumber, err := backend.BlockNumber(p.GetTestContext())
        Nil(p.T(), err)
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 1 other location - About 4 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 323..347

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

    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 2 locations. Consider refactoring.
    Open

    func (p *ProxySuite) TestCodeAt() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
            _, err := client.CodeAt(p.GetTestContext(), common.Address{}, nil)
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 1 other location - About 2 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 173..185

    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

    Further Reading

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

    func (p *ProxySuite) TestNonceAt() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
            _, err := client.NonceAt(p.GetTestContext(), common.Address{}, nil)
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 1 other location - About 2 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 159..171

    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

    Further Reading

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

    func (p *ProxySuite) TestBlockNumber() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
            _, err := client.BlockNumber(p.GetTestContext())
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 4 other locations - About 2 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 131..143
    services/omnirpc/proxy/response_test.go on lines 207..219
    services/omnirpc/proxy/response_test.go on lines 221..233
    services/omnirpc/proxy/response_test.go on lines 268..280

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

    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 5 locations. Consider refactoring.
    Open

    func (p *ProxySuite) TestChainID() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
            _, err := client.ChainID(p.GetTestContext())
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 4 other locations - About 2 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 207..219
    services/omnirpc/proxy/response_test.go on lines 221..233
    services/omnirpc/proxy/response_test.go on lines 268..280
    services/omnirpc/proxy/response_test.go on lines 282..294

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

    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 5 locations. Consider refactoring.
    Open

    func (p *ProxySuite) TestMaxPriority() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
            _, err := client.SuggestGasTipCap(p.GetTestContext())
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 4 other locations - About 2 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 131..143
    services/omnirpc/proxy/response_test.go on lines 207..219
    services/omnirpc/proxy/response_test.go on lines 268..280
    services/omnirpc/proxy/response_test.go on lines 282..294

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

    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 5 locations. Consider refactoring.
    Open

    func (p *ProxySuite) TestPendingTransactionCount() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
            _, err := client.PendingTransactionCount(p.GetTestContext())
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 4 other locations - About 2 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 131..143
    services/omnirpc/proxy/response_test.go on lines 207..219
    services/omnirpc/proxy/response_test.go on lines 221..233
    services/omnirpc/proxy/response_test.go on lines 282..294

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

    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 5 locations. Consider refactoring.
    Open

    func (p *ProxySuite) TestGasPrice() {
        backend := geth.NewEmbeddedBackend(p.GetTestContext(), p.T())
    
        p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
            _, err := client.SuggestGasPrice(p.GetTestContext())
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 4 other locations - About 2 hrs to fix
    services/omnirpc/proxy/response_test.go on lines 131..143
    services/omnirpc/proxy/response_test.go on lines 221..233
    services/omnirpc/proxy/response_test.go on lines 268..280
    services/omnirpc/proxy/response_test.go on lines 282..294

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

    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 2 locations. Consider refactoring.
    Open

        for i := 0; i < respCount; i++ {
            i := i // capture func literal
            // TODO: we should probably test txes for this as well and mock some
            p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
                _, err := client.BlockByHash(p.GetTestContext(), latestBlock.Hash())
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 1 other location - About 1 hr to fix
    services/omnirpc/proxy/response_test.go on lines 483..493

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

    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 2 locations. Consider refactoring.
    Open

        for i := 0; i < respCount; i++ {
            i := i // capture func literal
            // TODO: we should probably test txes for this as well and mock some
            p.captureResponse(backend.HTTPEndpoint(), func(client ethClient.EVMClient) {
                _, err := client.TransactionReceipt(p.GetTestContext(), testTx.Hash())
    Severity: Major
    Found in services/omnirpc/proxy/response_test.go and 1 other location - About 1 hr to fix
    services/omnirpc/proxy/response_test.go on lines 306..316

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

    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