synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Method executionContext.field_Query_receipts_args has 75 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (ec *executionContext) field_Query_receipts_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["chain_id"]; ok {
Severity: Minor
Found in services/explorer/consumer/client/resolver-client/server.go - About 2 hrs to fix

    Method executionContext.field_Query_receipts_args has 75 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (ec *executionContext) field_Query_receipts_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["chain_id"]; ok {
    Severity: Minor
    Found in services/scribe/graphql/server/graph/resolver/server.go - About 2 hrs to fix

      Method executionContext.field_Query_transactionsRange_args has 75 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (ec *executionContext) field_Query_transactionsRange_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 2 hrs to fix

        Function IntegrationSection has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function IntegrationSection() {
          const OrderedSupportedNetworks: Chain[] = ORDERED_CHAINS_BY_ID.filter(
            (chainId) => Number(chainId) !== ChainId.TERRA
          ).map((chainId) => {
            return CHAINS_BY_ID[chainId]

          Method SimulatedBackendsTestSuite.SetupBackends has 74 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (a *SimulatedBackendsTestSuite) SetupBackends() {
              useAnvil := a.shouldUseAnvil()
              a.TestDeployManager = NewDeployManager(a.T())
          
              var wg sync.WaitGroup
          Severity: Minor
          Found in agents/testutil/simulated_backends_suite.go - About 1 hr to fix

            Method BackfillSuite.mintAndSwapParity has 74 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

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

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

              func Start(ctx context.Context, cfg serverConfig.Config, handler metrics.Handler) error {
                  router := ginhelper.New(logger)
                  router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
              
                  // initialize the database
              Severity: Minor
              Found in services/explorer/api/server.go - About 1 hr to fix

                Function getBridgeRoutes has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public async getBridgeRoutes(
                    originChainId: number,
                    destChainId: number,
                    tokenIn: string,
                    tokenOut: string,
                Severity: Minor
                Found in packages/sdk-router/src/router/routerSet.ts - About 1 hr to fix

                  Method DBSuite.TestGetSnapshotRootsInNonceRange has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (t *DBSuite) TestGetSnapshotRootsInNonceRange() {
                      t.RunOnAllDBs(func(testDB db.ExecutorDB) {
                          origin := gofakeit.Uint32()
                          nonceA := uint32(5)
                          nonceB := uint32(10)
                  Severity: Minor
                  Found in agents/agents/executor/db/state_test.go - About 1 hr to fix

                    Function NewGuard has 73 lines of code (exceeds 50 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

                      Method ExecutorSuite.TestVerifyMessageMerkleProof has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (e *ExecutorSuite) TestVerifyMessageMerkleProof() {
                          // TODO (joe and lex): FIX ME
                          // e.T().Skip()
                          chainID := uint32(e.TestBackendOrigin.GetChainID())
                          destination := uint32(e.TestBackendDestination.GetChainID())
                      Severity: Minor
                      Found in agents/agents/executor/executor_test.go - About 1 hr to fix

                        Method inventoryManagerImpl.initializeTokens has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (i *inventoryManagerImpl) initializeTokens(parentCtx context.Context, cfg relconfig.Config) (err error) {
                            i.mux.Lock()
                            defer i.mux.Unlock()
                        
                            ctx, span := i.handler.Tracer().Start(parentCtx, "initializeTokens", trace.WithAttributes(
                        Severity: Minor
                        Found in services/rfq/relayer/inventory/manager.go - About 1 hr to fix

                          Function getRebalanceAmount has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func getRebalanceAmount(ctx context.Context, cfg relconfig.Config, tokens map[int]map[common.Address]*TokenMetadata, rebalance *RebalanceData) (amount *big.Int, err error) {
                              span := trace.SpanFromContext(ctx)
                          
                              // get the maintenance and initial values for the destination chain
                              maintenancePctDest, err := cfg.GetMaintenanceBalancePct(rebalance.DestMetadata.ChainID, rebalance.DestMetadata.Addr.Hex())
                          Severity: Minor
                          Found in services/rfq/relayer/inventory/rebalance.go - About 1 hr to fix

                            Method executionContext.fieldContext_Query_dailyStatisticsByChain has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (ec *executionContext) fieldContext_Query_dailyStatisticsByChain(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
                                fc = &graphql.FieldContext{
                                    Object:     "Query",
                                    Field:      field,
                                    IsMethod:   true,
                            Severity: Minor
                            Found in services/explorer/graphql/server/graph/resolver/server.go - About 1 hr to fix

                              Function NewCCTPRelayer has 73 lines of code (exceeds 50 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 1 hr to fix

                                Function TestValidateOptions has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func TestValidateOptions(t *testing.T) {
                                    ctx := context.Background()
                                    resource := &dockertest.Resource{
                                        Container: &docker.Container{
                                            ID: "test-container-id",
                                Severity: Minor
                                Found in core/dockerutil/options_test.go - About 1 hr to fix

                                  Function swapController has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const swapController = 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/swapController.ts - About 1 hr to fix

                                    Method WatcherSuite.TestListeners has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    func (s *WatcherSuite) TestListeners() {
                                        // timeout the test after thie period
                                        ctx, cancel := context.WithTimeout(s.GetTestContext(), 30*time.Second)
                                        defer cancel()
                                    
                                    
                                    Severity: Minor
                                    Found in ethergo/chain/watcher/contractwatcher_test.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 GuardSuite.TestUpdateAgentStatusOnRemote has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    func (g *GuardSuite) TestUpdateAgentStatusOnRemote() {
                                        // This test requires a call to anvil's evm.IncreaseTime() cheat code, so we should
                                        // set up the backends with anvil.
                                    
                                        testDone := false
                                    Severity: Minor
                                    Found in agents/agents/guard/fraud_test.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.runChainIndexer has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    func (r *Relayer) runChainIndexer(ctx context.Context, chainID int) (err error) {
                                        chainListener := r.chainListeners[chainID]
                                    
                                        parser, err := fastbridge.NewParser(chainListener.Address())
                                        if err != nil {
                                    Severity: Minor
                                    Found in services/rfq/relayer/service/chainindexer.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language