synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

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

func (s *ScribeSuite) TestChainIndexerLivefill() {
    if os.Getenv("CI") != "" || !s.runVolumeTest {
        s.T().Skip("This is a long running test")
    }
    const numberOfContracts = 5
Severity: Minor
Found in services/scribe/service/chain_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

Function setSwapChainId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    setSwapChainId: (state, action: PayloadAction<number>) => {
      const incomingFromChainId = action.payload

      const validFromTokens = _(
        getSwapFromTokens({
Severity: Minor
Found in packages/synapse-interface/slices/swap/reducer.ts - 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 checksumAddress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const checksumAddress = (address, chainId = null) => {
  if (typeof address !== 'string') {
    return ''
  }

Severity: Minor
Found in packages/explorer-ui/utils/checksum.ts - 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 isTransactionReceiptError has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const isTransactionReceiptError = (error: unknown): boolean => {
  if (error instanceof WaitForTransactionReceiptTimeoutError) {
    return true
  }

Severity: Minor
Found in packages/synapse-interface/utils/isTransactionReceiptError.ts - 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 saveNewDeployment has a Cognitive Complexity of 6 (exceeds 5 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 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 mode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const mode = (arr) => {
  const mode = {}
  let max = 0
  let count = 0

Severity: Minor
Found in packages/explorer-ui/utils/math/statistics.ts - 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 __resolveType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    __resolveType(obj: any) {
      // Implement logic to determine the event type based on the object properties
      // For example:
      if ('sender' in obj) {
        return 'BridgeRequestEvent'
Severity: Minor
Found in packages/rfq-indexer/api/src/graphql/resolvers.ts - 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 getTokenSymbol has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const getTokenSymbol = async (chainId, token) => {
  // Check if token is ETH
  if (token === ETH) {
    const swapQuoter = await getSwapQuoter(chainId)
    if (!swapQuoter) {
Severity: Minor
Found in packages/synapse-interface/scripts/generateMaps.js - 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 getRequestStatus has a Cognitive Complexity of 6 (exceeds 5 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 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 useConfirmNewBridgePrice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const useConfirmNewBridgePrice = () => {
  const triggerQuoteRef = useRef<BridgeQuote | null>(null)
  const bpsThreshold = 0.0001 // 1bps

  const [hasQuoteOutputChanged, setHasQuoteOutputChanged] =

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

export const useStaleQuoteUpdater = (
  quote: BridgeQuote,
  refreshQuoteCallback: () => Promise<void>,
  enabled: boolean,
  staleTimeout: number = 15000, // in ms

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

export const tokenSymbolToToken = (chainId: number, symbol: string) => {
  if (chainId) {
    if (symbol === 'ETH') {
      return ETH
    } else if (symbol === 'WETH') {
Severity: Minor
Found in packages/synapse-constants/src/constants/tokens/index.ts - 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 tokenAddressToToken has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const tokenAddressToToken = (
  chainId: number,
  tokenAddress: string
): Token | undefined => {
  if (chainId) {
Severity: Minor
Found in packages/synapse-constants/src/constants/tokens/index.ts - 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 checkVersionAndResetCache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const checkVersionAndResetCache = (): boolean => {
  if (typeof window !== 'undefined') {
    const persistedStateRaw = localStorage.getItem(`persist:${storageKey}`)
    if (persistedStateRaw) {
      const persistedState = JSON.parse(persistedStateRaw)
Severity: Minor
Found in packages/synapse-interface/store/store.ts - 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 Token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const Token = () => {
  const router = useRouter()
  const { tokenAddress } = router.query
  const search = useSearchParams()
  const chain_id = Number(search.get('chainId')) || 1
Severity: Minor
Found in packages/explorer-ui/pages/token/[tokenAddress].tsx - 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 fetchErc20TokenAllowance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const fetchErc20TokenAllowance = async ({
  spenderAddress,
  tokenAddress,
  ownerAddress,
  provider,
Severity: Minor
Found in packages/widget/src/utils/actions/fetchErc20TokenAllowance.ts - 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 getSynapsePauseData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getSynapsePauseData = () => {
  const fetchAndStoreData = async () => {
    if (isFetching) {
      return
    }
Severity: Minor
Found in packages/widget/src/utils/getSynapsePauseData.ts - 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 getTokenDecimals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getTokenDecimals = (
  chainId: number,
  tokenAddress: string
): number => {
  for (const [, token] of Object.entries(tokensList)) {
Severity: Minor
Found in packages/rest-api/src/utils/getTokenDecimals.ts - 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 fetchBridgeQuote has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async ({
    originChainId,
    destinationChainId,
    originToken,
    destinationToken,
Severity: Minor
Found in packages/widget/src/state/slices/bridgeQuote/hooks.ts - 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 checksumAddresses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const checksumAddresses = (addressFields: string[]) => {
  return (req: Request, _res: Response, next: NextFunction) => {
    for (const field of addressFields) {
      const address = req.query[field]
      if (typeof address === 'string' && isAddress(address)) {
Severity: Minor
Found in packages/rest-api/src/middleware/checksumAddresses.ts - 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