synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function events has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    events: async (
      _: any,
      { first = 10, after, filter }: { first?: any; after?: any; filter?: any }
    ) => {
      let query = db
Severity: Minor
Found in packages/rfq-indexer/api/src/graphql/resolvers.ts - About 35 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 formatSlippageToString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const formatSlippageToString = (slippageSelected, slippageCustom) => {
  if (slippageSelected === Slippages.Custom && !!slippageCustom) {
    return formatUnits(slippageCustom.valueSafe, slippageCustom?.precision)
  } else if (slippageSelected === Slippages.OneTenth) {
    return formatUnits(BigNumber.from(100), 3)
Severity: Minor
Found in packages/synapse-interface/utils/slippage.ts - About 35 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 setDestinationToken has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    setDestinationToken: (
      state: BridgeState,
      action: PayloadAction<BridgeableToken>
    ) => {
      const incomingToToken = action.payload
Severity: Minor
Found in packages/widget/src/state/slices/bridge/reducer.ts - About 35 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 setDestinationChainId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    setDestinationChainId: (
      state: BridgeState,
      action: PayloadAction<number>
    ) => {
      const incomingToChainId = action.payload
Severity: Minor
Found in packages/widget/src/state/slices/bridge/reducer.ts - About 35 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 useExchangeRateInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const useExchangeRateInfo = (value, exchangeRate) => {
  const safeExchangeRate = typeof exchangeRate === 'bigint' ? exchangeRate : 0n
  const safeFromAmount = value ?? '0'

  const formattedExchangeRate = formatBigIntToString(safeExchangeRate, 18, 4)

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

export const useEventCountdownProgressBar = (
  eventLabel: string,
  startDate: Date,
  endDate: Date | null,
  hideProgress?: boolean

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

export default function ImageUploader() {
  const [uploadedImage, setUploadedImage] = useState(null)
  const [processedImage, setProcessedImage] = useState(null)

  const t = useTranslations('ReturnToMonke')
Severity: Minor
Found in packages/synapse-interface/pages/returntomonke/ImageUploader.tsx - About 35 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 ApyDisplay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const ApyDisplay = ({ pool, poolApyData }) => {
  const apy =
    poolApyData.fullCompoundedAPY > 10000
      ? 10000
      : poolApyData.fullCompoundedAPY
Severity: Minor
Found in packages/synapse-interface/components/Pools/PoolCardBody.tsx - About 35 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 AvailableBalance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const AvailableBalance = ({
  connectedAddress,
  setInputAmount,
}: {
  connectedAddress: string
Severity: Minor
Found in packages/widget/src/components/AvailableBalance.tsx - About 35 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 PoolHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  ({ pool, address }: { pool: Token; address: Address }) => {
    const [mounted, setMounted] = useState(false)
    const { chain: connectedChain } = useAccount()
    const chain = CHAINS_BY_ID[pool.chainId]
    const { balances } = usePortfolioState()
Severity: Minor
Found in packages/synapse-interface/components/Pools/PoolHeader.tsx - About 35 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 PoolInfoSection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const PoolInfoSection = () => {
  const { pool, poolData, isLoading } = usePoolDataState()

  const t = useTranslations('Pools.Other')

Severity: Minor
Found in packages/synapse-interface/pages/pool/PoolInfoSection/index.tsx - About 35 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 Col has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function Col({
  children,
  xs,
  sm,
  md,
Severity: Minor
Found in packages/synapse-interface/components/ui/tailwind/Col.tsx - About 35 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 SwapExchangeRateInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const SwapExchangeRateInfo = ({
  fromAmount,
  toToken,
  exchangeRate,
  toChainId,

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

export const useMaintenance = () => {
  const { pausedChainsList, pausedModulesList } = useMaintenanceData()
  const { fromChainId: bridgeFromChainId, toChainId: bridgeToChainId } =
    useBridgeState()
  const { swapChainId } = useSwapState()
Severity: Minor
Found in packages/synapse-interface/components/Maintenance/Maintenance.tsx - About 35 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 TimeRemaining has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const TimeRemaining = ({
  isComplete,
  remainingTime,
  isDelayed,
  delayedTime,
Severity: Minor
Found in packages/widget/src/components/TimeRemaining.tsx - About 35 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

Avoid too many return statements within this function.
Open

    return Intl.NumberFormat(locales, {
      minimumFractionDigits: standardDigits,
    }).format(floatAmount)
Severity: Major
Found in packages/explorer-ui/utils/formatAmount.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return Intl.NumberFormat(locales, {
          minimumSignificantDigits: standardDigits,
          maximumSignificantDigits: standardDigits,
        }).format(floatAmount)
    Severity: Major
    Found in packages/explorer-ui/utils/formatAmount.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return EXISTING_BRIDGE_ROUTES[`${fromTokenRouteSymbol}-${fromChainId}`]
      Severity: Major
      Found in packages/synapse-interface/utils/routeMaker/getToTokens.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/synapse-interface/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}-`))
                .filter(([_key, values]) =>
                  values.some((v) => getTokenAndChainId(v).chainId === toChainId)
          Severity: Major
          Found in packages/synapse-interface/utils/routeMaker/getFromChainIds.ts - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language