synapsecns/sanguine

View on GitHub

Showing 13,422 of 13,422 total issues

File generated.ts has 480 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { api } from '@/slices/api/slice'
export type Maybe<T> = T | null
export type InputMaybe<T> = Maybe<T>
export type Exact<T extends { [key: string]: unknown }> = {
  [K in keyof T]: T[K]
Severity: Minor
Found in packages/synapse-interface/slices/api/generated.ts - About 7 hrs to fix

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

      it('should return bridge quotes for NativeGasAddress', async () => {
        const response = await request(app).get('/bridge').query({
          fromChain: '1',
          toChain: '10',
          fromToken: NativeGasAddress,
    Severity: Major
    Found in packages/rest-api/src/tests/bridgeRoute.test.ts and 1 other location - About 7 hrs to fix
    packages/rest-api/src/tests/bridgeRoute.test.ts on lines 45..58

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

    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 bridge quotes for ZeroAddress', async () => {
        const response = await request(app).get('/bridge').query({
          fromChain: '1',
          toChain: '10',
          fromToken: ZeroAddress,
    Severity: Major
    Found in packages/rest-api/src/tests/bridgeRoute.test.ts and 1 other location - About 7 hrs to fix
    packages/rest-api/src/tests/bridgeRoute.test.ts on lines 60..74

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

    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 index.tsx has 477 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { useState } from 'react'
    import { CHAINS } from '@synapsecns/synapse-constants'
    import TextField from '@mui/material/TextField'
    import {
      inputStyle,
    Severity: Minor
    Found in packages/explorer-ui/components/pages/Home/UniversalSearch/index.tsx - About 7 hrs to fix

      Method executableSchema.Complexity has 87 return statements (exceeds 4 allowed).
      Open

      func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
          ec := executionContext{nil, e, 0, 0, nil}
          _ = ec
          switch typeName + "." + field {
      
      
      Severity: Major
      Found in services/explorer/consumer/client/resolver-client/server.go - About 7 hrs to fix

        Method executableSchema.Complexity has 87 return statements (exceeds 4 allowed).
        Open

        func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
            ec := executionContext{nil, e, 0, 0, nil}
            _ = ec
            switch typeName + "." + field {
        
        
        Severity: Major
        Found in services/scribe/graphql/server/graph/resolver/server.go - About 7 hrs to fix

          Function RFQFlow has 183 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const RFQFlow = () => {
            return (
              <svg
                width="100%"
                viewBox="-240 0 480 224"
          Severity: Major
          Found in docs/bridge/blog-posts/RFQFlow.tsx - About 7 hrs to fix

            Function RFQFlow has 183 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              File quoter.go has 721 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              // Package quoter submits quotes to the RFQ API for which assets the relayer is willing to relay.
              package quoter
              
              import (
                  "context"
              Severity: Minor
              Found in services/rfq/relayer/quoter/quoter.go - About 7 hrs to fix

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

                export function TransactionPopoverContainer({
                  children,
                  className,
                }: {
                  children: any
                packages/synapse-interface/components/Pools/PoolActionOptions.tsx on lines 114..145

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

                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

                export function TransactionPopoverContainer({
                  children,
                  className,
                }: {
                  children: any
                packages/synapse-interface/components/Activity/Transaction/TransactionOptions.tsx on lines 139..170

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

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

                const constructJSON = (swappableMap, exclusionList) => {
                  const result = {}
                
                  // Iterate through the chains
                  for (const chainA in swappableMap) {
                Severity: Minor
                Found in packages/synapse-interface/constants/existingBridgeRoutes.ts - 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 constructJSON has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                Open

                const constructJSON = (
                  swappableMap,
                  exclusionList
                ): StringifiedBridgeRoutes => {
                  const result = {}
                Severity: Minor
                Found in packages/rest-api/src/utils/bridgeRouteMapping.ts - 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 constructJSON has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                Open

                const constructJSON = (swappableMap, exclusionList) => {
                  const result = {}
                
                  for (const chainA in swappableMap) {
                    for (const tokenA in swappableMap[chainA]) {
                Severity: Minor
                Found in packages/widget/src/constants/existingBridgeRoutes.ts - 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

                  try {
                    // Fetch the image from the URL
                    const response = await fetch(token.icon)
                    if (!response.ok) {
                      throw new Error(`Failed to fetch image: ${response.statusText}`)
                Severity: Major
                Found in packages/rest-api/src/routes/addressIconRoute.ts and 1 other location - About 7 hrs to fix
                packages/rest-api/src/routes/chainIconRoute.ts on lines 21..40

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

                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

                  try {
                    // Fetch the image from the URL
                    const response = await fetch(chain.chainImg)
                    if (!response.ok) {
                      throw new Error(`Failed to fetch image: ${response.statusText}`)
                Severity: Major
                Found in packages/rest-api/src/routes/chainIconRoute.ts and 1 other location - About 7 hrs to fix
                packages/rest-api/src/routes/addressIconRoute.ts on lines 30..49

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

                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

                Config has 51 methods (exceeds 20 allowed). Consider refactoring.
                Open

                func (c Config) getChainConfigValue(chainID int, fieldName string) (interface{}, error) {
                    chainConfig, ok := c.Chains[chainID]
                    if ok {
                        value, err := getFieldValue(chainConfig, fieldName)
                        if err != nil {
                Severity: Major
                Found in services/rfq/relayer/relconfig/getters.go - About 7 hrs to fix

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

                    try {
                      let value = rawVal.replace(/[$,]/g, '')
                      if (['.', '0.', '', '.0'].includes(value)) {
                        return 0n
                      }
                  Severity: Major
                  Found in packages/synapse-interface/utils/bigint/format.ts and 1 other location - About 7 hrs to fix
                  packages/widget/src/utils/stringToBigInt.ts on lines 10..36

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

                  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

                    try {
                      let value = rawVal.replace(/[$,]/g, '')
                      if (['.', '0.', '', '.0'].includes(value)) {
                        return 0n
                      }
                  Severity: Major
                  Found in packages/widget/src/utils/stringToBigInt.ts and 1 other location - About 7 hrs to fix
                  packages/synapse-interface/utils/bigint/format.ts on lines 158..185

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

                  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('Does not filter zero amount queries', async () => {
                          const originQueries = await cctpRouter.getOriginQueries(
                            ETH_USDC,
                            ['CCTP.USDC', 'fakeSymbol'],
                            BigNumber.from(10).pow(9)
                  Severity: Major
                  Found in packages/sdk-router/src/router/synapseCCTPRouter.test.ts and 1 other location - About 7 hrs to fix
                  packages/sdk-router/src/router/synapseRouter.test.ts on lines 113..124

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language