synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function _applySlippage has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export const _applySlippage = (
  inputValue,
  slippageSelected,
  slippageCustom,
  add = false
Severity: Minor
Found in packages/synapse-interface/utils/slippage.ts - About 3 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 executionContext.field_Query_logsAtHeadRange_args has 102 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    Method executionContext.field_Query_logsAtHeadRange_args has 102 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      File docs.go has 544 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      // Package docs Code generated by swaggo/swag. DO NOT EDIT
      package docs
      
      import "github.com/swaggo/swag"
      
      
      Severity: Minor
      Found in services/rfq/api/docs/docs.go - About 3 hrs to fix

        Function executeSearch has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const executeSearch = (searchPage?: number, searchTxOrKappaHash?: string) => {
            const queryPage = searchPage ?? page
            const queryKappa = searchTxOrKappaHash ?? kappa
            if (queryKappa && queryKappa !== '' && queryKappa.length < 64) {
              alert('Invalid hash entered')
        Severity: Major
        Found in packages/explorer-ui/pages/txs/index.tsx - About 3 hrs to fix

          File fastBridgeRouter.test.ts has 292 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { mock } from 'jest-mock-extended'
          import { BigNumber, providers } from 'ethers'
          import { Log, TransactionReceipt } from '@ethersproject/abstract-provider'
          
          import { FastBridgeRouter } from './fastBridgeRouter'
          Severity: Minor
          Found in packages/sdk-router/src/rfq/fastBridgeRouter.test.ts - About 3 hrs to fix

            AnvilSuite has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

            func (a *AnvilSuite) TestClientImpersonateAccount() {
                ogCount, err := a.counter.GetVitalikCount(&bind.CallOpts{Context: a.GetTestContext()})
                Nil(a.T(), err)
            
                err = a.client.ImpersonateAccount(a.GetTestContext(), vitalik)
            Severity: Minor
            Found in ethergo/backends/anvil/client_test.go - About 3 hrs to fix

              Method Executor.Execute has 100 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (e Executor) Execute(parentCtx context.Context, message types.Message) (_ bool, err error) {
                  originDomain := message.OriginDomain()
                  destinationDomain := message.DestinationDomain()
              
                  ctx, span := e.handler.Tracer().Start(parentCtx, "Execute", trace.WithAttributes(
              Severity: Major
              Found in agents/agents/executor/executor.go - About 3 hrs to fix

                Method APISuite.TestAmountStatistic has 99 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (g APISuite) TestAmountStatistic() {
                    chainID := g.chainIDs[0]
                    destinationChainIDA := g.chainIDs[1]
                    destinationChainIDB := g.chainIDs[2]
                    address := common.BigToAddress(big.NewInt(gofakeit.Int64()))
                Severity: Major
                Found in services/explorer/api/resolver_test.go - About 2 hrs to fix

                  Function setSwapChainId has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      setSwapChainId: (state, action: PayloadAction<number>) => {
                        const incomingFromChainId = action.payload
                  
                        const validFromTokens = _(
                          getSwapFromTokens({
                  Severity: Major
                  Found in packages/synapse-interface/slices/swap/reducer.ts - About 2 hrs to fix

                    File event_db.go has 539 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    // Code generated by mockery v2.14.0. DO NOT EDIT.
                    
                    package mocks
                    
                    import (
                    Severity: Minor
                    Found in services/scribe/db/mocks/event_db.go - About 2 hrs to fix

                      File query.test.ts has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { BigNumber } from '@ethersproject/bignumber'
                      
                      import {
                        RouterQuery,
                        CCTPRouterQuery,
                      Severity: Minor
                      Found in packages/sdk-router/src/module/query.test.ts - About 2 hrs to fix

                        File NerveLogoSvg.tsx has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        export const NerveLogoSvg = ({ className = '' }) => {
                          return (
                            <svg
                              className={`w-8 ${className}`}
                              fillRule="nonzero"
                        Severity: Minor
                        Found in packages/explorer-ui/components/icons/NerveLogoSvg.tsx - About 2 hrs to fix

                          Function NewExecutor has 98 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func NewExecutor(ctx context.Context, config executor.Config, executorDB db.ExecutorDB, scribeClient client.ScribeClient, omniRPCClient omnirpcClient.RPCClient, handler metrics.Handler) (*Executor, error) {
                              chainExecutors := make(map[uint32]*chainExecutor)
                          
                              conn, grpcClient, err := makeScribeClient(ctx, handler, fmt.Sprintf("%s:%d", scribeClient.URL, scribeClient.Port))
                              if err != nil {
                          Severity: Major
                          Found in agents/agents/executor/executor.go - About 2 hrs to fix

                            Method GuardSuite.TestFraudulentAttestationOnDestination has 98 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (g *GuardSuite) TestFraudulentAttestationOnDestination() {
                                testDone := false
                                defer func() {
                                    testDone = true
                                }()
                            Severity: Major
                            Found in agents/agents/guard/fraud_test.go - About 2 hrs to fix

                              Method GuardSuite.TestReportFraudulentStateInAttestation has 98 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (g *GuardSuite) TestReportFraudulentStateInAttestation() {
                                  testDone := false
                                  defer func() {
                                      testDone = true
                                  }()
                              Severity: Major
                              Found in agents/agents/guard/fraud_test.go - About 2 hrs to fix

                                Function createParsers has 98 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func createParsers(ctx context.Context, db db.ConsumerDB, fetcher fetcherpkg.ScribeFetcher, clients map[uint32]etherClient.EVM, config serverConfig.Config) (*types.ServerParsers, *types.ServerRefs, map[string]*swap.SwapFlashLoanFilterer, error) {
                                    ethClient, err := ethclient.DialContext(ctx, config.RPCURL+fmt.Sprintf("%d", 1))
                                    if err != nil {
                                        return nil, nil, nil, fmt.Errorf("could not create client: %w", err)
                                    }
                                Severity: Major
                                Found in services/explorer/api/server.go - About 2 hrs to fix

                                  Method Indexer.store has 98 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func (x *Indexer) store(parentCtx context.Context, log types.Log) (err error) {
                                      ctx, span := x.handler.Tracer().Start(parentCtx, "store", trace.WithAttributes(
                                          attribute.String("contract", x.addressesToString(x.indexerConfig.Addresses)),
                                          attribute.String("tx", log.TxHash.Hex()),
                                          attribute.String("block", fmt.Sprintf("%d", log.BlockNumber)),
                                  Severity: Major
                                  Found in services/scribe/service/indexer/indexer.go - About 2 hrs to fix

                                    Function LandingNav has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function LandingNav() {
                                      const t = useTranslations('Nav')
                                    
                                      return (
                                        <Popover>

                                      Function PoolsPage has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const PoolsPage = () => {
                                        const { address: currentAddress } = useAccount()
                                        const { chain } = useAccount()
                                        const [connectedChainId, setConnectedChainId] = useState(0)
                                        const [address, setAddress] = useState(undefined)
                                      Severity: Major
                                      Found in packages/synapse-interface/pages/pools/index.tsx - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language