synapsecns/sanguine

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

Summary

Maintainability
B
4 hrs
Test Coverage

Function EmitEvents has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
Open

func EmitEvents(ctx context.Context, t *testing.T, backend backends.SimulatedTestBackend, desiredBlockHeight uint64, testChainHandler *TestChainHandler) error {
    t.Helper()
    i := 0
    for {
        select {
Severity: Minor
Found in services/scribe/testutil/utils.go - About 55 mins to fix

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 PopulateChainsWithLogs has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

func PopulateChainsWithLogs(ctx context.Context, t *testing.T, chainBackends map[uint32]geth.Backend, desiredBlockHeight uint64, managers []*DeployManager, handler metrics.Handler) (map[uint32]*TestChainHandler, map[uint32][]backend.ScribeBackend, error) {
Severity: Minor
Found in services/scribe/testutil/utils.go - About 45 mins to fix

    Function PopulateChainsWithLogs has 6 return statements (exceeds 4 allowed).
    Open

    func PopulateChainsWithLogs(ctx context.Context, t *testing.T, chainBackends map[uint32]geth.Backend, desiredBlockHeight uint64, managers []*DeployManager, handler metrics.Handler) (map[uint32]*TestChainHandler, map[uint32][]backend.ScribeBackend, error) {
        t.Helper()
        addressChan := make(chan chainContractPair, len(chainBackends))
        scribeBackendChan := make(chan chainBackendPair, len(chainBackends))
        g, groupCtx := errgroup.WithContext(ctx)
    Severity: Major
    Found in services/scribe/testutil/utils.go - About 40 mins to fix

      Function EmitEvents has 6 return statements (exceeds 4 allowed).
      Open

      func EmitEvents(ctx context.Context, t *testing.T, backend backends.SimulatedTestBackend, desiredBlockHeight uint64, testChainHandler *TestChainHandler) error {
          t.Helper()
          i := 0
          for {
              select {
      Severity: Major
      Found in services/scribe/testutil/utils.go - About 40 mins to fix

        Function EmitEvents has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func EmitEvents(ctx context.Context, t *testing.T, backend backends.SimulatedTestBackend, desiredBlockHeight uint64, testChainHandler *TestChainHandler) error {
        Severity: Minor
        Found in services/scribe/testutil/utils.go - About 35 mins to fix

          Function PopulateWithLogs has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func PopulateWithLogs(ctx context.Context, t *testing.T, backend backends.SimulatedTestBackend, desiredBlockHeight uint64, managers []*DeployManager) (*TestChainHandler, error) {
          Severity: Minor
          Found in services/scribe/testutil/utils.go - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status