synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function PoolInfoSection has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PoolInfoSection = () => {
  const { pool, poolData, isLoading } = usePoolDataState()

  const t = useTranslations('Pools.Other')

Severity: Major
Found in packages/synapse-interface/pages/pool/PoolInfoSection/index.tsx - About 2 hrs to fix

    ProxySuite has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    func (p *ProxySuite) captureResponse(backendURL string, makeReq func(client ethClient.EVMClient), checkResp func(req []rpc.Request, response proxy.JSONRPCMessage, rawResponse []byte)) {
        doneChan := make(chan bool)
    
        parsedURL, err := url.Parse(backendURL)
        Nil(p.T(), err)
    Severity: Minor
    Found in services/omnirpc/proxy/response_test.go - About 2 hrs to fix

      Method rebalanceManagerSynapseCCTP.listen has 83 lines of code (exceeds 50 allowed). Consider refactoring.
      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 2 hrs to fix

        Method Relayer.handleBridgeRequestedLog has 83 lines of code (exceeds 50 allowed). Consider refactoring.
        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 2 hrs to fix

          File Grid.tsx has 262 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
          @NOTE: super repetitive code here is actually necessary...
          */
          
          const GRID_COLS_LOOKUP = {
          Severity: Minor
          Found in packages/explorer-ui/components/tailwind/Grid.tsx - About 2 hrs to fix

            Method queryResolver.AddressData has 82 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (r *queryResolver) AddressData(ctx context.Context, address string) (*model.AddressData, error) {
                bridgeQuery := fmt.Sprintf("SELECT toFloat64(sumKahan(famount_usd)) AS volumeTotal, toFloat64(sumKahan(tfee_amount_usd)) AS feeTotal, toInt64(uniq(fchain_id, ftx_hash)) AS txTotal FROM (SELECT * FROM mv_bridge_events where fsender = '%s' LIMIT 1 BY fchain_id,fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash)", address)
                swapQuery := fmt.Sprintf("SELECT toFloat64(sumKahan(multiIf(event_type = 0, amount_usd[sold_id], event_type = 1, arraySum(mapValues(amount_usd)), event_type = 9, arraySum(mapValues(amount_usd)), event_type = 10, amount_usd[sold_id],0))) AS volumeTotal, toFloat64(sumKahan(arraySum(mapValues(fee_usd)))) AS feeTotal,  toInt64(uniq(chain_id, tx_hash)) AS txTotal FROM (SELECT * FROM swap_events where sender = '%s' LIMIT 1 BY chain_id, contract_address, event_type, block_number, event_index, tx_hash)", address)
                rankingQuery := fmt.Sprintf("select rowNumber from (select sender, row_number() over (order by sumTotal desc ) as rowNumber from (select fsender as sender, sumKahan(famount_usd) as sumTotal from (SELECT * FROM mv_bridge_events where fsender != '' LIMIT 1 BY fchain_id, fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash) where fsender != '' group by fsender)) where sender = '%s'", address)
                firstTx := fmt.Sprintf("SELECT min(ftimestamp) AS earliestTime FROM (SELECT * FROM mv_bridge_events where fsender = '%s' LIMIT 1 BY fchain_id,fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash)", address)
            Severity: Major
            Found in services/explorer/graphql/server/graph/queries.resolvers.go - About 2 hrs to fix

              Method Resolver.getAndParseLogs has 82 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (r Resolver) getAndParseLogs(ctx context.Context, logFetcher *indexer.LogFetcher, chainID uint32, kappa string, bridgeType model.BridgeType) (interface{}, error) {
                  streamLogsCtx, cancelStreamLogs := context.WithCancel(ctx)
                  logsChan := *logFetcher.GetFetchedLogsChan()
                  destinationData := make(chan *ifaceBridgeEvent, 1)
                  destinationDataCCTP := make(chan *ifaceCCTPEvent, 1)
              Severity: Major
              Found in services/explorer/graphql/server/graph/fetcher.go - About 2 hrs to fix

                Function bridgeTxInfoController has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const bridgeTxInfoController = async (req, res) => {
                  const errors = validationResult(req)
                  if (!errors.isEmpty()) {
                    return res.status(400).json({ errors: errors.array() })
                  }
                Severity: Major
                Found in packages/rest-api/src/controllers/bridgeTxInfoController.ts - About 2 hrs to fix

                  Function Footer has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function Footer() {
                    return (
                      <footer>
                        <div>
                          <a href="https://synapseprotocol.com/landing">
                  Severity: Major
                  Found in packages/widget/examples/landing-page/src/components/Footer.tsx - About 2 hrs to fix

                    Function Appearance has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const Appearance = () => {
                      return (
                        <>
                                <h4>Dark mode</h4>
                          <p>
                    Severity: Major
                    Found in packages/widget/examples/landing-page/src/components/Appearance.tsx - About 2 hrs to fix

                      Method txSubmitterImpl.processQueue has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (t *txSubmitterImpl) processQueue(parentCtx context.Context) (err error) {
                          // TODO: this might be too short of a deadline depending on the number of pendingTxes in the queue
                          deadlineCtx, cancel := context.WithTimeout(parentCtx, time.Second*60)
                          defer cancel()
                      
                      
                      Severity: Minor
                      Found in ethergo/submitter/queue.go - About 2 hrs 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 Executor.setMinimumTime has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (e Executor) setMinimumTime(parentCtx context.Context, chainID uint32) (err error) {
                          backoffInterval := time.Duration(0)
                      
                          for {
                              select {
                      Severity: Minor
                      Found in agents/agents/executor/executor.go - About 2 hrs 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 inventoryManagerImpl.Start has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (i *inventoryManagerImpl) Start(ctx context.Context) error {
                          g, ctx := errgroup.WithContext(ctx)
                          for _, rebalanceManager := range i.rebalanceManagers {
                              rebalanceManager := rebalanceManager
                              g.Go(func() error {
                      Severity: Minor
                      Found in services/rfq/relayer/inventory/manager.go - About 2 hrs 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.GetBridgeTxs has 18 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func (r *queryResolver) GetBridgeTxs(ctx context.Context, chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, tokenAddressTo []*string, tokenAddressFrom []*string, kappa *string, pending *bool, onlyCctp *bool, page *int) ([]*model.BridgeTransaction, error) {
                      Severity: Major
                      Found in services/explorer/graphql/server/graph/queryutils.go - About 2 hrs to fix

                        Method Resolver.bwDestinationFallback has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (r Resolver) bwDestinationFallback(ctx context.Context, chainID uint32, address string, identifier string, timestamp int, historical bool, bridgeType model.BridgeType) (*model.BridgeWatcherTx, error) {
                            txFetchContext, cancelTxFetch := context.WithTimeout(ctx, maxTimeToWaitForTx)
                            defer cancelTxFetch()
                        
                            b := &backoff.Backoff{
                        Severity: Minor
                        Found in services/explorer/graphql/server/graph/fetcher.go - About 2 hrs 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 ScribeSuite.TestLivefillParity has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (s *ScribeSuite) TestLivefillParity() {
                            if os.Getenv("CI") != "" {
                                s.T().Skip("Network test flake")
                            }
                            const blockRange = uint64(100)
                        Severity: Minor
                        Found in services/scribe/service/scribe_test.go - About 2 hrs 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 Receipt has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const Receipt = ({ quote, loading, send, receive }) => {
                          const { originChainId, destinationChainId } = useBridgeState()
                        
                          const estTime = useMemo(() => {
                            if (!quote.estimatedTime) {
                        Severity: Minor
                        Found in packages/widget/src/components/Receipt.tsx - About 2 hrs 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 DecodeConfig has 81 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func DecodeConfig(filePath string) (_ Config, err error) {
                            cfg := &Config{}
                            input, err := os.ReadFile(filepath.Clean(filePath))
                            if err != nil {
                                return Config{}, fmt.Errorf("failed to read file: %w", err)
                        Severity: Major
                        Found in contrib/promexporter/config/config.go - About 2 hrs to fix

                          Function TestEstimateGasWithPrice has 81 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func TestEstimateGasWithPrice(t *testing.T) {
                              t.Parallel()
                              key, _ := crypto.GenerateKey()
                              addr := crypto.PubkeyToAddress(key.PublicKey)
                          
                          
                          Severity: Major
                          Found in ethergo/backends/simulated/multibackend/simulated_gen_test.go - About 2 hrs to fix

                            Method server.StreamLogs has 81 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (s *server) StreamLogs(req *pbscribe.StreamLogsRequest, res pbscribe.ScribeService_StreamLogsServer) error {
                                streamNewBlocks := false
                                retrieveLogsBackoff := 3
                                fromBlock, toBlock, err := s.setBlocks(res.Context(), req)
                                if err != nil {
                            Severity: Major
                            Found in services/scribe/grpc/server/server.go - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language