synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

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

func sortInfoList(rpcInfoList []rpcinfo.Result) []rpcinfo.Result {
    sort.Slice(rpcInfoList, func(i, j int) bool {
        // ignore latencies with an error
        if rpcInfoList[i].HasError {
            return false
Severity: Major
Found in services/omnirpc/chainmanager/manager.go - About 35 mins to fix

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

    func getLatency(ctx context.Context, rpcURL string, handler metrics.Handler) (l Result) {
        l = Result{URL: rpcURL, HasError: true}
    
        parsedURL, err := url.Parse(rpcURL)
        if err != nil {
    Severity: Major
    Found in services/omnirpc/rpcinfo/latency.go - About 35 mins to fix

      Method Config.GetMinQuoteAmount has 5 return statements (exceeds 4 allowed).
      Open

      func (c Config) GetMinQuoteAmount(chainID int, addr common.Address) *big.Int {
          chainCfg, ok := c.Chains[chainID]
          if !ok {
              return big.NewInt(defaultMinQuoteAmount)
          }
      Severity: Major
      Found in services/rfq/relayer/relconfig/getters.go - About 35 mins to fix

        Method Config.GetScrollMessageFee has 5 return statements (exceeds 4 allowed).
        Open

        func (c Config) GetScrollMessageFee(chainID int) (value *big.Int, err error) {
            chainCfg, ok := c.Chains[chainID]
            if !ok {
                return value, fmt.Errorf("no chain config for chain %d", chainID)
            }
        Severity: Major
        Found in services/rfq/relayer/relconfig/getters.go - About 35 mins to fix

          Method clientImpl.processWebsocket has 5 return statements (exceeds 4 allowed).
          Open

          func (c *clientImpl) processWebsocket(ctx context.Context, conn *websocket.Conn, reqChan, respChan chan *model.ActiveRFQMessage) (err error) {
              defer func() {
                  close(respChan)
                  err := conn.Close()
                  if err != nil {
          Severity: Major
          Found in services/rfq/api/client/client.go - About 35 mins to fix

            Method Chain.SubmitRelay has 5 return statements (exceeds 4 allowed).
            Open

            func (c Chain) SubmitRelay(ctx context.Context, request reldb.QuoteRequest) (uint64, *big.Int, error) {
                gasAmount := big.NewInt(0)
                var err error
            
                // Check to see if ETH should be sent to destination
            Severity: Major
            Found in services/rfq/relayer/chain/chain.go - About 35 mins to fix

              Method receiptsProxyImpl.processRequest has 5 return statements (exceeds 4 allowed).
              Open

              func (r *receiptsProxyImpl) processRequest(ctx context.Context, rpcRequest rpc.Request, requestID []byte) (resp omniHTTP.Response, err error) {
                  ctx, span := r.handler.Tracer().Start(ctx, "proxyrequest")
                  defer func() {
                      metrics.EndSpanWithErr(span, err)
                  }()
              Severity: Major
              Found in services/omnirpc/modules/receiptsbackup/receiptsbackup.go - About 35 mins to fix

                Method Relayer.handleRelayLog has 5 return statements (exceeds 4 allowed).
                Open

                func (r *Relayer) handleRelayLog(parentCtx context.Context, req *fastbridge.FastBridgeBridgeRelayed) (err error) {
                    ctx, span := r.metrics.Tracer().Start(parentCtx, "handleRelayLog",
                        trace.WithAttributes(attribute.String("transaction_id", hexutil.Encode(req.TransactionId[:]))),
                    )
                    defer func() {
                Severity: Major
                Found in services/rfq/relayer/service/handlers.go - About 35 mins to fix

                  Method rebalanceManagerCircleCCTP.handleMessageReceived has 5 return statements (exceeds 4 allowed).
                  Open

                  func (c *rebalanceManagerCircleCCTP) handleMessageReceived(ctx context.Context, log types.Log, chainID int, ethClient client.EVM) (err error) {
                      ctx, span := c.handler.Tracer().Start(ctx, "rebalance.handleMessageReceived")
                      defer func(err error) {
                          metrics.EndSpanWithErr(span, err)
                      }(err)
                  Severity: Major
                  Found in services/rfq/relayer/inventory/circle.go - About 35 mins to fix

                    Method Config.validateTokenDecimals has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (c Config) validateTokenDecimals(ctx context.Context, omniClient omniClient.RPCClient) (err error) {
                        for chainID, chainCfg := range c.Chains {
                            for tokenName, tokenCFG := range chainCfg.Tokens {
                                chainClient, err := omniClient.GetChainClient(ctx, chainID)
                                if err != nil {
                    Severity: Minor
                    Found in services/rfq/relayer/relconfig/config.go - About 35 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 rebalanceManagerSynapseCCTP.initListeners has 5 return statements (exceeds 4 allowed).
                    Open

                    func (c *rebalanceManagerSynapseCCTP) initListeners(ctx context.Context) (err error) {
                        for chainID := range c.cfg.GetChains() {
                            cctpAddr, err := c.cfg.GetSynapseCCTPAddress(chainID)
                            if err != nil {
                                return fmt.Errorf("could not get cctp address: %w", err)
                    Severity: Major
                    Found in services/rfq/relayer/inventory/synapse.go - About 35 mins to fix

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

                      func NewInventoryManager(ctx context.Context, clientFetcher submitter.ClientFetcher, handler metrics.Handler, cfg relconfig.Config, relayer common.Address, txSubmitter submitter.TransactionSubmitter, db reldb.Service) (Manager, error) {
                          rebalanceMethods, err := cfg.GetAllRebalanceMethods()
                          if err != nil {
                              return nil, fmt.Errorf("could not get rebalance methods: %w", err)
                          }
                      Severity: Major
                      Found in services/rfq/relayer/inventory/manager.go - About 35 mins to fix

                        Method Handler.ModifyQuote has 5 return statements (exceeds 4 allowed).
                        Open

                        func (h *Handler) ModifyQuote(c *gin.Context) {
                            // Retrieve the request from context
                            req, exists := c.Get("putRequest")
                            if !exists {
                                c.JSON(http.StatusBadRequest, gin.H{"error": "Request not found"})
                        Severity: Major
                        Found in services/rfq/api/rest/handler.go - About 35 mins to fix

                          Method inventoryManagerImpl.tryExecuteRebalance has 5 return statements (exceeds 4 allowed).
                          Open

                          func (i *inventoryManagerImpl) tryExecuteRebalance(ctx context.Context, rebalance *RebalanceData) (err error) {
                              ctx, span := i.handler.Tracer().Start(ctx, "tryExecuteRebalance", trace.WithAttributes(
                                  attribute.Int("origin", rebalance.OriginMetadata.ChainID),
                                  attribute.Int("dest", rebalance.DestMetadata.ChainID),
                                  attribute.String("origin_token", rebalance.OriginMetadata.Addr.Hex()),
                          Severity: Major
                          Found in services/rfq/relayer/inventory/manager.go - About 35 mins to fix

                            Method executionContext._BlockHeight_blockNumber has 5 return statements (exceeds 4 allowed).
                            Open

                            func (ec *executionContext) _BlockHeight_blockNumber(ctx context.Context, field graphql.CollectedField, obj *model.BlockHeight) (ret graphql.Marshaler) {
                                fc, err := ec.fieldContext_BlockHeight_blockNumber(ctx, field)
                                if err != nil {
                                    return graphql.Null
                                }
                            Severity: Major
                            Found in services/explorer/graphql/server/graph/resolver/server.go - About 35 mins to fix

                              Method executionContext._DateResultByChain_canto has 5 return statements (exceeds 4 allowed).
                              Open

                              func (ec *executionContext) _DateResultByChain_canto(ctx context.Context, field graphql.CollectedField, obj *model.DateResultByChain) (ret graphql.Marshaler) {
                                  fc, err := ec.fieldContext_DateResultByChain_canto(ctx, field)
                                  if err != nil {
                                      return graphql.Null
                                  }
                              Severity: Major
                              Found in services/explorer/graphql/server/graph/resolver/server.go - About 35 mins to fix

                                Method executionContext._HeroType_heroID has 5 return statements (exceeds 4 allowed).
                                Open

                                func (ec *executionContext) _HeroType_heroID(ctx context.Context, field graphql.CollectedField, obj *model.HeroType) (ret graphql.Marshaler) {
                                    fc, err := ec.fieldContext_HeroType_heroID(ctx, field)
                                    if err != nil {
                                        return graphql.Null
                                    }
                                Severity: Major
                                Found in services/explorer/graphql/server/graph/resolver/server.go - About 35 mins to fix

                                  Method executionContext._Leaderboard_volumeUSD has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (ec *executionContext) _Leaderboard_volumeUSD(ctx context.Context, field graphql.CollectedField, obj *model.Leaderboard) (ret graphql.Marshaler) {
                                      fc, err := ec.fieldContext_Leaderboard_volumeUSD(ctx, field)
                                      if err != nil {
                                          return graphql.Null
                                      }
                                  Severity: Major
                                  Found in services/explorer/graphql/server/graph/resolver/server.go - About 35 mins to fix

                                    Method executionContext._PartialInfo_address has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (ec *executionContext) _PartialInfo_address(ctx context.Context, field graphql.CollectedField, obj *model.PartialInfo) (ret graphql.Marshaler) {
                                        fc, err := ec.fieldContext_PartialInfo_address(ctx, field)
                                        if err != nil {
                                            return graphql.Null
                                        }
                                    Severity: Major
                                    Found in services/explorer/graphql/server/graph/resolver/server.go - About 35 mins to fix

                                      Method executionContext._Query_leaderboard has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (ec *executionContext) _Query_leaderboard(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
                                          fc, err := ec.fieldContext_Query_leaderboard(ctx, field)
                                          if err != nil {
                                              return graphql.Null
                                          }
                                      Severity: Major
                                      Found in services/explorer/graphql/server/graph/resolver/server.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language