synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function StakeCardTitle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const StakeCardTitle = ({
  token,
  poolTokens,
  poolLabel,
  lpTokenBalance,
Severity: Minor
Found in packages/synapse-interface/pages/stake/StakeCardTitle.tsx - About 1 hr 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 WithdrawButton has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const WithdrawButton = ({ approveTxn, withdrawTxn, isApproved }) => {
  const t = useTranslations('Pools.WithdrawButton')
  const { chain, isConnected: isConnectedInit } = useAccount()
  const { chains, switchChain } = useSwitchChain()
  const { openConnectModal } = useConnectModal()

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 Portfolio has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const Portfolio = () => {
  const dispatch = useAppDispatch()
  const { fromChainId }: BridgeState = useBridgeState()
  const {
    activeTab,
Severity: Minor
Found in packages/synapse-interface/components/Portfolio/Portfolio.tsx - About 1 hr 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 baseChain.HeaderByTime has 52 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (b *baseChain) HeaderByTime(ctx context.Context, startHeight *big.Int, targetTime time.Time) (*types.Header, error) {
    // grab the MeteredEVMClient explicitly to avoid ambiguous references
    client, err := newHeaderCacheClient(b, 4)
    if err != nil {
        return nil, fmt.Errorf("could not create header cache client: %w", err)
Severity: Minor
Found in ethergo/chain/block.go - About 1 hr to fix

    Function TestForkLogsReborn has 52 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestForkLogsReborn(t *testing.T) {
        t.Parallel()
        testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
        sim := simTestBackend(testAddr)
        defer sim.Close()
    Severity: Minor
    Found in ethergo/backends/simulated/multibackend/simulated_gen_test.go - About 1 hr to fix

      Function NewEVM has 52 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func NewEVM(ctx context.Context, name string, domain config.DomainConfig, chainRPCURL string) (domains.DomainClient, error) {
          underlyingClient, err := chain.NewFromURL(ctx, chainRPCURL)
          if err != nil {
              return nil, fmt.Errorf("could not get evm: %w", err)
          }
      Severity: Minor
      Found in agents/domains/evm/evm.go - About 1 hr to fix

        Method Store.GetRelayableAgentStatuses has 52 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (s Store) GetRelayableAgentStatuses(ctx context.Context, chainID uint32) ([]agentTypes.AgentTree, error) {
            agentTreesTableName, err := dbcommon.GetModelName(s.DB(), &AgentTree{})
            if err != nil {
                return nil, fmt.Errorf("failed to get agent trees table name: %w", err)
            }
        Severity: Minor
        Found in agents/agents/guard/db/sql/base/crosstable.go - About 1 hr to fix

          Method queryResolver.getAmountStatisticsAll has 52 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (r *queryResolver) getAmountStatisticsAll(ctx context.Context, typeArg model.StatisticType, chainID *int, address *string, tokenAddress *string, compositeFilters string) (*string, error) {
              if typeArg == model.StatisticTypeMedianVolumeUsd || typeArg == model.StatisticTypeMeanVolumeUsd || typeArg == model.StatisticTypeMedianFeeUsd || typeArg == model.StatisticTypeMeanFeeUsd {
                  return nil, fmt.Errorf("cannot calculate averages or medians across all platforms")
              }
              var bridgeFinalSQL *string
          Severity: Minor
          Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

            Method IndexerSuite.TestContractBackfill has 52 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (x *IndexerSuite) TestContractBackfill() {
                // Get simulated blockchain, deploy the test contract, and set up test variables.
                simulatedChain := geth.NewEmbeddedBackendForChainID(x.GetSuiteContext(), x.T(), big.NewInt(142))
                simulatedClient, err := backend.DialBackend(x.GetTestContext(), simulatedChain.RPCAddress(), x.metrics)
                Nil(x.T(), err)
            Severity: Minor
            Found in services/scribe/service/indexer/indexer_test.go - About 1 hr to fix

              Method BackendSuite.TestLogsInRangeWithMultipleContracts has 52 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (b *BackendSuite) TestLogsInRangeWithMultipleContracts() {
                  const desiredBlockHeight = 10
              
                  var testChainHandler *testutil.TestChainHandler
                  var err error
              Severity: Minor
              Found in services/scribe/backend/backend_test.go - About 1 hr to fix

                Method Store.StoreLogs has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (s Store) StoreLogs(ctx context.Context, chainID uint32, logs ...types.Log) error {
                    var storeLogs []Log
                    for _, log := range logs {
                        var topics []sql.NullString
                
                
                Severity: Minor
                Found in services/scribe/db/datastore/sql/base/log.go - About 1 hr to fix

                  Function saveNewDeployment has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const saveNewDeployment = (chainName, contractAlias, potentialReceipts) => {
                    // No-op if artifact has already been saved
                    const deploymentFN = getDeploymentFN(chainName, contractAlias)
                    if (fs.existsSync(deploymentFN)) {
                      logInfo(`Deployment artifact already exists for ${contractAlias}`)
                  Severity: Minor
                  Found in packages/solidity-devops/js/utils/deployments.js - About 1 hr to fix

                    Function getRequestStatus has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const getRequestStatus = (chainName, actionName, guid) => {
                      const verifier = readEnv(chainName, 'VERIFIER')
                      if (verifier !== VERIFIER_ETHERSCAN) {
                        logError(`Verifier ${verifier} is not supported by this command`)
                        return null
                    Severity: Minor
                    Found in packages/solidity-devops/js/utils/etherscan.js - About 1 hr to fix

                      Method testJaeger.StartJaegerPyroscopeUI has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (j *testJaeger) StartJaegerPyroscopeUI(ctx context.Context) *uiResource {
                          // can't enable if pyroscope is disabled
                          // TODO: add a warning here.
                          if core.HasEnv(internal.JaegerUIEndpoint) || !j.cfg.enablePyroscope {
                              return &uiResource{
                      Severity: Minor
                      Found in core/metrics/localmetrics/jaeger.go - About 1 hr to fix

                        Function pendingTransactionsMissingRelay has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            pendingTransactionsMissingRelay: async () => {
                              const query = db
                                .with('deposits', () => qDeposits())
                                .with('relays', () => qRelays())
                                .with('refunds', () => qRefunds())
                        Severity: Minor
                        Found in packages/rfq-indexer/api/src/graphql/resolvers.ts - About 1 hr to fix

                          Function _applySlippageBigInt has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const _applySlippageBigInt = (
                            inputValue,
                            slippageSelected,
                            slippageCustom,
                            add = false
                          Severity: Minor
                          Found in packages/synapse-interface/utils/slippage.ts - About 1 hr to fix

                            Function _applySlippage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const _applySlippage = (
                              inputValue,
                              slippageSelected,
                              slippageCustom,
                              add = false
                            Severity: Minor
                            Found in packages/synapse-interface/utils/slippage.ts - About 1 hr to fix

                              Function getBridgeStatus has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const getBridgeStatus = async (
                                originChainId: string | number,
                                kappa: string
                              ) => {
                                try {
                              Severity: Minor
                              Found in packages/rest-api/src/utils/getBridgeStatus.ts - About 1 hr to fix

                                Function finalizeBridgeRoute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  async finalizeBridgeRoute(
                                    bridgeRoute: BridgeRoute,
                                    originDeadline?: BigNumber,
                                    destDeadline?: BigNumber
                                  ): Promise<BridgeQuote> {
                                Severity: Minor
                                Found in packages/sdk-router/src/module/synapseModuleSet.ts - About 1 hr to fix

                                  Function DeepLiquidityIcon has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function DeepLiquidityIcon() {
                                    return (
                                      <svg
                                        width="24"
                                        height="36"
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language