synapsecns/sanguine

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

Summary

Maintainability
F
1 wk
Test Coverage

File query.test.ts has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { BigNumber } from '@ethersproject/bignumber'

import {
  RouterQuery,
  CCTPRouterQuery,
Severity: Minor
Found in packages/sdk-router/src/module/query.test.ts - About 2 hrs to fix

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

        describe('CCTPRouterQuery', () => {
          // 1M in 6 decimals
          const query: CCTPRouterQuery = {
            routerAdapter: '1',
            tokenOut: '2',
    Severity: Major
    Found in packages/sdk-router/src/module/query.test.ts and 1 other location - About 4 days to fix
    packages/sdk-router/src/module/query.test.ts on lines 130..210

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

    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('RouterQuery', () => {
          // 1M in 18 decimals
          const query: RouterQuery = {
            swapAdapter: '1',
            tokenOut: '2',
    Severity: Major
    Found in packages/sdk-router/src/module/query.test.ts and 1 other location - About 4 days to fix
    packages/sdk-router/src/module/query.test.ts on lines 212..292

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

    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('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 2 locations. Consider refactoring.
    Open

      describe('narrowToCCTPRouterQuery', () => {
        it('narrows a Query with routerAdapter', () => {
          const query = cctpRouterQuery as Query
          const narrowed = narrowToCCTPRouterQuery(query)
          expect(narrowed).toEqual(cctpRouterQuery)
    Severity: Major
    Found in packages/sdk-router/src/module/query.test.ts and 1 other location - About 3 hrs to fix
    packages/sdk-router/src/module/query.test.ts on lines 49..62

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

    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('narrowToRouterQuery', () => {
        it('narrows a Query with swapAdapter', () => {
          const query = routerQuery as Query
          const narrowed = narrowToRouterQuery(query)
          expect(narrowed).toEqual(routerQuery)
    Severity: Major
    Found in packages/sdk-router/src/module/query.test.ts and 1 other location - About 3 hrs to fix
    packages/sdk-router/src/module/query.test.ts on lines 64..77

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

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

      const cctpRouterQuery: CCTPRouterQuery = {
        routerAdapter: '6',
        tokenOut: '7',
        minAmountOut: BigNumber.from(8),
        deadline: BigNumber.from(9),
    Severity: Major
    Found in packages/sdk-router/src/module/query.test.ts and 5 other locations - About 1 hr to fix
    packages/sdk-router/src/module/query.test.ts on lines 16..22
    packages/sdk-router/src/router/synapseCCTPRouter.test.ts on lines 18..24
    packages/sdk-router/src/router/synapseRouter.test.ts on lines 18..24
    packages/sdk-router/src/sdk.test.ts on lines 871..877
    packages/sdk-router/src/sdk.test.ts on lines 878..884

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

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

      const routerQuery: RouterQuery = {
        swapAdapter: '1',
        tokenOut: '2',
        minAmountOut: BigNumber.from(3),
        deadline: BigNumber.from(4),
    Severity: Major
    Found in packages/sdk-router/src/module/query.test.ts and 5 other locations - About 1 hr to fix
    packages/sdk-router/src/module/query.test.ts on lines 24..30
    packages/sdk-router/src/router/synapseCCTPRouter.test.ts on lines 18..24
    packages/sdk-router/src/router/synapseRouter.test.ts on lines 18..24
    packages/sdk-router/src/sdk.test.ts on lines 871..877
    packages/sdk-router/src/sdk.test.ts on lines 878..884

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

    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('reduces a RouterQuery with extra properties', () => {
          const query = reduceToQuery({ ...routerQuery, ...extraProperties })
          expect(query).toEqual(routerQuery)
        })
    Severity: Minor
    Found in packages/sdk-router/src/module/query.test.ts and 1 other location - About 35 mins to fix
    packages/sdk-router/src/module/query.test.ts on lines 43..46

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

    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('reduces a CCTPRouterQuery with extra properties', () => {
          const query = reduceToQuery({ ...cctpRouterQuery, ...extraProperties })
          expect(query).toEqual(cctpRouterQuery)
        })
    Severity: Minor
    Found in packages/sdk-router/src/module/query.test.ts and 1 other location - About 35 mins to fix
    packages/sdk-router/src/module/query.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 46.

    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