synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

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

    func (c *Client) GetCountByChainID(ctx context.Context, chainID *int, address *string, direction *model.Direction, hours *int, httpRequestOptions ...client.HTTPRequestOption) (*GetCountByChainID, error) {
    Severity: Minor
    Found in services/explorer/graphql/client/client.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if err != nil {
                                  timeout = b.Duration()
                                  logger.Warnf("could not process logs for chain %d: %s", c.chainConfig.ChainID, err)
                                  continue
                              }
      Severity: Major
      Found in services/explorer/backfill/chain.go - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if len(parsedLogs) > 0 {
                                    g.Go(func() error {
                                        return c.storeParsedLogs(groupCtx, parsedLogs)
                                    })
                                }
        Severity: Major
        Found in services/explorer/backfill/chain.go - About 45 mins to fix

          Method executionContext.field_Query_transactions_args has 7 return statements (exceeds 4 allowed).
          Open

          func (ec *executionContext) field_Query_transactions_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["tx_hash"]; ok {
          Severity: Major
          Found in services/explorer/consumer/client/resolver-client/server.go - About 45 mins to fix

            Method Client.GetLeaderboard has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (c *Client) GetLeaderboard(ctx context.Context, duration *model.Duration, chainID *int, useMv *bool, page *int, httpRequestOptions ...client.HTTPRequestOption) (*GetLeaderboard, error) {
            Severity: Minor
            Found in services/explorer/graphql/client/client.go - About 45 mins to fix

              Method synapseCCTPHandler.HandleLog has 7 return statements (exceeds 4 allowed).
              Open

              func (s *synapseCCTPHandler) HandleLog(ctx context.Context, log *types.Log, chainID uint32) (processQueue bool, err error) {
                  if log == nil {
                      return false, fmt.Errorf("log is nil")
                  }
              
              
              Severity: Major
              Found in services/cctp-relayer/relayer/synapse.go - About 45 mins to fix

                Method CircleAPI.GetAttestation has 7 return statements (exceeds 4 allowed).
                Open

                func (c CircleAPI) GetAttestation(ctx context.Context, txHash string) (attestation []byte, err error) {
                    url := fmt.Sprintf("%s/%s", c.baseURL, txHash)
                    req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
                    if err != nil {
                        err = fmt.Errorf("could not create request: %w", err)
                Severity: Major
                Found in services/cctp-relayer/attestation/circleapi.go - About 45 mins to fix

                  Method Store.StoreSwapFee has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (s *Store) StoreSwapFee(ctx context.Context, chainID uint32, blockNumber uint64, contractAddress string, fee uint64, feeType string) error {
                  Severity: Minor
                  Found in services/explorer/db/sql/writer.go - About 45 mins to fix

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

                    func NewExplorerBackfiller(consumerDB db.ConsumerDB, config indexerConfig.Config, clients map[uint32]bind.ContractBackend, handler metrics.Handler) (*ExplorerBackfiller, error) {
                        chainBackfillers := make(map[uint32]*backfill.ChainBackfiller)
                        httpClient := http.Client{
                            Timeout: 10 * time.Second,
                            Transport: &http.Transport{
                    Severity: Major
                    Found in services/explorer/node/explorer.go - About 45 mins to fix

                      Function NewCCTPRelayer has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func NewCCTPRelayer(ctx context.Context, cfg config.Config, store db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, handler metrics.Handler, attestationAPI attestation.CCTPAPI, rawOpts ...OptionsArgsOption) (*CCTPRelayer, error) {
                          opts := makeOptions(rawOpts)
                      
                          omniClient := omniClient.NewOmnirpcClient(cfg.BaseOmnirpcURL, handler, omniClient.WithCaptureReqRes())
                      
                      
                      Severity: Minor
                      Found in services/cctp-relayer/relayer/relayer.go - About 45 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

                      Method circleCCTPHandler.HandleLog has 7 return statements (exceeds 4 allowed).
                      Open

                      func (c *circleCCTPHandler) HandleLog(ctx context.Context, log *types.Log, chainID uint32) (processQueue bool, err error) {
                          if log == nil {
                              return false, fmt.Errorf("log is nil")
                          }
                      
                      
                      Severity: Major
                      Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

                        Method circleCCTPHandler.getMessagePayload has 7 return statements (exceeds 4 allowed).
                        Open

                        func (c *circleCCTPHandler) getMessagePayload(ctx context.Context, txHash common.Hash, chainID uint32, ethClient client.EVM) (message []byte, err error) {
                            chainCfg, err := c.cfg.GetChainConfig(chainID)
                            if err != nil {
                                return nil, fmt.Errorf("could not get chain config: %w", err)
                            }
                        Severity: Major
                        Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

                          Method synapseCCTPHandler.handleCircleRequestFulfilled has 7 return statements (exceeds 4 allowed).
                          Open

                          func (s *synapseCCTPHandler) handleCircleRequestFulfilled(parentCtx context.Context, log *types.Log, destChain uint32) (err error) {
                              ctx, span := s.handler.Tracer().Start(parentCtx, "handleCircleRequestFulfilled", trace.WithAttributes(
                                  attribute.String(metrics.TxHash, log.TxHash.String()),
                                  attribute.Int(metrics.Destination, int(destChain)),
                              ))
                          Severity: Major
                          Found in services/cctp-relayer/relayer/synapse.go - About 45 mins to fix

                            Method circleCCTPHandler.handleMessageReceived has 7 return statements (exceeds 4 allowed).
                            Open

                            func (c *circleCCTPHandler) handleMessageReceived(parentCtx context.Context, log *types.Log, chainID uint32) (err error) {
                                ctx, span := c.handler.Tracer().Start(parentCtx, "handleMessageReceived", trace.WithAttributes(
                                    attribute.String(metrics.TxHash, log.TxHash.Hex()),
                                    attribute.Int(metrics.ChainID, int(chainID)),
                                    attribute.Int("block_number", int(log.BlockNumber)),
                            Severity: Major
                            Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

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

                              func getChainBackfiller(consumerDB db.ConsumerDB, chainConfig indexerConfig.ChainConfig, fetcher fetcherpkg.ScribeFetcher, client bind.ContractBackend, tokenDataService tokendata.Service, priceDataService tokenprice.Service) (*backfill.ChainBackfiller, error) {
                              Severity: Minor
                              Found in services/explorer/node/explorer.go - About 45 mins to fix

                                Method circleCCTPHandler.FetchAndProcessSentEvent has 7 return statements (exceeds 4 allowed).
                                Open

                                func (c *circleCCTPHandler) FetchAndProcessSentEvent(parentCtx context.Context, txHash common.Hash, chainID uint32) (msg *relayTypes.Message, err error) {
                                    ctx, span := c.handler.Tracer().Start(parentCtx, "FetchAndProcessSentEvent", trace.WithAttributes(
                                        attribute.String(metrics.TxHash, txHash.String()),
                                        attribute.Int(metrics.ChainID, int(chainID)),
                                    ))
                                Severity: Major
                                Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

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

                                  func NewSynapseCCTPHandler(ctx context.Context, cfg config.Config, db db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, txSubmitter submitter.TransactionSubmitter, handler metrics.Handler) (_ CCTPHandler, err error) {
                                  Severity: Minor
                                  Found in services/cctp-relayer/relayer/synapse.go - About 45 mins to fix

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

                                    func NewCircleCCTPHandler(ctx context.Context, cfg config.Config, db db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, txSubmitter submitter.TransactionSubmitter, handler metrics.Handler) (CCTPHandler, error) {
                                    Severity: Minor
                                    Found in services/cctp-relayer/relayer/circle.go - About 45 mins to fix

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

                                      func NewBridgeParser(consumerDB db.ConsumerDB, bridgeAddress common.Address, tokenDataService tokendata.Service, consumerFetcher fetcher.ScribeFetcher, tokenPriceService tokenprice.Service, fromAPI bool) (*BridgeParser, error) {
                                      Severity: Minor
                                      Found in services/explorer/consumer/parser/bridgeparser.go - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language