synapsecns/sanguine

View on GitHub
packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts

Summary

Maintainability
F
4 days
Test Coverage

Function createSlippageTests has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const createSlippageTests = (
  moduleSet: SynapseModuleSet,
  originQuery: Query,
  destQuery: Query,
  expectedOriginMinAmountOut: BigNumber,
Severity: Minor
Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts - About 1 hr to fix

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

      describe('applySlippage', () => {
        const originQuery: CCTPRouterQuery = {
          routerAdapter: '1',
          tokenOut: '2',
          minAmountOut: parseFixed('1000', 18),
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 2 days to fix
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 121..206

    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 373.

    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('getSynapseCCTPRouter', () => {
        it('Returns the correct router for supported chain', () => {
          const router = routerSet.getSynapseCCTPRouter(SupportedChainId.ETH)
          expect(router).toEqual(routerSet.routers[SupportedChainId.ETH])
          expect(router).toBeInstanceOf(SynapseCCTPRouter)
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 4 hrs to fix
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 107..119

    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 130.

    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('Uses correct addresses for each chain', () => {
          expect(routerSet.routers[SupportedChainId.ETH].address).toEqual(
            CCTP_ROUTER_ADDRESS_MAP[SupportedChainId.ETH]
          )
          expect(routerSet.routers[SupportedChainId.ARBITRUM].address).toEqual(
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 2 hrs to fix
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 43..50

    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 91.

    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('Returns the correct estimated time for all supported chains', () => {
          CCTP_SUPPORTED_CHAIN_IDS.forEach((chainId) => {
            expect(routerSet.getEstimatedTime(Number(chainId))).toEqual(
              MEDIAN_TIME_CCTP[chainId as keyof typeof MEDIAN_TIME_CCTP]
            )
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 1 hr to fix
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 62..68

    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 69.

    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('Creates SynapseCCTPRouter instances for chains with CCTP', () => {
          expect(routerSet.routers[SupportedChainId.ETH]).toBeDefined()
          expect(routerSet.routers[SupportedChainId.ARBITRUM]).toBeDefined()
        })
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 1 hr to fix
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 38..41

    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 65.

    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('Applies slippage to origin query', () => {
        const { originQuery: originQueryNew } = moduleSet.applySlippage(
          originQuery,
          destQuery,
          slipNumerator,
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 1 hr to fix
    packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts on lines 44..55

    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 61.

    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('Applies slippage to dest query', () => {
        const { destQuery: destQueryNew } = moduleSet.applySlippage(
          originQuery,
          destQuery,
          slipNumerator,
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 1 hr to fix
    packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts on lines 31..42

    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 61.

    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('Returns the correct router given correct address', () => {
          expect(
            routerSet.getModuleWithAddress(
              SupportedChainId.ETH,
              CCTP_ROUTER_ADDRESS_MAP[SupportedChainId.ETH]
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 1 hr to fix
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 79..86

    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 61.

    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

      const testProviders: ChainProvider[] = [
        {
          chainId: SupportedChainId.ETH,
          provider: ethProvider,
        },
    Severity: Minor
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 1 other location - About 50 mins to fix
    packages/synapse-interface/components/Wallet.tsx on lines 12..25

    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 51.

    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 5 locations. Consider refactoring.
    Open

        it('Returns undefined given unknown chainId', () => {
          expect(
            routerSet.getModuleWithAddress(
              SupportedChainId.AVALANCHE,
              ROUTER_ADDRESS_MAP[SupportedChainId.ETH]
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 4 other locations - About 40 mins to fix
    packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts on lines 155..162
    packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts on lines 173..180
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 88..95
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 97..104

    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 48.

    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 5 locations. Consider refactoring.
    Open

        it('Returns undefined given chainId without CCTP', () => {
          expect(
            routerSet.getModuleWithAddress(
              SupportedChainId.MOONBEAM,
              CCTP_ROUTER_ADDRESS_MAP[SupportedChainId.ETH]
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 4 other locations - About 40 mins to fix
    packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts on lines 155..162
    packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts on lines 164..171
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 88..95
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 97..104

    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 48.

    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 5 locations. Consider refactoring.
    Open

        it('Returns undefined given incorrect address', () => {
          expect(
            routerSet.getModuleWithAddress(
              SupportedChainId.ETH,
              ROUTER_ADDRESS_MAP[SupportedChainId.ETH]
    Severity: Major
    Found in packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts and 4 other locations - About 40 mins to fix
    packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts on lines 164..171
    packages/sdk-router/src/router/synapseCCTPRouterSet.test.ts on lines 173..180
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 88..95
    packages/sdk-router/src/router/synapseRouterSet.test.ts on lines 97..104

    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 48.

    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

    There are no issues that match your filters.

    Category
    Status