synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Method executionContext.field_Query_getDestinationBridgeTx_args has 57 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    Method executionContext.field_Query_dailyStatisticsByChain_args has 57 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      Method executionContext.field_Query_transactions_args has 57 lines of code (exceeds 50 allowed). Consider refactoring.
      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: Minor
      Found in services/explorer/consumer/client/resolver-client/server.go - About 1 hr to fix

        Method APISuite.TestLeaderboard has 57 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (g APISuite) TestLeaderboard() {
            chainID := g.chainIDs[0]
            address := common.BigToAddress(big.NewInt(gofakeit.Int64()))
            var addressNS gosql.NullString
            addressNS.String = address.String()
        Severity: Minor
        Found in services/explorer/api/resolver_test.go - About 1 hr to fix

          Function RegisterScribeServiceHandlerServer has 57 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func RegisterScribeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ScribeServiceServer) error {
          
              mux.Handle("POST", pattern_ScribeService_Check_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
                  ctx, cancel := context.WithCancel(req.Context())
                  defer cancel()
          Severity: Minor
          Found in services/scribe/grpc/types/types/v1/service.pb.gw.go - About 1 hr to fix

            Method executionContext.field_Query_transactions_args has 57 lines of code (exceeds 50 allowed). Consider refactoring.
            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: Minor
            Found in services/scribe/graphql/server/graph/resolver/server.go - About 1 hr to fix

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

              func Start(ctx context.Context, cfg Config, handler metrics.Handler) error {
                  logger.Warnf("starting api server")
                  router := ginhelper.New(logger)
                  // wrap gin with metrics
                  router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
              Severity: Minor
              Found in services/scribe/api/server.go - About 1 hr to fix

                Function createZeroAmountTests has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const createZeroAmountTests = (quote: FastBridgeQuote) => {
                  describe('Returns zero', () => {
                    it('If origin amount is zero', () => {
                      expect(applyQuote(quote, BigNumber.from(0))).toEqual(BigNumber.from(0))
                    })
                Severity: Minor
                Found in packages/sdk-router/src/rfq/quote.test.ts - About 1 hr to fix

                  Function TransactionSupport has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const TransactionSupport = () => {
                    return (
                      <div
                        id="transaction-support"
                        className="flex items-center justify-between w-full"
                  Severity: Minor
                  Found in packages/widget/src/components/TransactionSupport.tsx - About 1 hr to fix

                    Method Guard.updateAgentStatus has 13 return statements (exceeds 4 allowed).
                    Open

                    func (g Guard) updateAgentStatus(ctx context.Context, chainID uint32) error {
                        eligibleAgentTrees, err := g.guardDB.GetRelayableAgentStatuses(ctx, chainID)
                        if err != nil {
                            return fmt.Errorf("could not get update agent status parameters: %w", err)
                        }
                    Severity: Major
                    Found in agents/agents/guard/fraud.go - About 1 hr to fix

                      Function NewGuard has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func NewGuard(ctx context.Context, cfg config.AgentConfig, omniRPCClient omnirpcClient.RPCClient, scribeClient client.ScribeClient, guardDB db.GuardDB, handler metrics.Handler) (guard *Guard, err error) {
                          guard = &Guard{
                              refreshInterval: time.Second * time.Duration(cfg.RefreshIntervalSeconds),
                              domains:         make(map[uint32]domains.DomainClient),
                              logChans:        make(map[uint32]chan *ethTypes.Log),
                      Severity: Minor
                      Found in agents/agents/guard/guard.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 Notary.shouldNotaryRegisteredOnDestination has 13 return statements (exceeds 4 allowed).
                      Open

                      func (n *Notary) shouldNotaryRegisteredOnDestination(parentCtx context.Context) (bool, bool) {
                          ctx, span := n.handler.Tracer().Start(parentCtx, "shouldNotaryRegisteredOnDestination", trace.WithAttributes(
                              attribute.Int(metrics.ChainID, int(n.destinationDomain.Config().DomainID)),
                          ))
                          defer span.End()
                      Severity: Major
                      Found in agents/agents/notary/notary.go - About 1 hr to fix

                        Method QuoteRequestHandler.commitPendingBalance has 13 return statements (exceeds 4 allowed).
                        Open

                        func (q *QuoteRequestHandler) commitPendingBalance(ctx context.Context, span trace.Span, request *reldb.QuoteRequest) (err error) {
                            // lock the consumed balance
                            key := getBalanceMtxKey(q.Dest.ChainID, request.Transaction.DestToken)
                            span.SetAttributes(attribute.String("balance_lock_key", key))
                            unlocker, ok := q.balanceMtx.TryLock(key)
                        Severity: Major
                        Found in services/rfq/relayer/service/handlers.go - About 1 hr to fix

                          Method parserImpl.ParseEvent has 13 return statements (exceeds 4 allowed).
                          Open

                          func (p parserImpl) ParseEvent(log ethTypes.Log) (_ EventType, event interface{}, ok bool) {
                              // return an unknown event to avoid cases where user failed to check the event type
                              // make it high enough to make it obvious (we start iotas at +1, see uber style guide for details)
                              noOpEvent := EventType(len(topicMap()) + 2)
                          
                          
                          Severity: Major
                          Found in services/rfq/contracts/fastbridge/parser.go - About 1 hr to fix

                            Method inventoryManagerImpl.ApproveAllTokens has 13 return statements (exceeds 4 allowed).
                            Open

                            func (i *inventoryManagerImpl) ApproveAllTokens(ctx context.Context) (err error) {
                                ctx, span := i.handler.Tracer().Start(ctx, "approveAllTokens")
                                defer func() {
                                    metrics.EndSpanWithErr(span, err)
                                }()
                            Severity: Major
                            Found in services/rfq/relayer/inventory/manager.go - About 1 hr to fix

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

                              func (r *HarmonyProxy) getLogsHarmonyVerify(parentCtx context.Context, query ethereum.FilterQuery, rawBody []byte) (rawResp []byte, err error) {
                                  ctx, span := r.tracer.Start(parentCtx, "getLogsHarmonyVerify")
                              
                                  defer func() {
                                      metrics.EndSpanWithErr(span, err)
                              Severity: Minor
                              Found in services/omnirpc/modules/harmonyproxy/harmonyproxy.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 Relayer.handleBridgeRequestedLog has 13 return statements (exceeds 4 allowed).
                              Open

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

                                Method rebalanceManagerSynapseCCTP.listen has 13 return statements (exceeds 4 allowed).
                                Open

                                func (c *rebalanceManagerSynapseCCTP) listen(parentCtx context.Context, chainID int) (err error) {
                                    listener, ok := c.chainListeners[chainID]
                                    if !ok {
                                        return fmt.Errorf("could not find listener for chain %d", chainID)
                                    }
                                Severity: Major
                                Found in services/rfq/relayer/inventory/synapse.go - About 1 hr to fix

                                  Function EnableGraphql has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func EnableGraphql(engine *gin.Engine, consumerDB db.ConsumerDB, fetcher fetcher.ScribeFetcher, apiCache cache.Service, clients map[uint32]etherClient.EVM, parsers *types.ServerParsers, refs *types.ServerRefs, swapFilters map[string]*swap.SwapFlashLoanFilterer, config serverConfig.Config, handler metrics.Handler) {
                                  Severity: Major
                                  Found in services/explorer/graphql/server/gin.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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language