synapsecns/sanguine

View on GitHub

Showing 13,422 of 13,422 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            <div className="flex items-center h-full mr-4">
              <button
                onClick={() => SetDailyStatisticDuration('PAST_MONTH')}
                className={
                  'font-medium rounded-l-md px-4 py-2 border  h-fit  ' +
Severity: Major
Found in packages/explorer-ui/pages/chain/[chainId].tsx and 1 other location - About 7 hrs to fix
packages/explorer-ui/components/pages/Home/index.tsx on lines 204..241

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 191.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  it('should return destination tokens for valid gas Tokens', async () => {
    const response = await request(app).get('/destinationTokens').query({
      fromChain: '1',
      fromToken: NativeGasAddress,
    })
Severity: Major
Found in packages/rest-api/src/tests/destinationTokensRoute.test.ts and 1 other location - About 7 hrs to fix
packages/rest-api/src/tests/destinationTokensRoute.test.ts on lines 40..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 191.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  it('should return destination tokens for valid gas Tokens, ZeroAddress', async () => {
    const response = await request(app).get('/destinationTokens').query({
      fromChain: '1',
      fromToken: ZeroAddress,
    })
Severity: Major
Found in packages/rest-api/src/tests/destinationTokensRoute.test.ts and 1 other location - About 7 hrs to fix
packages/rest-api/src/tests/destinationTokensRoute.test.ts on lines 26..38

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 191.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if (hasDepositedOnHyperliquid) {
    return (
      <div className="flex flex-col p-2 mb-2 space-y-1 text-sm ">
        <div className="flex justify-between">
          <div>
packages/synapse-interface/components/HyperliquidDepositInfo.tsx on lines 54..75

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 191.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if (fromChainId === ARBITRUM.id && isOnArbitrum) {
    return (
      <div className="flex flex-col p-2 mb-2 space-y-1 text-sm ">
        <div className="flex justify-between">
          <div>
packages/synapse-interface/components/HyperliquidDepositInfo.tsx on lines 31..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 191.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            <div className="flex items-center h-full mr-4">
              <button
                onClick={() => SetDailyStatisticDuration('PAST_MONTH')}
                className={
                  'font-medium rounded-l-md px-4 py-2 border  h-fit  ' +
Severity: Major
Found in packages/explorer-ui/components/pages/Home/index.tsx and 1 other location - About 7 hrs to fix
packages/explorer-ui/pages/chain/[chainId].tsx on lines 222..259

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 191.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File chains.ts has 491 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'lodash'

import { Chain } from '../types'
import { getOmniRpcUrl } from '../utils/getOmniRpcUrl'

Severity: Minor
Found in packages/rest-api/src/constants/chains.ts - About 7 hrs to fix

    File chains.ts has 490 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import _ from 'lodash'
    import { Chain } from 'types'
    
    export const ETHEREUM: Chain = {
      id: 1,
    Severity: Minor
    Found in packages/widget/src/constants/chains.ts - About 7 hrs to fix

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

      func (b *Bot) rfqRefund() *slacker.CommandDefinition {
          return &slacker.CommandDefinition{
              Command:     "refund <tx>",
              Description: "refund a quote request",
              Examples:    []string{"refund 0x1234"},
      Severity: Minor
      Found in contrib/opbot/botmd/commands.go - About 7 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 ChainSummary has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

      export const ChainSummary = () => {
        const router = useRouter()
        const { chainId: chainIdRouter } = router.query
        const [platform, setPlatform] = useState('ALL')
        const [transactionsArr, setTransactionsArr] = useState([])
      Severity: Minor
      Found in packages/explorer-ui/pages/chain/[chainId].tsx - About 7 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          describe('RouterQuery', () => {
            it('modifies the deadline', () => {
              const query = applyDeadlineToQuery(routerQuery, BigNumber.from(42))
              expect(query).toEqual({
                swapAdapter: '1',
      Severity: Major
      Found in packages/sdk-router/src/module/query.test.ts and 1 other location - About 7 hrs to fix
      packages/sdk-router/src/module/query.test.ts on lines 104..126

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 189.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          describe('CCTPRouterQuery', () => {
            it('modifies the deadline', () => {
              const query = applyDeadlineToQuery(cctpRouterQuery, BigNumber.from(42))
              expect(query).toEqual({
                routerAdapter: '6',
      Severity: Major
      Found in packages/sdk-router/src/module/query.test.ts and 1 other location - About 7 hrs to fix
      packages/sdk-router/src/module/query.test.ts on lines 80..102

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 189.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        {
          inputs: [
            {
              internalType: 'address',
              name: 'tokenIn',
      Severity: Major
      Found in packages/synapse-interface/constants/abis/synapseRouter.ts and 2 other locations - About 7 hrs to fix
      packages/rfq-loadtest/src/abi.ts on lines 880..903
      packages/synapse-interface/constants/abis/synapseRouter.ts on lines 518..573

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 188.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          {
            inputs: [
              { internalType: 'address', name: 'tokenIn', type: 'address' },
              { internalType: 'address[]', name: 'rfqTokens', type: 'address[]' },
              { internalType: 'uint256', name: 'amountIn', type: 'uint256' },
      Severity: Major
      Found in packages/rfq-loadtest/src/abi.ts and 2 other locations - About 7 hrs to fix
      packages/synapse-interface/constants/abis/synapseRouter.ts on lines 518..573
      packages/synapse-interface/constants/abis/synapseRouter.ts on lines 668..723

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 188.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        {
          inputs: [
            {
              internalType: 'address',
              name: 'tokenIn',
      Severity: Major
      Found in packages/synapse-interface/constants/abis/synapseRouter.ts and 2 other locations - About 7 hrs to fix
      packages/rfq-loadtest/src/abi.ts on lines 880..903
      packages/synapse-interface/constants/abis/synapseRouter.ts on lines 668..723

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 188.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      File chains.ts has 485 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable */
      const CustomColors = {
        CUSTOM_YELLOW: '[#ecae0b]',
        CUSTOM_YELLOW_DARK: '[#3c3c44]',
        ETH_BASE: '[#5170ad]',
      Severity: Minor
      Found in packages/synapse-interface/styles/chains.ts - About 7 hrs to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

              <g fill="currentcolor" fillOpacity=".05">
                <rect x="-50%" rx="4" y="0" width="100%" height="48" />
                <rect x="-50%" rx="4" y="56" width="100%" height="48" />
                <rect x="-50%" rx="4" y="112" width="100%" height="48" />
                <rect x="-50%" rx="4" y="0%" width="33.3%" height="100%" />
        Severity: Major
        Found in docs/bridge/src/components/BridgeFlow.tsx and 1 other location - About 7 hrs to fix
        docs/bridge/src/components/CCTPFlow.tsx on lines 14..20

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 187.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

              <g fill="currentcolor" fillOpacity=".05">
                <rect x="-50%" rx="4" y="0" width="100%" height="48" />
                <rect x="-50%" rx="4" y="56" width="100%" height="48" />
                <rect x="-50%" rx="4" y="112" width="100%" height="48" />
                <rect x="-50%" rx="4" y="0%" width="33.3%" height="100%" />
        Severity: Major
        Found in docs/bridge/src/components/CCTPFlow.tsx and 1 other location - About 7 hrs to fix
        docs/bridge/src/components/BridgeFlow.tsx on lines 14..20

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 187.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method inventoryManagerImpl.ApproveAllTokens has a Cognitive Complexity of 64 (exceeds 20 allowed). Consider refactoring.
        Open

        func (i *inventoryManagerImpl) ApproveAllTokens(ctx context.Context) (err error) {
            ctx, span := i.handler.Tracer().Start(ctx, "approveAllTokens")
            defer func() {
                metrics.EndSpanWithErr(span, err)
            }()
        Severity: Minor
        Found in services/rfq/relayer/inventory/manager.go - About 7 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 CCTPFlow has 189 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const CCTPFlow = () => {
          return (
            <svg
              width="100%"
              viewBox="-240 0 480 164"
        Severity: Major
        Found in docs/bridge/src/components/CCTPFlow.tsx - About 7 hrs to fix
          Severity
          Category
          Status
          Source
          Language