synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function TestCallContractRevert has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
Open

func TestCallContractRevert(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 2 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 executionContext.field_Query_logsRange_args has a Cognitive Complexity of 36 (exceeds 20 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: Minor
Found in services/explorer/consumer/client/resolver-client/server.go - About 2 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 executionContext.field_Query_logsRange_args has a Cognitive Complexity of 36 (exceeds 20 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: Minor
Found in services/scribe/graphql/server/graph/resolver/server.go - About 2 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 useGasEstimator has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

export const useGasEstimator = () => {
  const dispatch = useAppDispatch()
  const { address } = useAccount()
  const { synapseSDK } = useSynapseContext()
  const { balances } = usePortfolioState()
Severity: Minor
Found in packages/synapse-interface/utils/hooks/useGasEstimator.ts - About 2 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 _applySlippageBigInt has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

export const _applySlippageBigInt = (
  inputValue,
  slippageSelected,
  slippageCustom,
  add = false
Severity: Minor
Found in packages/synapse-interface/utils/slippage.ts - About 2 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 TransactionPayloadDetail has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

export const TransactionPayloadDetail = ({
  chain,
  token,
  tokenAmount,
  isOrigin,

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

export const InputContainer: React.FC<InputContainerProps> = ({
  setIsTyping,
}) => {
  const dispatch = useAppDispatch()
  const { chain, isConnected } = useAccount()

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

File [kappa].tsx has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'
import { TRANSACTIONS_PATH, ACCOUNTS_PATH } from '@urls'
import { ChainInfo } from '@components/misc/ChainInfo'
import { Error } from '@components/Error'
import { StandardPageContainer } from '@components/layouts/StandardPageContainer'
Severity: Minor
Found in packages/explorer-ui/pages/tx/[kappa].tsx - About 2 hrs to fix

    Function TestEstimateGas has 97 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestEstimateGas(t *testing.T) {
        t.Parallel()
        /*
            pragma solidity ^0.6.4;
            contract GasEstimation {
    Severity: Major
    Found in ethergo/backends/simulated/multibackend/simulated_gen_test.go - About 2 hrs to fix

      Method APISuite.TestGetCountByTokenAddress has 97 lines of code (exceeds 50 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: Major
      Found in services/explorer/api/resolver_test.go - About 2 hrs to fix

        Method APISuite.SetupTest has 97 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (g *APISuite) SetupTest() {
            g.TestSuite.SetupTest()
        
            initialFallback := graph.GetFallbackTime()
            graph.UnsafeSetFallbackTime(time.Second * 20)
        Severity: Major
        Found in services/explorer/api/suite_test.go - About 2 hrs to fix

          Function getAndSetBridgeQuote has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const getAndSetBridgeQuote = async () => {
              currentSDKRequestID.current += 1
              const thisRequestId = currentSDKRequestID.current
          
              // will have to handle deadlineMinutes here at later time, gets passed as optional last arg in .bridgeQuote()
          Severity: Major
          Found in packages/synapse-interface/pages/state-managed-bridge/index.tsx - About 2 hrs to fix

            File notary.go has 535 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

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

              Method NodeSuite.TestLive has 96 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (c NodeSuite) TestLive() {
                  if os.Getenv("CI") != "" {
                      c.T().Skip("Network / processing test flake")
                  }
                  chainConfigs := []indexerConfig.ChainConfig{}
              Severity: Major
              Found in services/explorer/node/explorer_test.go - About 2 hrs to fix

                Function getCountdownTimeStatus has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const getCountdownTimeStatus = (
                  startDate: Date | null,
                  endDate: Date | null
                ) => {
                  if (!startDate && !endDate) {
                Severity: Major
                Found in packages/widget/src/utils/getCountdownTimeStatus.ts - About 2 hrs to fix

                  Function setOriginToken has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function setDestinationToken has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function getCountdownTimeStatus has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const getCountdownTimeStatus = (
                        startDate: Date,
                        endDate: Date | null
                      ) => {
                        if (!startDate && !endDate) {

                        Function fetchPortfolioBalances has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const fetchPortfolioBalances = async (
                          address: string,
                          chainId?: number | undefined | null
                        ): Promise<{
                          balances: NetworkTokenBalances
                        Severity: Major
                        Found in packages/synapse-interface/utils/actions/fetchPortfolioBalances.tsx - About 2 hrs to fix

                          Method BridgeParser.ParseLog has 32 return statements (exceeds 4 allowed).
                          Open

                          func (p *BridgeParser) ParseLog(log ethTypes.Log, chainID uint32) (*model.BridgeEvent, bridgeTypes.EventLog, error) {
                              logTopic := log.Topics[0]
                          
                              iFace, err := func(log ethTypes.Log) (bridgeTypes.EventLog, error) {
                                  switch logTopic {
                          Severity: Major
                          Found in services/explorer/consumer/parser/bridgeparser.go - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language