synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Method ChainBackfiller.Backfill has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
Open

func (c *ChainBackfiller) Backfill(ctx context.Context, livefill bool, refreshRate int) (err error) {
    chainCtx := context.WithValue(ctx, chainKey, fmt.Sprintf("%d", c.chainConfig.ChainID))
    contractsGroup, contractCtx := errgroup.WithContext(chainCtx)

    if !livefill {
Severity: Minor
Found in services/explorer/backfill/chain.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

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

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

    Method ChainBackfiller.backfillContractLogs has 13 return statements (exceeds 4 allowed).
    Open

    func (c *ChainBackfiller) backfillContractLogs(parentCtx context.Context, contract indexerconfig.ContractConfig) (err error) {
        // make the event parser
        eventParser, err := c.makeEventParser(contract)
        if err != nil {
            return err
    Severity: Major
    Found in services/explorer/backfill/chain.go - About 1 hr to fix

      Method executionContext.field_Query_logsRange_args has 13 return statements (exceeds 4 allowed).
      Open

      func (ec *executionContext) field_Query_logsRange_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
          var err error
          args := map[string]interface{}{}
          var arg0 *string
          if tmp, ok := rawArgs["contract_address"]; ok {
      Severity: Major
      Found in services/explorer/consumer/client/resolver-client/server.go - About 1 hr to fix

        Method MessageBusParser.Parse has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
        Open

        func (m *MessageBusParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error) {
            logTopic := log.Topics[0]
            iFace, err := func(log ethTypes.Log) (messageBusTypes.EventLog, error) {
                switch logTopic {
                case messagebus.Topic(messageBusTypes.ExecutedEvent):
        Severity: Minor
        Found in services/explorer/consumer/parser/messagebusparser.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

        Method synapseCCTPHandler.FetchAndProcessSentEvent has 13 return statements (exceeds 4 allowed).
        Open

        func (s *synapseCCTPHandler) FetchAndProcessSentEvent(parentCtx context.Context, txhash common.Hash, originChain uint32) (msg *relayTypes.Message, err error) {
            ctx, span := s.handler.Tracer().Start(parentCtx, "FetchAndProcessSentEvent", trace.WithAttributes(
                attribute.String(metrics.TxHash, txhash.String()),
                attribute.Int(metrics.ChainID, int(originChain)),
            ))
        Severity: Major
        Found in services/cctp-relayer/relayer/synapse.go - About 1 hr to fix

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

          func (r *queryResolver) TransactionsAtHeadRange(ctx context.Context, txHash *string, chainID int, blockNumber *int, blockHash *string, confirmed *bool, startBlock int, endBlock int, lastIndexed int, page int) ([]*model.Transaction, error) {
          Severity: Major
          Found in services/scribe/graphql/server/graph/queries.resolvers.go - About 1 hr to fix

            Method executionContext.field_Query_logsRange_args has 13 return statements (exceeds 4 allowed).
            Open

            func (ec *executionContext) field_Query_logsRange_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
                var err error
                args := map[string]interface{}{}
                var arg0 *string
                if tmp, ok := rawArgs["contract_address"]; ok {
            Severity: Major
            Found in services/scribe/graphql/server/graph/resolver/server.go - About 1 hr to fix

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

              func (r *queryResolver) Logs(ctx context.Context, contractAddress *string, chainID int, blockNumber *int, txHash *string, txIndex *int, blockHash *string, index *int, confirmed *bool, page int) ([]*model.Log, error) {
              Severity: Major
              Found in services/scribe/graphql/server/graph/queries.resolvers.go - About 1 hr to fix

                Function bridgeTxStatusController has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                export const bridgeTxStatusController = async (req, res) => {
                  const errors = validationResult(req)
                  if (!errors.isEmpty()) {
                    return res.status(400).json({ errors: errors.array() })
                  }
                Severity: Minor
                Found in packages/rest-api/src/controllers/bridgeTxStatusController.ts - 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 useMaintenanceData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                const useMaintenanceData = () => {
                  const { pausedChainsData, pausedModulesData } = useMaintenanceState()
                
                  const pausedChainsList: ChainPause[] = pausedChainsData
                    ? pausedChainsData?.map((pause: ChainPause) => {
                Severity: Minor
                Found in packages/synapse-interface/components/Maintenance/Maintenance.tsx - 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 ChainPopoverSelect has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                export const ChainPopoverSelect = ({
                  options,
                  remaining,
                  targets,
                  onSelect,
                Severity: Minor
                Found in packages/widget/src/components/ui/ChainPopoverSelect.tsx - 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 getGasGtTestCases has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func getGasGtTestCases() []*gtTestCase {
                    var legacyTxCases = []*gtTestCase{
                        {
                            tx: types.NewTx(&types.LegacyTx{
                                GasPrice: big.NewInt(500),
                Severity: Minor
                Found in ethergo/chain/gas/cmp_test.go - About 1 hr to fix

                  Method screenerImpl.authMiddleware has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (s *screenerImpl) authMiddleware(cfg config.Config) gin.HandlerFunc {
                      return func(c *gin.Context) {
                          _, span := s.metrics.Tracer().Start(c.Request.Context(), "authMiddleware")
                          defer span.End()
                  
                  
                  Severity: Minor
                  Found in contrib/screener-api/screener/screener.go - About 1 hr to fix

                    Method PricerSuite.SetupTest has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (c *PricerSuite) SetupTest() {
                        c.TestSuite.SetupTest()
                        // Setup
                        c.origin = 42161
                        c.destination = 137
                    Severity: Minor
                    Found in services/rfq/relayer/pricer/suite_test.go - About 1 hr to fix

                      Method contractTypeImpl.ContractInfo has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (c contractTypeImpl) ContractInfo() *compiler.Contract {
                          switch c {
                          case OriginType:
                              return origin.Contracts["solidity/Origin.sol:Origin"]
                          case MessageHarnessType:
                      Severity: Minor
                      Found in agents/testutil/contracttype.go - About 1 hr to fix

                        Method BackfillSuite.depositParity has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (b *BackfillSuite) depositParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
                            // parse the log
                            if useV1 {
                                parsedLog, err := parser.FiltererV1.ParseTokenDeposit(*log)
                                _ = parsedLog
                        Severity: Minor
                        Found in services/explorer/backfill/chain_test.go - About 1 hr to fix

                          Function OpenGormClickhouse has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func OpenGormClickhouse(ctx context.Context, address string, readOnly bool, handler metrics.Handler) (*Store, error) {
                              clickhouseDB, err := gorm.Open(gormClickhouse.New(gormClickhouse.Config{
                                  DSN: address,
                              }), &gorm.Config{
                                  Logger:               gormLogger.Default.LogMode(gormLogger.Silent),
                          Severity: Minor
                          Found in services/explorer/db/sql/store.go - About 1 hr to fix

                            Method ChainIndexer.livefill has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (c *ChainIndexer) livefill(parentContext context.Context) error {
                                timeout := time.Duration(0)
                                b := createBackoff()
                                livefillBlockMeter, err := c.handler.Metrics().NewHistogram(fmt.Sprintf("scribe_block_meter_%d_livefill", c.chainConfig.ChainID), "block_histogram", "a block height meter", "blocks")
                                if err != nil {
                            Severity: Minor
                            Found in services/scribe/service/chain.go - About 1 hr to fix

                              Function useChainInputFilter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const useChainInputFilter = (
                                options: Chain[],
                                remaining: Chain[],
                                targets: Chain[],
                                isActive: boolean
                              Severity: Minor
                              Found in packages/widget/src/hooks/useChainInputFilter.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language