synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Method executionContext._Query has 58 return statements (exceeds 4 allowed).
Open

func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
    fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors)
    ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
        Object: "Query",
    })
Severity: Major
Found in services/scribe/graphql/server/graph/resolver/server.go - About 5 hrs to fix

    Function Wallet has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const Wallet = () => {
      const { connector: activeConnector, address: connectedAddress } = useAccount()
      const { chain: currentChain } = useAccount()
      const walletId = activeConnector?.id
    
    
    Severity: Major
    Found in packages/synapse-interface/components/Wallet.tsx - About 5 hrs to fix

      File evm.go has 624 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 ethergo/client/mocks/evm.go - About 5 hrs to fix

        File evm_client.go has 624 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 ethergo/chain/client/mocks/evm_client.go - About 5 hrs to fix

          File index.tsx has 374 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { Fragment } from 'react'
          import { Popover, Transition } from '@headlessui/react'
          import { DocumentTextIcon, MenuIcon, XIcon } from '@heroicons/react/outline'
          // import { useActiveWeb3React } from '@hooks/wallet/useActiveWeb3React'
          import {
          Severity: Minor
          Found in packages/explorer-ui/components/layouts/MainLayout/index.tsx - About 5 hrs to fix

            Function Portfolio has 123 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const Portfolio = () => {
              const dispatch = useAppDispatch()
              const { fromChainId }: BridgeState = useBridgeState()
              const {
                activeTab,
            Severity: Major
            Found in packages/synapse-interface/components/Portfolio/Portfolio.tsx - About 4 hrs to fix

              Function createParsers has a Cognitive Complexity of 48 (exceeds 20 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: Minor
              Found in services/explorer/api/server.go - About 4 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 getChainBackfiller has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
              Open

              func getChainBackfiller(consumerDB db.ConsumerDB, chainConfig indexerConfig.ChainConfig, fetcher fetcherpkg.ScribeFetcher, client bind.ContractBackend, tokenDataService tokendata.Service, priceDataService tokenprice.Service) (*backfill.ChainBackfiller, error) {
                  var err error
                  var bridgeParser *parser.BridgeParser
                  var messageBusParser *parser.MessageBusParser
                  var cctpParser *parser.CCTPParser
              Severity: Minor
              Found in services/explorer/node/explorer.go - About 4 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 Indexer.Index has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
              Open

              func (x *Indexer) Index(parentCtx context.Context, startHeight uint64, endHeight uint64) (err error) {
                  ctx, span := x.handler.Tracer().Start(parentCtx, "contract.Backfill", trace.WithAttributes(
                      attribute.Int("chain", int(x.indexerConfig.ChainID)),
                      attribute.String("address", x.addressesToString(x.indexerConfig.Addresses)),
                      attribute.Int("start", int(startHeight)),
              Severity: Minor
              Found in services/scribe/service/indexer/indexer.go - About 4 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 StateManagedSwap has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

              const StateManagedSwap = () => {
                const { address } = useAccount()
                const { synapseSDK } = useSynapseContext()
                const swapDisplayRef = useRef(null)
                const quoteToastRef = useRef({ id: '' })
              Severity: Minor
              Found in packages/synapse-interface/pages/swap/index.tsx - About 4 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 NotarySuite.TestNotaryE2E has 142 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (u *NotarySuite) TestNotaryE2E() {
                  guardTestConfig := config.AgentConfig{
                      Domains: map[string]config.DomainConfig{
                          "origin_client":      u.OriginDomainClient.Config(),
                          "destination_client": u.DestinationDomainClient.Config(),
              Severity: Major
              Found in agents/agents/notary/notary_test.go - About 4 hrs to fix

                Function AddressPage has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const AddressPage = () => {
                  const router = useRouter()
                  const { address } = router.query
                
                  const [platform, setPlatform] = useState('ALL')
                Severity: Major
                Found in packages/explorer-ui/pages/address/[address].tsx - About 4 hrs to fix

                  LifecycleClient has 36 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type LifecycleClient struct {
                      underlyingClient EVMClient
                      Permitter
                      // chainID is the chain id used for the client
                      chainID *big.Int
                  Severity: Minor
                  Found in ethergo/chain/client/lifecycle.go - About 4 hrs to fix

                    IGasOracle has 36 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type IGasOracle struct {
                        mock.Mock
                    }
                    Severity: Minor
                    Found in agents/contracts/gasoracle/mocks/i_gas_oracle.go - About 4 hrs to fix

                      EventDB has 36 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type EventDB struct {
                          mock.Mock
                      }
                      Severity: Minor
                      Found in services/scribe/db/mocks/event_db.go - About 4 hrs to fix

                        Function getCmpTestCases has 140 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func getCmpTestCases() []*cmpTestCase {
                            // this will serve as a fuzz test for legacy txes
                            gofakeit.Seed(time.Now().UnixNano())
                        
                            // gasPriceTests test gas price v gas price
                        Severity: Major
                        Found in ethergo/chain/gas/cmp_test.go - About 4 hrs to fix

                          Method GuardSuite.TestInvalidReceipt has 140 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

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

                            Method Resolver.getAndParseLogs has a Cognitive Complexity of 46 (exceeds 20 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: Minor
                            Found in services/explorer/graphql/server/graph/fetcher.go - About 4 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 ChainBackfiller.backfillContractLogs has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (c *ChainBackfiller) backfillContractLogs(parentCtx context.Context, contract indexerconfig.ContractConfig) (err error) {
                                // make the event parser
                                eventParser, err := c.makeEventParser(contract)
                                if err != nil {
                                    return err
                            Severity: Minor
                            Found in services/explorer/backfill/chain.go - About 4 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 render has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const render = useMemo(() => {
                                return (
                                  <ConnectButton.Custom>
                                    {({
                                      account,
                            Severity: Major
                            Found in packages/synapse-interface/components/Wallet.tsx - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language