synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Avoid too many return statements within this function.
Open

    return _(EXISTING_BRIDGE_ROUTES)
      .pickBy((values, _key) => values.some((v) => v.endsWith(`-${toChainId}`)))
      .pickBy((_values, key) => key.endsWith(`-${fromChainId}`))
      .keys()
      .uniq()
Severity: Major
Found in packages/widget/src/utils/routeMaker/getFromTokens.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return _(EXISTING_BRIDGE_ROUTES)
          .pickBy((values, _key) => {
            return _.includes(values, `${toTokenRouteSymbol}-${toChainId}`)
          })
          .keys()
    Severity: Major
    Found in packages/widget/src/utils/routeMaker/getFromChainIds.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return _(EXISTING_BRIDGE_ROUTES)
            .entries()
            .filter(([key, _values]) => key.startsWith(`${fromTokenRouteSymbol}-`))
            .map(([key, _values]) => key)
            .flatten()
      Severity: Major
      Found in packages/widget/src/utils/routeMaker/getFromChainIds.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return _(EXISTING_BRIDGE_ROUTES)
              .entries()
              .filter(([key, _values]) => key.startsWith(`${fromTokenRouteSymbol}-`))
              .map(([_key, values]) => values)
              .flatten()
        Severity: Major
        Found in packages/widget/src/utils/routeMaker/getToChainIds.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return _(EXISTING_BRIDGE_ROUTES)
                .values()
                .flatten()
                .map((token) => getTokenAndChainId(token).chainId)
                .uniq()
          Severity: Major
          Found in packages/widget/src/utils/routeMaker/getToChainIds.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return _(EXISTING_BRIDGE_ROUTES)
                  .mapValues((values) =>
                    values.filter((token) => token.startsWith(`${toTokenRouteSymbol}`))
                  )
                  .values()
            Severity: Major
            Found in packages/widget/src/utils/routeMaker/getToChainIds.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return false

                Avoid too many return statements within this function.
                Open

                  return <div className="text-sm">{estTime}</div>

                  Avoid too many return statements within this function.
                  Open

                    return toast.error(err?.message, {
                      id: 'toast-error',
                      duration: 5000,
                    })
                  Severity: Major
                  Found in packages/synapse-interface/utils/txErrorHandler.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return (
                          <Tooltip
                            hoverText="Amount may not exceed available balance"
                            positionStyles={tooltipPositionStyle}
                          >
                    Severity: Major
                    Found in packages/widget/src/components/BridgeButton.tsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return (
                          <div data-test-id="bridge-button">
                            {isApproved ? (
                              <button
                                disabled={isBridgePending}
                      Severity: Major
                      Found in packages/widget/src/components/BridgeButton.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return (
                              <Tooltip
                                hoverText="Enter valid amount"
                                positionStyles={tooltipPositionStyle}
                              >
                        Severity: Major
                        Found in packages/widget/src/components/BridgeButton.tsx - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return (
                                <button className={buttonClassName} style={buttonStyle} disabled>
                                  Send
                                </button>
                              )
                          Severity: Major
                          Found in packages/widget/src/components/BridgeButton.tsx - About 30 mins to fix

                            Method Backend.WaitForConfirmation has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (b *Backend) WaitForConfirmation(parentCtx context.Context, transaction *types.Transaction) {
                                ctx, cancel := onecontext.Merge(b.ctx, parentCtx)
                                defer cancel()
                            
                                //nolint: contextcheck
                            Severity: Minor
                            Found in ethergo/backends/base/base.go - About 25 mins 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 UtilSuite.TestCopyTX has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (u *UtilSuite) TestCopyTX() {
                                mockDynamicTXS := mocks.GetMockTxes(u.GetTestContext(), u.T(), 100, types.DynamicFeeTxType)
                                mockLegacyTXes := mocks.GetMockTxes(u.GetTestContext(), u.T(), 100, types.LegacyTxType)
                            
                                // delete me
                            Severity: Minor
                            Found in ethergo/util/copy_test.go - About 25 mins 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 TXSubmitterDBSuite.TestGetTransactionsWithLimitPerChainID has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (t *TXSubmitterDBSuite) TestGetTransactionsWithLimitPerChainID() {
                                t.RunOnAllDBs(func(testDB db.Service) {
                                    for _, backend := range t.testBackends {
                                        manager := t.managers[backend.GetChainID()]
                            
                            
                            Severity: Minor
                            Found in ethergo/submitter/db_test.go - About 25 mins 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 Backend.getTransactionLabelMap has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (b *Backend) getTransactionLabelMap(tx *types.Transaction, from common.Address) (res map[common.Address]string) {
                                b.verifiedMux.RLock()
                                defer b.verifiedMux.RUnlock()
                            
                                res = map[common.Address]string{}
                            Severity: Minor
                            Found in ethergo/backends/base/trace.go - About 25 mins 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 Manager.generateQuotes has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (m *Manager) generateQuotes(parentCtx context.Context, chainID int, address common.Address, balance *big.Int, inv map[int]map[common.Address]*big.Int) (quotes []model.PutRelayerQuoteRequest, err error) {
                                ctx, span := m.metricsHandler.Tracer().Start(parentCtx, "generateQuotes", trace.WithAttributes(
                                    attribute.Int(metrics.Origin, chainID),
                                    attribute.String("address", address.String()),
                                    attribute.String("balance", balance.String()),
                            Severity: Minor
                            Found in services/rfq/relayer/quoter/quoter.go - About 25 mins 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 QuoteRequestHandler.handleProofPosted has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (q *QuoteRequestHandler) handleProofPosted(ctx context.Context, span trace.Span, request reldb.QuoteRequest) (err error) {
                                // we shouldnt' check the claim yet
                                if !q.shouldCheckClaim(request) {
                                    return nil
                                }
                            Severity: Minor
                            Found in services/rfq/relayer/service/handlers.go - About 25 mins 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 GetPartialInfoFromBridgeEventHybrid has a Cognitive Complexity of 21 (exceeds 20 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: Minor
                            Found in services/explorer/graphql/server/graph/queryutils.go - About 25 mins 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

                            Severity
                            Category
                            Status
                            Source
                            Language