synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function overrideJsonBigIntSerialization has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const overrideJsonBigIntSerialization = () => {
    const originalJSONStringify = JSON.stringify
  
    JSON.stringify = function (value: any, replacer, space: number): string {
      const bigIntReplacer = (_key: string, value: any): any => {

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

const PriceImpactDisplay = ({ priceImpact }: { priceImpact: bigint }) => {
  let colorClassName: string
  let labelText: string
  let content: any

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

export const SelectorWrapper = ({
  dataTestId,
  label,
  placeholder,
  selectedItem,
Severity: Minor
Found in packages/synapse-interface/components/ui/SelectorWrapper.tsx - About 1 hr 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 getChangeTreeFromGit has 60 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func getChangeTreeFromGit(repoPath string, ghContext *actionscore.Context, head, base string) (tree.Tree, error) {
    // open the repository
    repository, err := git.PlainOpen(repoPath)
    if err != nil {
        return nil, fmt.Errorf("could not open repository %s: %w", repoPath, err)
Severity: Minor
Found in contrib/git-changes-action/detector/git/git.go - About 1 hr to fix

    Method Store.GetEarliestStateInRange has 60 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (s Store) GetEarliestStateInRange(ctx context.Context, chainID, destination, startNonce, endNonce uint32) (*agentsTypes.State, error) {
        statesTableName, err := dbcommon.GetModelName(s.DB(), &State{})
        if err != nil {
            return nil, fmt.Errorf("failed to get states table name: %w", err)
        }
    Severity: Minor
    Found in agents/agents/executor/db/sql/base/crosstable.go - About 1 hr to fix

      Method QuoterAPIServer.collectRelayerResponses has 60 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (r *QuoterAPIServer) collectRelayerResponses(ctx context.Context, request *model.PutRFQRequest, requestID string) (responses map[string]*model.WsRFQResponse) {
          ctx, span := r.handler.Tracer().Start(ctx, "collectRelayerResponses", trace.WithAttributes(
              attribute.String("user_address", request.UserAddress),
              attribute.String("request_id", requestID),
          ))
      Severity: Minor
      Found in services/rfq/api/rest/rfq.go - About 1 hr to fix

        Function deployParseNet has 60 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func deployParseNet() error {
            globMux.Lock()
            defer globMux.Unlock()
        
            // 100 million ether
        Severity: Minor
        Found in services/explorer/contracts/user/messages.go - About 1 hr to fix

          Method BackfillSuite.redeemAndSwapParity has 60 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (b *BackfillSuite) redeemAndSwapParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
              // parse the log
              if useV1 {
                  parsedLog, err := parser.Filterer.ParseTokenRedeemAndSwap(*log)
                  if err != nil {
          Severity: Minor
          Found in services/explorer/backfill/chain_test.go - About 1 hr to fix

            Method BackfillSuite.depositAndSwapParity has 60 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (b *BackfillSuite) depositAndSwapParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
                // parse the log
                if useV1 {
                    parsedLog, err := parser.Filterer.ParseTokenDepositAndSwap(*log)
                    if err != nil {
            Severity: Minor
            Found in services/explorer/backfill/chain_test.go - About 1 hr to fix

              Function eventToSwapEvent has 60 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func eventToSwapEvent(event swapTypes.EventLog, chainID uint32) model.SwapEvent {
                  var buyer sql.NullString
              
                  if event.GetBuyer() != nil {
                      buyer.Valid = true
              Severity: Minor
              Found in services/explorer/consumer/parser/swapparser.go - About 1 hr to fix

                Method APISuite.SetupTest has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (g *APISuite) SetupTest() {
                    g.TestSuite.SetupTest()
                    g.dbPath = filet.TmpDir(g.T(), "")
                    g.SetTestTimeout(time.Minute * 3)
                
                
                Severity: Minor
                Found in services/scribe/api/suite_test.go - About 1 hr to fix

                  Method ScribeSuite.TestLargeVolume has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (s *ScribeSuite) TestLargeVolume() {
                      if os.Getenv("CI") != "" || !s.runVolumeTest {
                          s.T().Skip("This is a long running test")
                      }
                      const runtime = 100
                  Severity: Minor
                  Found in services/scribe/service/chain_test.go - About 1 hr to fix

                    Method DBSuite.TestUnconfirmedTxsQuery has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (t *DBSuite) TestUnconfirmedTxsQuery() {
                        t.RunOnAllDBs(func(testDB db.EventDB) {
                            chainID := gofakeit.Uint32()
                            const lastIndexed = 100
                            const confirmedBlockHeight = 100
                    Severity: Minor
                    Found in services/scribe/db/athead_test.go - About 1 hr to fix

                      Function TestHeadersToMap has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func TestHeadersToMap(t *testing.T) {
                          tests := []struct {
                              name     string
                              input    string
                              expected map[string]string
                      Severity: Minor
                      Found in core/metrics/otlp_test.go - About 1 hr to fix

                        Method testJaeger.StartJaegerServer has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (j *testJaeger) StartJaegerServer(ctx context.Context) *uiResource {
                            if core.HasEnv(internal.JaegerEndpoint) && !core.HasEnv(internal.JaegerUIEndpoint) {
                                j.tb.Fatalf("%s is set but %s is not, please remove %s or set %s", internal.JaegerEndpoint, internal.JaegerUIEndpoint, internal.JaegerEndpoint, internal.JaegerUIEndpoint)
                            }
                        
                        
                        Severity: Minor
                        Found in core/metrics/localmetrics/jaeger.go - About 1 hr to fix

                          Function getSinglePoolData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const getSinglePoolData = async (
                            chainId: number,
                            pool: Token,
                            prices?: any
                          ): Promise<PoolData> => {
                          Severity: Minor
                          Found in packages/synapse-interface/utils/actions/getPoolData.ts - About 1 hr to fix

                            Function useEventCountdownProgressBar has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const useEventCountdownProgressBar = (
                              eventLabel: string,
                              startDate: Date,
                              endDate: Date | null,
                              hideProgress?: boolean

                              Function BridgeSection has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function BridgeSection() {
                                const t = useTranslations('Landing.BridgeSection')
                              
                                return (
                                  <SectionContainer
                              Severity: Minor
                              Found in packages/synapse-interface/pages/landing/sections/BridgeSection.tsx - About 1 hr to fix

                                Function generateAllBridgeEventsQueryFromOriginMv has 11 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                func generateAllBridgeEventsQueryFromOriginMv(chainIDFrom []*int, addressFrom *string, maxAmount *int, maxAmountUsd *int, startTime *int, endTime *int, tokenAddressFrom []*string, txHash *string, kappa *string, pending *bool, page int) string {
                                Severity: Major
                                Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix

                                  Function generateAllBridgeEventsQueryFromDestinationMv has 11 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func generateAllBridgeEventsQueryFromDestinationMv(chainIDTo []*int, addressTo *string, minAmount *int, minAmountUsd *int, startTime *int, endTime *int, tokenAddressTo []*string, kappa *string, txHash *string, pending *bool, page int) string {
                                  Severity: Major
                                  Found in services/explorer/graphql/server/graph/queryutils.go - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language