synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function WaitForConfirmation has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
Open

func WaitForConfirmation(ctx context.Context, client ConfirmationClient, transaction *types.Transaction, timeout time.Duration) {
    // if tx is nil , we should panic here so we can see the call context
    _ = transaction.Hash()

    const debugTimeout = time.Second * 5
Severity: Minor
Found in ethergo/backends/base/base.go - 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 SwapParser.Parse has 41 return statements (exceeds 4 allowed).
Open

func (p *SwapParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error) {
    logTopic := log.Topics[0]

    iFace, err := func(log ethTypes.Log) (swapTypes.EventLog, error) {
        // nolint:nestif
Severity: Major
Found in services/explorer/consumer/parser/swapparser.go - About 3 hrs to fix

    Function DumpWithOptions has 114 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func DumpWithOptions(showReq bool, showResp bool, showBody bool, showHeaders bool, showCookies bool, cb func(dumpStr string)) gin.HandlerFunc {
        headerHiddenFields := make([]string, 0)
        bodyHiddenFields := make([]string, 0)
    
        if !showCookies {
    Severity: Major
    Found in core/ginhelper/gindump.go - About 3 hrs to fix

      Method ScribeSuite.TestChainIndexerLivefill has 114 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (s *ScribeSuite) TestChainIndexerLivefill() {
          if os.Getenv("CI") != "" || !s.runVolumeTest {
              s.T().Skip("This is a long running test")
          }
          const numberOfContracts = 5
      Severity: Major
      Found in services/scribe/service/chain_test.go - About 3 hrs to fix

        Method APISuite.TestGetBridgeTransactions has 113 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (g APISuite) TestGetBridgeTransactions() {
            chainID := g.chainIDs[0]
            destinationChainID := g.chainIDs[1]
            contractAddr := common.BigToAddress(big.NewInt(gofakeit.Int64())).String()
            tokenAddress := common.BigToAddress(big.NewInt(gofakeit.Int64())).String()
        Severity: Major
        Found in services/explorer/api/resolver_test.go - About 3 hrs to fix

          Function StakePage has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const StakePage = () => {
            const { chain: connectedChain } = useAccount()
            const { address: currentAddress } = useAccount()
            const [address, setAddress] = useState(undefined)
            const [isClient, setIsClient] = useState<boolean>(false)
          Severity: Major
          Found in packages/synapse-interface/pages/stake/index.tsx - About 3 hrs to fix

            Function NewAnvilBackend has 112 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func NewAnvilBackend(ctx context.Context, t *testing.T, args *OptionBuilder) (*Backend, error) {
                t.Helper()
            
                pool, err := dockertest.NewPool("")
                if err != nil {
            Severity: Major
            Found in ethergo/backends/anvil/anvil.go - About 3 hrs to fix

              Function useBridgeValidations has 87 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const useBridgeValidations = () => {
                const { chainId } = useAccount()
                const {
                  fromChainId,
                  toChainId,

                Method executionContext.field_Query_logsRange_args has 111 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (ec *executionContext) field_Query_logsRange_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_logsRange_args has 111 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (ec *executionContext) field_Query_logsRange_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

                    Function GetPartialInfoFromBridgeEventHybrid has 110 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func GetPartialInfoFromBridgeEventHybrid(bridgeEvent sql.HybridBridgeEvent, includePending *bool) (*model.BridgeTransaction, error) {
                        if includePending != nil && *includePending && bridgeEvent.TTxHash != "" {
                            // nolint:nilnil
                            return nil, nil
                        }
                    Severity: Major
                    Found in services/explorer/graphql/server/graph/queryutils.go - About 3 hrs to fix

                      Function useFromTokenListArray has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const useFromTokenListArray = (searchStr: string = '') => {
                        const { fromTokens, fromChainId } = useBridgeState()
                        const portfolioBalances = usePortfolioBalances()
                      
                        const t = useTranslations('Bridge')

                        Function setDestinationChainId has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            setDestinationChainId: (
                              state: BridgeState,
                              action: PayloadAction<number>
                            ) => {
                              const incomingToChainId = action.payload
                        Severity: Major
                        Found in packages/widget/src/state/slices/bridge/reducer.ts - About 3 hrs to fix

                          Function setOriginChainId has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              setOriginChainId: (state: BridgeState, action: PayloadAction<number>) => {
                                const incomingFromChainId = action.payload
                          
                                const validFromTokens = getFromTokens({
                                  fromChainId: incomingFromChainId ?? null,
                          Severity: Major
                          Found in packages/widget/src/state/slices/bridge/reducer.ts - About 3 hrs to fix

                            Function CrossChainExchangeIcon has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function CrossChainExchangeIcon() {
                              return (
                                <svg
                                  width="335"
                                  height="196"

                              Function useConfirmNewBridgePrice has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const useConfirmNewBridgePrice = () => {
                                const triggerQuoteRef = useRef<BridgeQuote | null>(null)
                                const bpsThreshold = 0.0001 // 1bps
                              
                                const [hasQuoteOutputChanged, setHasQuoteOutputChanged] =

                                Function Home has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function Home() {
                                  const [config, setConfig] = useState<ConsumerExampleConfig>(initialConfig)
                                  const [container, setContainer] = useState(false)
                                
                                  const { web3Provider } = useEthereumWallet()
                                Severity: Major
                                Found in packages/widget/examples/landing-page/src/app/page.tsx - About 3 hrs to fix

                                  File typecast.go has 555 lines of code (exceeds 500 allowed). Consider refactoring.
                                  Open

                                  package testutil
                                  
                                  import (
                                      "context"
                                      "fmt"
                                  Severity: Minor
                                  Found in agents/testutil/typecast.go - About 3 hrs to fix

                                    Function useMaintenance has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const useMaintenance = () => {
                                      const { pausedChainsList, pausedModulesList } = useMaintenanceData()
                                      const { fromChainId: bridgeFromChainId, toChainId: bridgeToChainId } =
                                        useBridgeState()
                                      const { swapChainId } = useSwapState()
                                    Severity: Major
                                    Found in packages/synapse-interface/components/Maintenance/Maintenance.tsx - About 3 hrs to fix

                                      Function bridgeController has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export const bridgeController = 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/bridgeController.ts - About 3 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language