synapsecns/sanguine

View on GitHub

Showing 13,422 of 13,422 total issues

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

export const WETH: BridgeableToken = {
  addresses: {
    [CHAINS.ETHEREUM.id]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
    [CHAINS.OPTIMISM.id]: '0x121ab82b49B2BC4c7901CA46B8277962b4350204',
    [CHAINS.BOBA.id]: '0xd203De32170130082896b4111eDF825a4774c18E',
Severity: Major
Found in packages/rest-api/src/constants/bridgeable.ts and 3 other locations - About 1 day to fix
packages/rest-api/src/constants/bridgeable.ts on lines 763..796
packages/widget/src/constants/bridgeable.ts on lines 763..796
packages/widget/src/constants/bridgeable.ts on lines 1287..1320

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

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

export const NETH: BridgeableToken = {
  addresses: {
    [CHAINS.OPTIMISM.id]: '0x809DC529f07651bD43A172e8dB6f4a7a0d771036',
    [CHAINS.FANTOM.id]: '0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00',
    [CHAINS.BOBA.id]: '0x96419929d7949D6A801A6909c145C8EEf6A40431',
Severity: Major
Found in packages/widget/src/constants/bridgeable.ts and 3 other locations - About 1 day to fix
packages/rest-api/src/constants/bridgeable.ts on lines 763..796
packages/rest-api/src/constants/bridgeable.ts on lines 1291..1324
packages/widget/src/constants/bridgeable.ts on lines 1287..1320

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

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 i_light_inbox.go has 1011 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Code generated by mockery v2.14.0. DO NOT EDIT.

package mocks

import (
Severity: Major
Found in agents/contracts/lightinbox/mocks/i_light_inbox.go - About 1 day to fix

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

        {
          inputs: [
            { internalType: 'address', name: 'recipient', type: 'address' },
            { internalType: 'uint256', name: 'chainId', type: 'uint256' },
            { internalType: 'address', name: 'token', type: 'address' },
    Severity: Major
    Found in packages/rfq-loadtest/src/abi.ts and 1 other location - About 1 day to fix
    packages/synapse-interface/constants/abis/synapseRouter.ts on lines 212..303

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

    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

      {
        inputs: [
          {
            internalType: 'address',
            name: 'to',
    Severity: Major
    Found in packages/synapse-interface/constants/abis/synapseRouter.ts and 1 other location - About 1 day to fix
    packages/rfq-loadtest/src/abi.ts on lines 837..872

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

    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

    Function StateManagedSwap has 335 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const StateManagedSwap = () => {
      const { address } = useAccount()
      const { synapseSDK } = useSynapseContext()
      const swapDisplayRef = useRef(null)
      const quoteToastRef = useRef({ id: '' })
    Severity: Major
    Found in packages/synapse-interface/pages/swap/index.tsx - About 1 day to fix

      File simulated_test_backend.go has 973 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      // Code generated by mockery v2.14.0. DO NOT EDIT.
      
      package mocks
      
      import (
      Severity: Major
      Found in ethergo/backends/mocks/simulated_test_backend.go - About 1 day to fix

        Function Home has 333 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Home = () => {
          const [platform, setPlatform] = useState('ALL')
          const [transactionsArr, setTransactionsArr] = useState([])
          const [dailyDataArr, setDailyDataArr] = useState([])
          const [kappa, setKappa] = useState('')
        Severity: Major
        Found in packages/explorer-ui/components/pages/Home/index.tsx - About 1 day to fix

          Method GuardSuite.TestUpdateAgentStatusOnRemote has 356 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (g *GuardSuite) TestUpdateAgentStatusOnRemote() {
              // This test requires a call to anvil's evm.IncreaseTime() cheat code, so we should
              // set up the backends with anvil.
          
              testDone := false
          Severity: Major
          Found in agents/agents/guard/fraud_test.go - About 1 day to fix

            Method executionContext._Transaction has a Cognitive Complexity of 97 (exceeds 20 allowed). Consider refactoring.
            Open

            func (ec *executionContext) _Transaction(ctx context.Context, sel ast.SelectionSet, obj *model.Transaction) graphql.Marshaler {
                fields := graphql.CollectFields(ec.OperationContext, sel, transactionImplementors)
            
                out := graphql.NewFieldSet(fields)
                deferred := make(map[string]*graphql.FieldSet)
            Severity: Minor
            Found in services/explorer/consumer/client/resolver-client/server.go - About 1 day 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

            Method executionContext._Transaction has a Cognitive Complexity of 97 (exceeds 20 allowed). Consider refactoring.
            Open

            func (ec *executionContext) _Transaction(ctx context.Context, sel ast.SelectionSet, obj *model.Transaction) graphql.Marshaler {
                fields := graphql.CollectFields(ec.OperationContext, sel, transactionImplementors)
            
                out := graphql.NewFieldSet(fields)
                deferred := make(map[string]*graphql.FieldSet)
            Severity: Minor
            Found in services/scribe/graphql/server/graph/resolver/server.go - About 1 day 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

            package db_test
            
            import (
                dbSQL "database/sql"
                "fmt"
            Severity: Major
            Found in services/cctp-relayer/db/suite_test.go and 1 other location - About 1 day to fix
            services/rfq/api/db/suite_test.go on lines 1..109

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

            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

            package db_test
            
            import (
                dbSQL "database/sql"
                "fmt"
            Severity: Major
            Found in services/rfq/api/db/suite_test.go and 1 other location - About 1 day to fix
            services/cctp-relayer/db/suite_test.go on lines 1..109

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

            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

                describe('ARB Native -> ETH Native', () => {
                  const amount = BigNumber.from(10).pow(18)
                  const resultPromise: Promise<BridgeQuote> = synapse.bridgeQuote(
                    SupportedChainId.ARBITRUM,
                    SupportedChainId.ETH,
            Severity: Major
            Found in packages/sdk-router/src/sdk.test.ts and 4 other locations - About 1 day to fix
            packages/sdk-router/src/sdk.test.ts on lines 320..357
            packages/sdk-router/src/sdk.test.ts on lines 359..396
            packages/sdk-router/src/sdk.test.ts on lines 459..496
            packages/sdk-router/src/sdk.test.ts on lines 709..746

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

            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

                describe('AVAX gOHM -> BSC gOHM', () => {
                  const amount = BigNumber.from(10).pow(21)
                  const resultPromise: Promise<BridgeQuote> = synapse.bridgeQuote(
                    SupportedChainId.AVALANCHE,
                    SupportedChainId.BSC,
            Severity: Major
            Found in packages/sdk-router/src/sdk.test.ts and 4 other locations - About 1 day to fix
            packages/sdk-router/src/sdk.test.ts on lines 320..357
            packages/sdk-router/src/sdk.test.ts on lines 459..496
            packages/sdk-router/src/sdk.test.ts on lines 623..660
            packages/sdk-router/src/sdk.test.ts on lines 709..746

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

            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

                describe('BSC gOHM -> AVAX gOHM', () => {
                  const amount = BigNumber.from(10).pow(21)
                  const resultPromise: Promise<BridgeQuote> = synapse.bridgeQuote(
                    SupportedChainId.BSC,
                    SupportedChainId.AVALANCHE,
            Severity: Major
            Found in packages/sdk-router/src/sdk.test.ts and 4 other locations - About 1 day to fix
            packages/sdk-router/src/sdk.test.ts on lines 320..357
            packages/sdk-router/src/sdk.test.ts on lines 359..396
            packages/sdk-router/src/sdk.test.ts on lines 459..496
            packages/sdk-router/src/sdk.test.ts on lines 623..660

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

            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

                describe('ARB USDC -> ETH USDC (using CCTP)', () => {
                  const amount = BigNumber.from(10).pow(12)
                  const resultPromise: Promise<BridgeQuote> = synapse.bridgeQuote(
                    SupportedChainId.ARBITRUM,
                    SupportedChainId.ETH,
            Severity: Major
            Found in packages/sdk-router/src/sdk.test.ts and 4 other locations - About 1 day to fix
            packages/sdk-router/src/sdk.test.ts on lines 320..357
            packages/sdk-router/src/sdk.test.ts on lines 359..396
            packages/sdk-router/src/sdk.test.ts on lines 623..660
            packages/sdk-router/src/sdk.test.ts on lines 709..746

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

            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

                describe('AVAX USDC.e -> BSC USDC', () => {
                  const amount = BigNumber.from(10).pow(9)
                  const resultPromise: Promise<BridgeQuote> = synapse.bridgeQuote(
                    SupportedChainId.AVALANCHE,
                    SupportedChainId.BSC,
            Severity: Major
            Found in packages/sdk-router/src/sdk.test.ts and 4 other locations - About 1 day to fix
            packages/sdk-router/src/sdk.test.ts on lines 359..396
            packages/sdk-router/src/sdk.test.ts on lines 459..496
            packages/sdk-router/src/sdk.test.ts on lines 623..660
            packages/sdk-router/src/sdk.test.ts on lines 709..746

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

            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 executionContext._Query has a Cognitive Complexity of 95 (exceeds 20 allowed). Consider refactoring.
            Open

            func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
                fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors)
                ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
                    Object: "Query",
                })
            Severity: Minor
            Found in services/explorer/consumer/client/resolver-client/server.go - About 1 day 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

            Method executionContext._Query has a Cognitive Complexity of 95 (exceeds 20 allowed). Consider refactoring.
            Open

            func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
                fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors)
                ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
                    Object: "Query",
                })
            Severity: Minor
            Found in services/scribe/graphql/server/graph/resolver/server.go - About 1 day 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