synapsecns/sanguine

View on GitHub
services/scribe/service/scribe_test.go

Summary

Maintainability
D
1 day
Test Coverage

Method ScribeSuite.TestLivefillParity has 223 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (s *ScribeSuite) TestLivefillParity() {
    if os.Getenv("CI") != "" {
        s.T().Skip("Network test flake")
    }
    const blockRange = uint64(100)
Severity: Major
Found in services/scribe/service/scribe_test.go - About 7 hrs to fix

    Method ScribeSuite.TestLivefillParity has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *ScribeSuite) TestLivefillParity() {
        if os.Getenv("CI") != "" {
            s.T().Skip("Network test flake")
        }
        const blockRange = uint64(100)
    Severity: Minor
    Found in services/scribe/service/scribe_test.go - About 2 hrs 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

    Method ScribeSuite.TestSimulatedScribe has 66 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (s *ScribeSuite) TestSimulatedScribe() {
        if os.Getenv("CI") != "" {
            s.T().Skip("Test flake: 20 sec of livefilling may fail on CI")
        }
        const numberOfContracts = 3
    Severity: Minor
    Found in services/scribe/service/scribe_test.go - About 1 hr to fix

      Function processBatch has 8 return statements (exceeds 4 allowed).
      Open

      func processBatch(ctx context.Context, client *http.Client, url string, txs *map[int64]string) (int, error) {
          req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
          if err != nil {
              return 0, fmt.Errorf("error getting data: %w", err)
          }
      Severity: Major
      Found in services/scribe/service/scribe_test.go - About 50 mins to fix

        Function getLogs has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func getLogs(ctx context.Context, contractAddress string, fromBlock uint64, toBlock uint64, apiURL string, txs *map[int64]string) (int, error) {
        Severity: Minor
        Found in services/scribe/service/scribe_test.go - About 45 mins to fix

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

          func getLogAmount(ctx context.Context, db db.EventDB, filter db.LogFilter, startBlock uint64, endBlock uint64) (int, []*types.Log, error) {
          Severity: Minor
          Found in services/scribe/service/scribe_test.go - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status