synapsecns/sanguine

View on GitHub
services/explorer/graphql/server/graph/queryutils.go

Summary

Maintainability
F
1 wk
Test Coverage

File queryutils.go has 1500 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package graph

import (
    "context"
    "fmt"
Severity: Major
Found in services/explorer/graphql/server/graph/queryutils.go - About 3 days to fix

    Function GetPartialInfoFromBridgeEventHybrid has 110 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func GetPartialInfoFromBridgeEventHybrid(bridgeEvent sql.HybridBridgeEvent, includePending *bool) (*model.BridgeTransaction, error) {
        if includePending != nil && *includePending && bridgeEvent.TTxHash != "" {
            // nolint:nilnil
            return nil, nil
        }
    Severity: Major
    Found in services/explorer/graphql/server/graph/queryutils.go - About 3 hrs to fix

      Method queryResolver.GetBridgeTxsFromOrigin has 20 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (r *queryResolver) GetBridgeTxsFromOrigin(ctx context.Context, useMv *bool, chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, tokenAddressTo []*string, tokenAddressFrom []*string, kappa *string, pending *bool, onlyCctp *bool, page *int, latest bool) ([]*model.BridgeTransaction, error) {
      Severity: Major
      Found in services/explorer/graphql/server/graph/queryutils.go - About 2 hrs to fix

        Method queryResolver.GetBridgeTxsFromDestination has 19 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (r *queryResolver) GetBridgeTxsFromDestination(ctx context.Context, useMv *bool, chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, kappa *string, tokenAddressFrom []*string, tokenAddressTo []*string, onlyCctp *bool, page *int, pending *bool) ([]*model.BridgeTransaction, error) {
        Severity: Major
        Found in services/explorer/graphql/server/graph/queryutils.go - About 2 hrs to fix

          Method queryResolver.GetBridgeTxs has 18 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (r *queryResolver) GetBridgeTxs(ctx context.Context, chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, tokenAddressTo []*string, tokenAddressFrom []*string, kappa *string, pending *bool, onlyCctp *bool, page *int) ([]*model.BridgeTransaction, error) {
          Severity: Major
          Found in services/explorer/graphql/server/graph/queryutils.go - About 2 hrs to fix

            Function generateAllBridgeEventsQueryFromDestination has 17 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func generateAllBridgeEventsQueryFromDestination(chainIDTo []*int, chainIDFrom []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, tokenAddressFrom []*string, tokenAddressTo []*string, kappa *string, txHash *string, onlyCctp *bool, page int, in bool) string {
            Severity: Major
            Found in services/explorer/graphql/server/graph/queryutils.go - About 2 hrs to fix

              Function generateAllBridgeEventsQueryMv has 17 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func generateAllBridgeEventsQueryMv(chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, tokenAddressFrom []*string, tokenAddressTo []*string, txHash *string, kappa *string, pending *bool, onlyCctp *bool, page int) string {
              Severity: Major
              Found in services/explorer/graphql/server/graph/queryutils.go - About 2 hrs to fix

                Function generateAllBridgeEventsQueryFromOrigin has 17 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func generateAllBridgeEventsQueryFromOrigin(chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, tokenAddressFrom []*string, tokenAddressTo []*string, txHash *string, pending *bool, onlyCctp *bool, page int, in bool) string {
                Severity: Major
                Found in services/explorer/graphql/server/graph/queryutils.go - About 2 hrs to fix

                  Method queryResolver.getDateResultByChainMv has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (r *queryResolver) getDateResultByChainMv(ctx context.Context, chainID *int, typeArg *model.DailyStatisticType, platform *model.Platform, duration *model.Duration) ([]*model.DateResultByChain, error) {
                      var err error
                      firstFilter := true
                      timestampSpecifierMv := GetDurationFilter(duration, &firstFilter, "f")
                      chainIDSpecifierMv := generateSingleSpecifierI32SQL(chainID, sql.ChainIDFieldName, &firstFilter, "f")
                  Severity: Minor
                  Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

                    Function generateAllBridgeEventsQueryFromOriginMv has 11 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func generateAllBridgeEventsQueryFromOriginMv(chainIDFrom []*int, addressFrom *string, maxAmount *int, maxAmountUsd *int, startTime *int, endTime *int, tokenAddressFrom []*string, txHash *string, kappa *string, pending *bool, page int) string {
                    Severity: Major
                    Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

                      Function generateAllBridgeEventsQueryFromDestinationMv has 11 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func generateAllBridgeEventsQueryFromDestinationMv(chainIDTo []*int, addressTo *string, minAmount *int, minAmountUsd *int, startTime *int, endTime *int, tokenAddressTo []*string, kappa *string, txHash *string, pending *bool, page int) string {
                      Severity: Major
                      Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

                        Method queryResolver.GetMessageBusTxs has 10 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func (r *queryResolver) GetMessageBusTxs(ctx context.Context, chainID []*int, address *string, startTime *int, endTime *int, txHash *string, messageID *string, pending bool, reverted bool, page *int) ([]*model.MessageBusTransaction, error) {
                        Severity: Major
                        Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

                          Method queryResolver.getAmountStatisticsAll has 12 return statements (exceeds 4 allowed).
                          Open

                          func (r *queryResolver) getAmountStatisticsAll(ctx context.Context, typeArg model.StatisticType, chainID *int, address *string, tokenAddress *string, compositeFilters string) (*string, error) {
                              if typeArg == model.StatisticTypeMedianVolumeUsd || typeArg == model.StatisticTypeMeanVolumeUsd || typeArg == model.StatisticTypeMedianFeeUsd || typeArg == model.StatisticTypeMeanFeeUsd {
                                  return nil, fmt.Errorf("cannot calculate averages or medians across all platforms")
                              }
                              var bridgeFinalSQL *string
                          Severity: Major
                          Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

                            Function generateMessageBusQuery has 9 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            func generateMessageBusQuery(chainID []*int, address *string, startTime *int, endTime *int, messageID *string, pending bool, reverted bool, txHash *string, page int) string {
                            Severity: Major
                            Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

                              Method queryResolver.getAmountStatisticsAll has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (r *queryResolver) getAmountStatisticsAll(ctx context.Context, typeArg model.StatisticType, chainID *int, address *string, tokenAddress *string, compositeFilters string) (*string, error) {
                                  if typeArg == model.StatisticTypeMedianVolumeUsd || typeArg == model.StatisticTypeMeanVolumeUsd || typeArg == model.StatisticTypeMedianFeeUsd || typeArg == model.StatisticTypeMeanFeeUsd {
                                      return nil, fmt.Errorf("cannot calculate averages or medians across all platforms")
                                  }
                                  var bridgeFinalSQL *string
                              Severity: Minor
                              Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

                                Method queryResolver.GetDestinationBridgeTxBW has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                func (r *queryResolver) GetDestinationBridgeTxBW(ctx context.Context, chainID int, address string, kappa string, timestamp int, historical bool, bridgeType model.BridgeType) (*model.BridgeWatcherTx, error) {
                                Severity: Major
                                Found in services/explorer/graphql/server/graph/queryutils.go - About 50 mins to fix

                                  Method queryResolver.getDateResultByChainMv has 8 return statements (exceeds 4 allowed).
                                  Open

                                  func (r *queryResolver) getDateResultByChainMv(ctx context.Context, chainID *int, typeArg *model.DailyStatisticType, platform *model.Platform, duration *model.Duration) ([]*model.DateResultByChain, error) {
                                      var err error
                                      firstFilter := true
                                      timestampSpecifierMv := GetDurationFilter(duration, &firstFilter, "f")
                                      chainIDSpecifierMv := generateSingleSpecifierI32SQL(chainID, sql.ChainIDFieldName, &firstFilter, "f")
                                  Severity: Major
                                  Found in services/explorer/graphql/server/graph/queryutils.go - About 50 mins to fix

                                    Function GetPartialInfoFromBridgeEventHybrid has 7 return statements (exceeds 4 allowed).
                                    Open

                                    func GetPartialInfoFromBridgeEventHybrid(bridgeEvent sql.HybridBridgeEvent, includePending *bool) (*model.BridgeTransaction, error) {
                                        if includePending != nil && *includePending && bridgeEvent.TTxHash != "" {
                                            // nolint:nilnil
                                            return nil, nil
                                        }
                                    Severity: Major
                                    Found in services/explorer/graphql/server/graph/queryutils.go - About 45 mins to fix

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

                                      func generateBridgeEventCountQuery(chainID *int, address *string, tokenAddress *string, directionIn bool, timestamp *uint64, isTokenCount bool) string {
                                      Severity: Minor
                                      Found in services/explorer/graphql/server/graph/queryutils.go - About 45 mins to fix

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

                                        func generateEqualitySpecifierSQLMv(value *int, field string, firstFilter *bool, firstInLocale *bool, tablePrefix string, greaterThan bool) string {
                                        Severity: Minor
                                        Found in services/explorer/graphql/server/graph/queryutils.go - About 45 mins to fix

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

                                          func generateCCTPSpecifierSQLMv(onlyCctp *bool, to bool, field string, firstFilter *bool, firstInLocale *bool, tablePrefix string) string {
                                          Severity: Minor
                                          Found in services/explorer/graphql/server/graph/queryutils.go - About 45 mins to fix

                                            Method queryResolver.getAmountStatisticsAll has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                            func (r *queryResolver) getAmountStatisticsAll(ctx context.Context, typeArg model.StatisticType, chainID *int, address *string, tokenAddress *string, compositeFilters string) (*string, error) {
                                            Severity: Minor
                                            Found in services/explorer/graphql/server/graph/queryutils.go - About 45 mins to fix

                                              Method queryResolver.GetMessageBusTxs has 6 return statements (exceeds 4 allowed).
                                              Open

                                              func (r *queryResolver) GetMessageBusTxs(ctx context.Context, chainID []*int, address *string, startTime *int, endTime *int, txHash *string, messageID *string, pending bool, reverted bool, page *int) ([]*model.MessageBusTransaction, error) {
                                                  var err error
                                                  allMessageBusEvents, err := r.DB.GetAllMessageBusEvents(ctx, generateMessageBusQuery(chainID, address, startTime, endTime, messageID, pending, reverted, txHash, *page))
                                                  if err != nil {
                                                      return nil, fmt.Errorf("failed to get destinationbridge events from identifiers: %w", err)
                                              Severity: Major
                                              Found in services/explorer/graphql/server/graph/queryutils.go - About 40 mins to fix

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

                                                func generateSingleSpecifierI32ArrSQLMv(values []*int, field string, firstFilter *bool, firstInLocale *bool, tablePrefix string) string {
                                                Severity: Minor
                                                Found in services/explorer/graphql/server/graph/queryutils.go - About 35 mins to fix

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

                                                  func generateEqualitySpecifierSQL(value *int, field string, firstFilter *bool, tablePrefix string, greaterThan bool) string {
                                                  Severity: Minor
                                                  Found in services/explorer/graphql/server/graph/queryutils.go - About 35 mins to fix

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

                                                    func generateSingleSpecifierStringSQLMv(value *string, field string, firstFilter *bool, firstLocale *bool, tablePrefix string) string {
                                                    Severity: Minor
                                                    Found in services/explorer/graphql/server/graph/queryutils.go - About 35 mins to fix

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

                                                      func generateSingleSpecifierStringArrSQLMv(values []*string, field string, firstFilter *bool, firstInLocale *bool, tablePrefix string) string {
                                                      Severity: Minor
                                                      Found in services/explorer/graphql/server/graph/queryutils.go - About 35 mins to fix

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

                                                        func generateCCTPSpecifierSQL(onlyCctp *bool, to bool, field string, firstFilter *bool, tablePrefix string) string {
                                                        Severity: Minor
                                                        Found in services/explorer/graphql/server/graph/queryutils.go - About 35 mins to fix

                                                          Method queryResolver.getDateResultByChainMv has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                          Open

                                                          func (r *queryResolver) getDateResultByChainMv(ctx context.Context, chainID *int, typeArg *model.DailyStatisticType, platform *model.Platform, duration *model.Duration) ([]*model.DateResultByChain, error) {
                                                          Severity: Minor
                                                          Found in services/explorer/graphql/server/graph/queryutils.go - About 35 mins to fix

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

                                                            func generateKappaSpecifierSQLMv(value *string, field string, firstFilter *bool, firstInLocale *bool, tablePrefix string) string {
                                                            Severity: Minor
                                                            Found in services/explorer/graphql/server/graph/queryutils.go - About 35 mins to fix

                                                              Method queryResolver.GetBridgeTxsFromDestination has 5 return statements (exceeds 4 allowed).
                                                              Open

                                                              func (r *queryResolver) GetBridgeTxsFromDestination(ctx context.Context, useMv *bool, chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, kappa *string, tokenAddressFrom []*string, tokenAddressTo []*string, onlyCctp *bool, page *int, pending *bool) ([]*model.BridgeTransaction, error) {
                                                                  var err error
                                                                  var results []*model.BridgeTransaction
                                                                  var query string
                                                                  if useMv != nil && *useMv {
                                                              Severity: Major
                                                              Found in services/explorer/graphql/server/graph/queryutils.go - About 35 mins to fix

                                                                Function GetPartialInfoFromBridgeEventHybrid has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                                                                Open

                                                                func GetPartialInfoFromBridgeEventHybrid(bridgeEvent sql.HybridBridgeEvent, includePending *bool) (*model.BridgeTransaction, error) {
                                                                    if includePending != nil && *includePending && bridgeEvent.TTxHash != "" {
                                                                        // nolint:nilnil
                                                                        return nil, nil
                                                                    }
                                                                Severity: Minor
                                                                Found in services/explorer/graphql/server/graph/queryutils.go - About 25 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

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

                                                                func generateAllBridgeEventsQueryFromDestination(chainIDTo []*int, chainIDFrom []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, tokenAddressFrom []*string, tokenAddressTo []*string, kappa *string, txHash *string, onlyCctp *bool, page int, in bool) string {
                                                                    firstFilter := true
                                                                    chainIDToFilter := generateSingleSpecifierI32ArrSQL(chainIDTo, sql.ChainIDFieldName, &firstFilter, "")
                                                                    minTimeFilter := generateEqualitySpecifierSQL(startTime, sql.TimeStampFieldName, &firstFilter, "", true)
                                                                    maxTimeFilter := generateEqualitySpecifierSQL(endTime, sql.TimeStampFieldName, &firstFilter, "", false)
                                                                Severity: Major
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 1 other location - About 1 hr to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 817..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 134.

                                                                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 generateAllBridgeEventsQueryFromOrigin(chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, tokenAddressFrom []*string, tokenAddressTo []*string, txHash *string, pending *bool, onlyCctp *bool, page int, in bool) string {
                                                                    firstFilter := true
                                                                    chainIDFromFilter := generateSingleSpecifierI32ArrSQL(chainIDFrom, sql.ChainIDFieldName, &firstFilter, "")
                                                                    minTimeFilter := generateEqualitySpecifierSQL(startTime, sql.TimeStampFieldName, &firstFilter, "", true)
                                                                    maxTimeFilter := generateEqualitySpecifierSQL(endTime, sql.TimeStampFieldName, &firstFilter, "", false)
                                                                Severity: Major
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 1 other location - About 1 hr to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 733..767

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

                                                                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

                                                                    bridgeTx = model.PartialInfo{
                                                                        ChainID:            &chainID,
                                                                        DestinationChainID: &destinationChainID,
                                                                        Address:            &bridgeEvent.Recipient.String,
                                                                        TxnHash:            &bridgeEvent.TxHash,
                                                                Severity: Major
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 2 other locations - About 50 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 1766..1779
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 1816..1829

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

                                                                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

                                                                    bridgeTx = model.PartialInfo{
                                                                        ChainID:            &chainID,
                                                                        DestinationChainID: &destinationChainID,
                                                                        Address:            &bridgeEvent.FRecipient.String,
                                                                        TxnHash:            &bridgeEvent.FTxHash,
                                                                Severity: Major
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 2 other locations - About 50 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 1719..1732
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 1816..1829

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

                                                                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

                                                                    bridgeTx = model.PartialInfo{
                                                                        ChainID:            &chainID,
                                                                        DestinationChainID: &destinationChainID,
                                                                        Address:            &bridgeEvent.TRecipient.String,
                                                                        TxnHash:            &bridgeEvent.TTxHash,
                                                                Severity: Major
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 2 other locations - About 50 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 1719..1732
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 1766..1779

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

                                                                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 generateAddressSpecifierSQLMv(address *string, firstFilter *bool, firstInLocale *bool, tablePrefix string) string {
                                                                    // if address != nil {
                                                                    //    if *firstFilter {
                                                                    //        *firstFilter = false
                                                                    //
                                                                Severity: Minor
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 1 other location - About 45 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 171..199

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

                                                                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 generateRecipientSpecifierSQLMv(address *string, firstFilter *bool, firstInLocale *bool, tablePrefix string) string {
                                                                    // if address != nil {
                                                                    //    if *firstFilter {
                                                                    //        *firstFilter = false
                                                                    //
                                                                Severity: Minor
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 1 other location - About 45 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 116..144

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

                                                                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

                                                                func generateSingleSpecifierI32SQL(value *int, field string, firstFilter *bool, tablePrefix string) string {
                                                                    if value != nil {
                                                                        if *firstFilter {
                                                                            *firstFilter = false
                                                                
                                                                
                                                                Severity: Minor
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 2 other locations - About 35 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 419..431
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 436..448

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

                                                                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

                                                                func generateTimestampSpecifierSQL(value *uint64, field string, firstFilter *bool, tablePrefix string) string {
                                                                    if value != nil {
                                                                        if *firstFilter {
                                                                            *firstFilter = false
                                                                
                                                                
                                                                Severity: Minor
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 2 other locations - About 35 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 294..306
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 436..448

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

                                                                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

                                                                func generateSingleSpecifierStringSQL(value *string, field string, firstFilter *bool, tablePrefix string) string {
                                                                    if value != nil {
                                                                        if *firstFilter {
                                                                            *firstFilter = false
                                                                
                                                                
                                                                Severity: Minor
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 2 other locations - About 35 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 294..306
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 419..431

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

                                                                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 generateKappaSpecifierSQLMv(value *string, field string, firstFilter *bool, firstInLocale *bool, tablePrefix string) string {
                                                                    if value != nil {
                                                                        if *firstInLocale {
                                                                            *firstFilter = false
                                                                            *firstInLocale = false
                                                                Severity: Minor
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 1 other location - About 30 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 453..470

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

                                                                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 generateSingleSpecifierStringSQLMv(value *string, field string, firstFilter *bool, firstLocale *bool, tablePrefix string) string {
                                                                    if value != nil {
                                                                        if *firstLocale {
                                                                            *firstFilter = false
                                                                            *firstLocale = false
                                                                Severity: Minor
                                                                Found in services/explorer/graphql/server/graph/queryutils.go and 1 other location - About 30 mins to fix
                                                                services/explorer/graphql/server/graph/queryutils.go on lines 488..505

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

                                                                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