synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Avoid deeply nested control flow statements.
Open

                        goto DumpRes
Severity: Major
Found in core/ginhelper/gindump.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            goto End
    Severity: Major
    Found in core/ginhelper/gindump.go - About 45 mins to fix

      Method EventDB.StoreEthTxAtHead has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (_m *EventDB) StoreEthTxAtHead(ctx context.Context, tx *types.Transaction, chainID uint32, blockHash common.Hash, blockNumber uint64, transactionIndex uint64) error {
      Severity: Minor
      Found in services/scribe/db/mocks/event_db.go - About 45 mins to fix

        Method Client.GetReceiptsAtHeadRange has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (c *Client) GetReceiptsAtHeadRange(ctx context.Context, chainID int, startBlock int, endBlock int, page int, httpRequestOptions ...client.HTTPRequestOption) (*GetReceiptsAtHeadRange, error) {
        Severity: Minor
        Found in services/scribe/graphql/client/client.go - About 45 mins to fix

          Method Store.StoreEthTx has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (s Store) StoreEthTx(ctx context.Context, tx *types.Transaction, chainID uint32, blockHash common.Hash, blockNumber uint64, transactionIndex uint64) error {
          Severity: Minor
          Found in services/scribe/db/datastore/sql/base/transaction.go - About 45 mins to fix

            Method Store.StoreEthTxAtHead has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (s Store) StoreEthTxAtHead(ctx context.Context, tx *types.Transaction, chainID uint32, blockHash common.Hash, blockNumber uint64, transactionIndex uint64) error {
            Severity: Minor
            Found in services/scribe/db/datastore/sql/base/athead.go - About 45 mins to fix

              Method Store.RetrieveUnconfirmedEthTxsFromHeadRangeQuery has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func (s Store) RetrieveUnconfirmedEthTxsFromHeadRangeQuery(ctx context.Context, ethTxFilter db.EthTxFilter, startBlock uint64, endBlock uint64, lastIndexed uint64, page int) ([]db.TxWithBlockNumber, error) {
              Severity: Minor
              Found in services/scribe/db/datastore/sql/base/athead.go - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        goto DumpRes
                Severity: Major
                Found in core/ginhelper/gindump.go - About 45 mins to fix

                  Function formatBigIntToString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const formatBigIntToString = (
                    bi: bigint,
                    nativePrecision: number,
                    decimalPlaces?: number
                  ) => {
                  Severity: Minor
                  Found in packages/explorer-ui/utils/formatBigIntToString.ts - About 45 mins 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 formatBigIntToString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const formatBigIntToString = (
                    bi: bigint,
                    nativePrecision: number,
                    decimalPlaces?: number
                  ) => {
                  Severity: Minor
                  Found in packages/synapse-interface/utils/bigint/format.ts - About 45 mins 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 captureTransport.RoundTrip has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (t *captureTransport) RoundTrip(req *http.Request) (_ *http.Response, err error) {
                      var response string
                  
                      _, span := t.metrics.Tracer().Start(req.Context(), RequestSpanName)
                      defer func() {
                  Severity: Minor
                  Found in core/metrics/instrumentation/httpcapture/http.go - About 45 mins 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

                  Avoid deeply nested control flow statements.
                  Open

                                  with open(file_path, 'r') as json_file:
                                      data = json.load(json_file)
                                      address = data.get('address', 'Address not found')
                                      print(f"{file.replace('.json', '')}: {address}")
                          print()  # Print a newline for better separation
                  Severity: Major
                  Found in packages/contracts-core/deployments/address_printer.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              for (const tokenB in swappableMap[chainB]) {
                                const symbolB = swappableMap[chainB][tokenB].symbol
                                const value = `${symbolB}-${chainB}`
                    
                                if (exclusionList.includes(value)) continue
                    Severity: Major
                    Found in packages/synapse-interface/constants/existingBridgeRoutes.ts - About 45 mins to fix

                      Function swap has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        this: SynapseSDK,
                        chainId: number,
                        to: string,
                        token: string,
                        amount: BigintIsh,
                      Severity: Minor
                      Found in packages/sdk-router/src/operations/swap.ts - About 45 mins to fix

                        Function fetchJsonData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const fetchJsonData = async (url: string): Promise<any> => {
                          // Configurable parameters
                          const maxRetries = 3 // maximum number of retries
                          const initialDelay = 1000 // initial delay in milliseconds
                        
                        

                        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

                        Avoid deeply nested control flow statements.
                        Open

                                  for (const tokenB in swappableMap[chainB]) {
                                    const symbolB = swappableMap[chainB][tokenB].symbol
                                    const value = `${symbolB}-${chainB}`
                        
                                    if (exclusionList.includes(value)) continue
                        Severity: Major
                        Found in packages/widget/src/constants/existingBridgeRoutes.ts - About 45 mins to fix

                          Function swapQuote has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            this: SynapseSDK,
                            chainId: number,
                            tokenIn: string,
                            tokenOut: string,
                            amountIn: BigintIsh,
                          Severity: Minor
                          Found in packages/sdk-router/src/operations/swap.ts - About 45 mins to fix

                            Function destinationAddressMiddleware has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              (_store) => (next) => async (action) => {
                                if (setDestinationAddress.match(action) && action.payload !== null) {
                                  const isRisky = await screenAddress(action.payload)
                                  if (isRisky) {
                                    return

                            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 applyBridgeDeadline has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              this: SynapseSDK,
                              bridgeModuleName: string,
                              originQueryInitial: Query,
                              destQueryInitial: Query,
                              originDeadline?: BigNumber,
                            Severity: Minor
                            Found in packages/sdk-router/src/operations/bridge.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                        for (const tokenB in swappableMap[chainB]) {
                                          const symbolB = swappableMap[chainB][tokenB].symbol
                                          const value = `${symbolB}-${chainB}`
                              
                                          if (exclusionList.includes(value)) {
                              Severity: Major
                              Found in packages/rest-api/src/utils/bridgeRouteMapping.ts - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language