synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Method APISuite.TestGetCountByTokenAddress has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
Open

func (g APISuite) TestGetCountByTokenAddress() {
    chainID := g.chainIDs[0]
    destinationChainID := g.chainIDs[1]
    tokenAddressA := common.BigToAddress(big.NewInt(gofakeit.Int64()))
    tokenAddressB := common.BigToAddress(big.NewInt(gofakeit.Int64()))
Severity: Minor
Found in services/explorer/api/resolver_test.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 ClientSuite.TestParseRPCPayload has 106 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *ClientSuite) TestParseRPCPayload() {
    /*
      CHECK BLOCKS
    */

Severity: Major
Found in ethergo/client/client_test.go - About 3 hrs to fix

    Method GuardSuite.TestFraudulentStateInSnapshot has 106 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      SwapFlashLoanRemoveLiquidity has 27 methods (exceeds 20 allowed). Consider refactoring.
      Open

      func (s SwapFlashLoanRemoveLiquidity) GetRaw() ethTypes.Log {
          return s.Raw
      }
      Severity: Minor
      Found in services/explorer/contracts/swap/liquidity.go - About 3 hrs to fix

        SwapFlashLoanTokenSwap has 27 methods (exceeds 20 allowed). Consider refactoring.
        Open

        func (s SwapFlashLoanTokenSwap) GetRaw() ethTypes.Log {
            return s.Raw
        }
        Severity: Minor
        Found in services/explorer/contracts/swap/swap.go - About 3 hrs to fix

          SwapFlashLoanRemoveLiquidityImbalance has 27 methods (exceeds 20 allowed). Consider refactoring.
          Open

          func (s SwapFlashLoanRemoveLiquidityImbalance) GetRaw() ethTypes.Log {
              return s.Raw
          }
          Severity: Minor
          Found in services/explorer/contracts/swap/liquidity.go - About 3 hrs to fix

            SwapFlashLoanRampA has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

            func (s SwapFlashLoanRampA) GetRaw() ethTypes.Log {
                return s.Raw
            }
            Severity: Minor
            Found in services/explorer/contracts/swap/rampa.go - About 3 hrs to fix

              SwapFlashLoanNewAdminFee has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

              func (s SwapFlashLoanNewAdminFee) GetRaw() ethTypes.Log {
                  return s.Raw
              }
              Severity: Minor
              Found in services/explorer/contracts/swap/fee.go - About 3 hrs to fix

                SwapFlashLoanStopRampA has 27 methods (exceeds 20 allowed). Consider refactoring.
                Open

                func (s SwapFlashLoanStopRampA) GetRaw() ethTypes.Log {
                    return s.Raw
                }
                Severity: Minor
                Found in services/explorer/contracts/swap/rampa.go - About 3 hrs to fix

                  SwapFlashLoanNewSwapFee has 27 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (s SwapFlashLoanNewSwapFee) GetRaw() ethTypes.Log {
                      return s.Raw
                  }
                  Severity: Minor
                  Found in services/explorer/contracts/swap/fee.go - About 3 hrs to fix

                    SwapFlashLoanRemoveLiquidityOne has 27 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (s SwapFlashLoanRemoveLiquidityOne) GetRaw() ethTypes.Log {
                        return s.Raw
                    }
                    Severity: Minor
                    Found in services/explorer/contracts/swap/liquidity.go - About 3 hrs to fix

                      SwapFlashLoanAddLiquidity has 27 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (s SwapFlashLoanAddLiquidity) GetRaw() ethTypes.Log {
                          return s.Raw
                      }
                      Severity: Minor
                      Found in services/explorer/contracts/swap/liquidity.go - About 3 hrs to fix

                        MetaSwapTokenSwapUnderlying has 27 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (s MetaSwapTokenSwapUnderlying) GetRaw() ethTypes.Log {
                            return s.Raw
                        }
                        Severity: Minor
                        Found in services/explorer/contracts/metaswap/swap.go - About 3 hrs to fix

                          SwapFlashLoanFlashLoan has 27 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (s SwapFlashLoanFlashLoan) GetRaw() ethTypes.Log {
                              return s.Raw
                          }
                          Severity: Minor
                          Found in services/explorer/contracts/swap/loan.go - About 3 hrs to fix

                            Method Guard.handleStatusUpdated has 104 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (g Guard) handleStatusUpdated(ctx context.Context, log ethTypes.Log, chainID uint32) error {
                                statusUpdated, err := g.bondingManagerParser.ParseStatusUpdated(log)
                                if err != nil {
                                    return fmt.Errorf("could not parse status updated: %w", err)
                                }
                            Severity: Major
                            Found in agents/agents/guard/fraud.go - About 3 hrs to fix

                              Function TestValidation has 104 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func TestValidation(t *testing.T) {
                                  t.Run("Valid", func(t *testing.T) {
                                      cfg := relconfig.Config{
                                          Chains: map[int]relconfig.ChainConfig{
                                              1: {
                              Severity: Major
                              Found in services/rfq/relayer/relconfig/config_test.go - About 3 hrs to fix

                                Method NodeSuite.fillBlocks has 104 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (c NodeSuite) fillBlocks(bridgeRef *testbridge.TestBridgeRef, swapRefA *testswap.TestSwapRef, swapRefB *testswap.TestSwapRef, transactOpts backends.AuthType, chainID uint32) {
                                    // Store blocktimes for testing defillama and timestamp indexing.
                                    for i := uint64(0); i < 13; i++ {
                                        err := c.eventDB.StoreBlockTime(c.GetTestContext(), chainID, i, i)
                                        Nil(c.T(), err)
                                Severity: Major
                                Found in services/explorer/node/explorer_test.go - About 3 hrs to fix

                                  Function generateTheme has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function generateTheme(theme: CustomThemeVariables = {}) {
                                    function str2hsl(color: string) {
                                      // TODO: Support hex short codes
                                      if (/^#?[\da-fA-F]{6,8}$/.test(color)) {
                                        let [r, g, b, a] = color
                                  Severity: Major
                                  Found in packages/widget/src/utils/generateTheme.ts - About 3 hrs to fix

                                    Function deposit has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const deposit = async (
                                      pool: Token,
                                      slippageSelected: any,
                                      slippageCustom: any,
                                      inputAmounts: any,
                                    Severity: Major
                                    Found in packages/synapse-interface/utils/actions/approveAndDeposit.tsx - About 3 hrs to fix

                                      Method Bot.traceCommand has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      func (b *Bot) traceCommand() *slacker.CommandDefinition {
                                          return b.requiresSignoz(&slacker.CommandDefinition{
                                              Command:     "trace {tags} {order}",
                                              Description: "find a transaction in signoz",
                                              Examples: []string{
                                      Severity: Minor
                                      Found in contrib/opbot/botmd/commands.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language