synapsecns/sanguine

View on GitHub
services/explorer/api/server.go

Summary

Maintainability
F
3 wks
Test Coverage

Function RehydrateCache has a Cognitive Complexity of 241 (exceeds 20 allowed). Consider refactoring.
Open

func RehydrateCache(parentCtx context.Context, client *gqlClient.Client, service cache.Service, handler metrics.Handler) (err error) {
    traceCtx, span := handler.Tracer().Start(parentCtx, "RehydrateCache")
    defer func() {
        metrics.EndSpanWithErr(span, err)
    }()
Severity: Minor
Found in services/explorer/api/server.go - About 4 days 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 RehydrateCache has 556 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func RehydrateCache(parentCtx context.Context, client *gqlClient.Client, service cache.Service, handler metrics.Handler) (err error) {
    traceCtx, span := handler.Tracer().Start(parentCtx, "RehydrateCache")
    defer func() {
        metrics.EndSpanWithErr(span, err)
    }()
Severity: Major
Found in services/explorer/api/server.go - About 2 days to fix

    Function RehydrateCache has 138 return statements (exceeds 4 allowed).
    Open

    func RehydrateCache(parentCtx context.Context, client *gqlClient.Client, service cache.Service, handler metrics.Handler) (err error) {
        traceCtx, span := handler.Tracer().Start(parentCtx, "RehydrateCache")
        defer func() {
            metrics.EndSpanWithErr(span, err)
        }()
    Severity: Major
    Found in services/explorer/api/server.go - About 1 day to fix

      File server.go has 847 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package api
      
      import (
          "context"
          "encoding/json"
      Severity: Major
      Found in services/explorer/api/server.go - About 1 day to fix

        Function createParsers has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
        Open

        func createParsers(ctx context.Context, db db.ConsumerDB, fetcher fetcherpkg.ScribeFetcher, clients map[uint32]etherClient.EVM, config serverConfig.Config) (*types.ServerParsers, *types.ServerRefs, map[string]*swap.SwapFlashLoanFilterer, error) {
            ethClient, err := ethclient.DialContext(ctx, config.RPCURL+fmt.Sprintf("%d", 1))
            if err != nil {
                return nil, nil, nil, fmt.Errorf("could not create client: %w", err)
            }
        Severity: Minor
        Found in services/explorer/api/server.go - About 4 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

        Function createParsers has 98 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func createParsers(ctx context.Context, db db.ConsumerDB, fetcher fetcherpkg.ScribeFetcher, clients map[uint32]etherClient.EVM, config serverConfig.Config) (*types.ServerParsers, *types.ServerRefs, map[string]*swap.SwapFlashLoanFilterer, error) {
            ethClient, err := ethclient.DialContext(ctx, config.RPCURL+fmt.Sprintf("%d", 1))
            if err != nil {
                return nil, nil, nil, fmt.Errorf("could not create client: %w", err)
            }
        Severity: Major
        Found in services/explorer/api/server.go - About 2 hrs to fix

          Function Start has 74 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func Start(ctx context.Context, cfg serverConfig.Config, handler metrics.Handler) error {
              router := ginhelper.New(logger)
              router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
          
              // initialize the database
          Severity: Minor
          Found in services/explorer/api/server.go - About 1 hr to fix

            Function Start has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
            Open

            func Start(ctx context.Context, cfg serverConfig.Config, handler metrics.Handler) error {
                router := ginhelper.New(logger)
                router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
            
                // initialize the database
            Severity: Minor
            Found in services/explorer/api/server.go - About 1 hr 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 createParsers has 16 return statements (exceeds 4 allowed).
            Open

            func createParsers(ctx context.Context, db db.ConsumerDB, fetcher fetcherpkg.ScribeFetcher, clients map[uint32]etherClient.EVM, config serverConfig.Config) (*types.ServerParsers, *types.ServerRefs, map[string]*swap.SwapFlashLoanFilterer, error) {
                ethClient, err := ethclient.DialContext(ctx, config.RPCURL+fmt.Sprintf("%d", 1))
                if err != nil {
                    return nil, nil, nil, fmt.Errorf("could not create client: %w", err)
                }
            Severity: Major
            Found in services/explorer/api/server.go - About 1 hr to fix

              Function Start has 10 return statements (exceeds 4 allowed).
              Open

              func Start(ctx context.Context, cfg serverConfig.Config, handler metrics.Handler) error {
                  router := ginhelper.New(logger)
                  router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
              
                  // initialize the database
              Severity: Major
              Found in services/explorer/api/server.go - About 1 hr to fix

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

                func createParsers(ctx context.Context, db db.ConsumerDB, fetcher fetcherpkg.ScribeFetcher, clients map[uint32]etherClient.EVM, config serverConfig.Config) (*types.ServerParsers, *types.ServerRefs, map[string]*swap.SwapFlashLoanFilterer, error) {
                Severity: Minor
                Found in services/explorer/api/server.go - About 35 mins to fix

                  Function registerObservableMetrics has 5 return statements (exceeds 4 allowed).
                  Open

                  func registerObservableMetrics(handler metrics.Handler, conn db.ConsumerDBReader) error {
                      meter := handler.Meter(meterName)
                      pendingGauge, err := meter.Int64ObservableGauge(pendingName)
                  
                      if err != nil {
                  Severity: Major
                  Found in services/explorer/api/server.go - About 35 mins to fix

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

                        g.Go(func() error {
                            dailyVolMonth, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &monthType, &allPlatformType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 518..552
                    services/explorer/api/server.go on lines 553..587
                    services/explorer/api/server.go on lines 589..623
                    services/explorer/api/server.go on lines 624..658
                    services/explorer/api/server.go on lines 659..693
                    services/explorer/api/server.go on lines 695..730
                    services/explorer/api/server.go on lines 731..765
                    services/explorer/api/server.go on lines 766..800

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

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

                        g.Go(func() error {
                            dailyVolAllTimeBridge, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &sixMonthType, &bridgeType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 483..517
                    services/explorer/api/server.go on lines 518..552
                    services/explorer/api/server.go on lines 553..587
                    services/explorer/api/server.go on lines 589..623
                    services/explorer/api/server.go on lines 624..658
                    services/explorer/api/server.go on lines 695..730
                    services/explorer/api/server.go on lines 731..765
                    services/explorer/api/server.go on lines 766..800

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

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

                        g.Go(func() error {
                            dailyVolYearSwap, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &threeMonthType, &swapType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 483..517
                    services/explorer/api/server.go on lines 518..552
                    services/explorer/api/server.go on lines 553..587
                    services/explorer/api/server.go on lines 589..623
                    services/explorer/api/server.go on lines 624..658
                    services/explorer/api/server.go on lines 659..693
                    services/explorer/api/server.go on lines 695..730
                    services/explorer/api/server.go on lines 766..800

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

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

                        g.Go(func() error {
                            dailyVolMonthBridge, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &monthType, &bridgeType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 483..517
                    services/explorer/api/server.go on lines 518..552
                    services/explorer/api/server.go on lines 553..587
                    services/explorer/api/server.go on lines 624..658
                    services/explorer/api/server.go on lines 659..693
                    services/explorer/api/server.go on lines 695..730
                    services/explorer/api/server.go on lines 731..765
                    services/explorer/api/server.go on lines 766..800

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

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

                        g.Go(func() error {
                            dailyVolMonthSwap, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &monthType, &swapType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 483..517
                    services/explorer/api/server.go on lines 518..552
                    services/explorer/api/server.go on lines 553..587
                    services/explorer/api/server.go on lines 589..623
                    services/explorer/api/server.go on lines 624..658
                    services/explorer/api/server.go on lines 659..693
                    services/explorer/api/server.go on lines 731..765
                    services/explorer/api/server.go on lines 766..800

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

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

                        g.Go(func() error {
                            dailyVolYear, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &threeMonthType, &allPlatformType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 483..517
                    services/explorer/api/server.go on lines 553..587
                    services/explorer/api/server.go on lines 589..623
                    services/explorer/api/server.go on lines 624..658
                    services/explorer/api/server.go on lines 659..693
                    services/explorer/api/server.go on lines 695..730
                    services/explorer/api/server.go on lines 731..765
                    services/explorer/api/server.go on lines 766..800

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

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

                        g.Go(func() error {
                            dailyVolYearBridge, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &threeMonthType, &bridgeType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 483..517
                    services/explorer/api/server.go on lines 518..552
                    services/explorer/api/server.go on lines 553..587
                    services/explorer/api/server.go on lines 589..623
                    services/explorer/api/server.go on lines 659..693
                    services/explorer/api/server.go on lines 695..730
                    services/explorer/api/server.go on lines 731..765
                    services/explorer/api/server.go on lines 766..800

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

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

                        g.Go(func() error {
                            dailyVolAllTimeSwap, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &sixMonthType, &swapType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 483..517
                    services/explorer/api/server.go on lines 518..552
                    services/explorer/api/server.go on lines 553..587
                    services/explorer/api/server.go on lines 589..623
                    services/explorer/api/server.go on lines 624..658
                    services/explorer/api/server.go on lines 659..693
                    services/explorer/api/server.go on lines 695..730
                    services/explorer/api/server.go on lines 731..765

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

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

                        g.Go(func() error {
                            statsVolSwap, err := client.GetAmountStatistic(ctx, totalVolumeType, &swapType, &allTimeType, nil, nil, nil, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 2 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 351..385
                    services/explorer/api/server.go on lines 386..420

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

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

                        g.Go(func() error {
                            statsVolAll, err := client.GetAmountStatistic(ctx, totalVolumeType, &allPlatformType, &allTimeType, nil, nil, nil, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 2 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 386..420
                    services/explorer/api/server.go on lines 421..455

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

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

                        g.Go(func() error {
                            statsVolBridge, err := client.GetAmountStatistic(ctx, totalVolumeType, &bridgeType, &allTimeType, nil, nil, nil, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 2 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 351..385
                    services/explorer/api/server.go on lines 421..455

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

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

                        g.Go(func() error {
                            dailyVolAllTime, err := client.GetDailyStatisticsByChain(ctx, nil, &volumeType, &sixMonthType, &allPlatformType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 8 other locations - About 5 hrs to fix
                    services/explorer/api/server.go on lines 483..517
                    services/explorer/api/server.go on lines 518..552
                    services/explorer/api/server.go on lines 589..623
                    services/explorer/api/server.go on lines 624..658
                    services/explorer/api/server.go on lines 659..693
                    services/explorer/api/server.go on lines 695..730
                    services/explorer/api/server.go on lines 731..765
                    services/explorer/api/server.go on lines 766..800

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

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

                        g.Go(func() error {
                            dailyFeeAllTimeMessageBus, err := client.GetDailyStatisticsByChain(ctx, nil, &feeType, &sixMonthType, &messagingType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 2 other locations - About 3 hrs to fix
                    services/explorer/api/server.go on lines 802..828
                    services/explorer/api/server.go on lines 829..855

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

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

                        g.Go(func() error {
                            dailyFeeYearMessageBus, err := client.GetDailyStatisticsByChain(ctx, nil, &feeType, &threeMonthType, &messagingType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 2 other locations - About 3 hrs to fix
                    services/explorer/api/server.go on lines 802..828
                    services/explorer/api/server.go on lines 856..882

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

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

                        g.Go(func() error {
                            dailyFeeMonthMessageBus, err := client.GetDailyStatisticsByChain(ctx, nil, &feeType, &monthType, &messagingType, &useMv)
                            if err != nil {
                                return fmt.Errorf("error rehydrating cache: %w", err)
                            }
                    Severity: Major
                    Found in services/explorer/api/server.go and 2 other locations - About 3 hrs to fix
                    services/explorer/api/server.go on lines 829..855
                    services/explorer/api/server.go on lines 856..882

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

                    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

                            if chain.Contracts.RFQ != "" {
                                rfqService, err := fetcherpkg.NewRFQFetcher(common.HexToAddress(chain.Contracts.RFQ), clients[chain.ChainID])
                                if err != nil {
                                    return nil, nil, nil, fmt.Errorf("could not create fast bridge fetcher: %w", err)
                                }
                    Severity: Major
                    Found in services/explorer/api/server.go and 1 other location - About 2 hrs to fix
                    services/explorer/api/server.go on lines 88..104

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

                    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

                            if chain.Contracts.CCTP != "" {
                                cctpService, err := fetcherpkg.NewCCTPFetcher(common.HexToAddress(chain.Contracts.CCTP), clients[chain.ChainID])
                                if err != nil {
                                    return nil, nil, nil, fmt.Errorf("could not create cctp fetcher: %w", err)
                                }
                    Severity: Major
                    Found in services/explorer/api/server.go and 1 other location - About 2 hrs to fix
                    services/explorer/api/server.go on lines 117..133

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

                    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