synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function getFromTokens has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const getFromTokens = ({
  fromChainId,
  fromTokenRouteSymbol,
  toChainId,
  toTokenRouteSymbol,
Severity: Minor
Found in packages/widget/src/utils/routeMaker/getFromTokens.ts - 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 getToChainIds has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const getToChainIds = ({
  fromChainId,
  fromTokenRouteSymbol,
  toChainId,
  toTokenRouteSymbol,
Severity: Minor
Found in packages/widget/src/utils/routeMaker/getToChainIds.ts - 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 approve has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const approve = async (
  pool: Token,
  depositQuote: any,
  inputValue: Record<string, bigint>,
  chainId: number
Severity: Minor
Found in packages/synapse-interface/utils/actions/approveAndDeposit.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

Method ListenerTestSuite.TestListenForEvents has 85 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (l *ListenerTestSuite) TestListenForEvents() {
    _, handle := l.manager.GetCounter(l.GetTestContext(), l.backend)
    var wg sync.WaitGroup
    const iterations = 10
    for i := 0; i < iterations; i++ {
Severity: Major
Found in ethergo/listener/listener_test.go - About 2 hrs to fix

    Method Resolver.bwDestinationFallback has 85 lines of code (exceeds 50 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: Major
    Found in services/explorer/graphql/server/graph/fetcher.go - About 2 hrs to fix

      Function GetDefiLlamaData has 85 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func GetDefiLlamaData(ctx context.Context, timestamp int, coinGeckoID string) *float64 {
          zero := float64(0)
      
          if coinGeckoID == "NO_TOKEN" || coinGeckoID == "NO_PRICE" {
              // if there is no data on the token, the amount returned will be 1:1 (price will be same as the amount of token
      Severity: Major
      Found in services/explorer/consumer/fetcher/pricefetcher.go - About 2 hrs to fix

        Method queryResolver.BridgeTransactions has 19 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

          Method Client.GetBridgeTransactions has 19 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (c *Client) GetBridgeTransactions(ctx context.Context, chainIDTo []*int, chainIDFrom []*int, addressTo *string, addressFrom *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, kappa *string, pending *bool, page *int, tokenAddressFrom []*string, tokenAddressTo []*string, useMv *bool, httpRequestOptions ...client.HTTPRequestOption) (*GetBridgeTransactions, error) {
          Severity: Major
          Found in services/explorer/graphql/client/client.go - About 2 hrs to fix

            Method queryResolver.GetBridgeTxsFromDestination has 19 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

              Function TestEncodeSnapshotParity has 84 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func TestEncodeSnapshotParity(t *testing.T) {
                  ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
                  defer cancel()
              
                  testBackend := simulated.NewSimulatedBackend(ctx, t)
              Severity: Major
              Found in agents/types/parity_test.go - About 2 hrs to fix

                Method executionContext.field_Query_messageBusTransactions_args has 84 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (ec *executionContext) field_Query_messageBusTransactions_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: Major
                Found in services/explorer/graphql/server/graph/resolver/server.go - About 2 hrs to fix

                  Method executionContext.field_Query_logs_args has 84 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

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

                    Method executionContext.field_Query_transactionsAtHeadRange_args has 84 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

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

                      Method executionContext.field_Query_logs_args has 84 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

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

                        Method executionContext.field_Query_transactionsAtHeadRange_args has 84 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (ec *executionContext) field_Query_transactionsAtHeadRange_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/scribe/graphql/server/graph/resolver/server.go - About 2 hrs to fix

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

                              setSwapFromToken: (state, action: PayloadAction<Token>) => {
                                const incomingFromToken = action.payload
                          
                                const validFromChainIds = getSwapFromChainIds({
                                  fromChainId: state.swapChainId ?? null,
                          Severity: Major
                          Found in packages/synapse-interface/slices/swap/reducer.ts - About 2 hrs to fix

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

                                setSwapToToken: (state, action: PayloadAction<Token>) => {
                                  const incomingToToken = action.payload
                            
                                  const validFromChainIds = getSwapFromChainIds({
                                    fromChainId: state.swapChainId ?? null,
                            Severity: Major
                            Found in packages/synapse-interface/slices/swap/reducer.ts - About 2 hrs to fix

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

                              export const getTransactionById = async (req: Request, res: Response) => {
                                const { transactionId } = req.params
                              
                                try {
                                  const query = db
                              Severity: Major
                              Found in packages/rfq-indexer/api/src/controllers/transactionIdController.ts - About 2 hrs to fix

                                File reducer.ts has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import _ from 'lodash'
                                import { createSlice, PayloadAction } from '@reduxjs/toolkit'
                                
                                import { DAI, USDC } from '@/constants/tokens/bridgeable'
                                import { EMPTY_SWAP_QUOTE } from '@/constants/swap'
                                Severity: Minor
                                Found in packages/synapse-interface/slices/swap/reducer.ts - About 2 hrs to fix

                                  File getSwapFromChainIds.ts has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import _ from 'lodash'
                                  
                                  import {
                                    EXISTING_SWAP_ROUTES,
                                    SWAP_CHAIN_IDS,
                                  Severity: Minor
                                  Found in packages/synapse-interface/utils/swapFinder/getSwapFromChainIds.ts - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language