synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function BridgeButton has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const BridgeButton = () => {
  const t = useTranslations('FauxBridge')

  return (
    <div className="relative group">

    Method Notary.isValidOnOrigin has 17 return statements (exceeds 4 allowed).
    Open

    func (n *Notary) isValidOnOrigin(parentCtx context.Context, state types.State, domain domains.DomainClient) bool {
        if state == nil {
            return false
        }
    
    
    Severity: Major
    Found in agents/agents/notary/notary.go - About 1 hr to fix

      Method QuoteRequestHandler.handleProofPosted has 17 return statements (exceeds 4 allowed).
      Open

      func (q *QuoteRequestHandler) handleProofPosted(ctx context.Context, span trace.Span, request reldb.QuoteRequest) (err error) {
          // we shouldnt' check the claim yet
          if !q.shouldCheckClaim(request) {
              return nil
          }
      Severity: Major
      Found in services/rfq/relayer/service/handlers.go - About 1 hr to fix

        Method HarmonyProxy.getLogsHarmonyVerify has 17 return statements (exceeds 4 allowed).
        Open

        func (r *HarmonyProxy) getLogsHarmonyVerify(parentCtx context.Context, query ethereum.FilterQuery, rawBody []byte) (rawResp []byte, err error) {
            ctx, span := r.tracer.Start(parentCtx, "getLogsHarmonyVerify")
        
            defer func() {
                metrics.EndSpanWithErr(span, err)
        Severity: Major
        Found in services/omnirpc/modules/harmonyproxy/harmonyproxy.go - About 1 hr to fix

          Function Start has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
          Open

          func Start(ctx context.Context, cfg serverConfig.Config, handler metrics.Handler) error {
              router := ginhelper.New(logger)
              router.GET(ginhelper.MetricsEndpoint, gin.WrapH(handler.Handler()))
          
              // initialize the database
          Severity: Minor
          Found in services/explorer/api/server.go - 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 sortedInsert has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          export const sortedInsert = <T>(
            items: T[],
            add: T,
            maxSize: number,
            comparator: (a: T, b: T) => number
          Severity: Minor
          Found in packages/sdk-router/src/utils/sortedInsert.ts - 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 DepositButton has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          const DepositButton = ({ approveTxn, depositTxn }) => {
            const t = useTranslations('Pools.DepositButton')
            const [isConnected, setIsConnected] = useState(false)
            const { openConnectModal } = useConnectModal()
          
          

          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 queryResolver.DailyStatisticsByChain has 64 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (r *queryResolver) DailyStatisticsByChain(ctx context.Context, chainID *int, typeArg *model.DailyStatisticType, platform *model.Platform, duration *model.Duration, useCache *bool, useMv *bool) ([]*model.DateResultByChain, error) {
              cacheKey := fmt.Sprintf("dailyStatisticsByChain, %s, %s, %s, %s", keyGenHandleNilInt(chainID), typeArg.String(), duration.String(), platform.String())
          
              if useCache != nil && *useCache {
                  locker := r.CacheMutex.Lock(cacheKey)
          Severity: Minor
          Found in services/explorer/graphql/server/graph/queries.resolvers.go - About 1 hr to fix

            Method BackfillSuite.withdrawParity has 64 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

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

              Method BackfillSuite.mintParity has 64 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

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

                Function NewClickhouseStore has 64 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func NewClickhouseStore(src string) (func(), *int, error) {
                    timeout := time.Second
                    port := freeport.GetPort()
                    portStr := strconv.Itoa(port)
                    conn, err := net.DialTimeout("tcp", net.JoinHostPort("localhost", portStr), timeout)
                Severity: Minor
                Found in services/explorer/testutil/clickhouse/clickhouse.go - About 1 hr to fix

                  Method IndexerSuite.TestContractBackfillFromPreIndexed has 64 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (x *IndexerSuite) TestContractBackfillFromPreIndexed() {
                      // Get simulated blockchain, deploy the test contract, and set up test variables.
                      simulatedChain := geth.NewEmbeddedBackendForChainID(x.GetSuiteContext(), x.T(), big.NewInt(142))
                      simulatedClient, err := backend.DialBackend(x.GetTestContext(), simulatedChain.RPCAddress(), x.metrics)
                      Nil(x.T(), err)
                  Severity: Minor
                  Found in services/scribe/service/indexer/indexer_test.go - About 1 hr to fix

                    Function TestCombineStreams has 64 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func TestCombineStreams(t *testing.T) {
                        tests := []struct {
                            name           string
                            inputs         []string
                            expectedOutput []string
                    Severity: Minor
                    Found in core/processlog/stream_test.go - About 1 hr to fix

                      Function TestGetEnvBool has 64 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func TestGetEnvBool(t *testing.T) {
                          type args struct {
                              name       string
                              defaultVal bool
                          }
                      Severity: Minor
                      Found in core/os_test.go - About 1 hr to fix

                        Function SecuritySection has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function SecuritySection() {
                          const t = useTranslations('Landing.SecuritySection')
                        
                          return (
                            <SectionContainer

                          Function txErrorHandler has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const txErrorHandler = (err: any) => {
                            if (err?.details && checkStringForRejection(err?.details)) {
                              return toast.error('User denied transaction', {
                                id: 'toast-error-user-reject',
                                duration: 5000,
                          Severity: Minor
                          Found in packages/synapse-interface/utils/txErrorHandler.tsx - About 1 hr to fix

                            Function ConfirmDestinationAddressWarning has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const ConfirmDestinationAddressWarning = () => {
                              const dispatch = useAppDispatch()
                              const t = useTranslations('Destination')
                            
                              const {

                              Method chainQueue.bumpTX has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (c *chainQueue) bumpTX(parentCtx context.Context, ogTx db.TX) (err error) {
                                  if !c.isBumpIntervalElapsed(ogTx) {
                                      c.addToReprocessQueue(ogTx)
                                      return nil
                                  }
                              Severity: Minor
                              Found in ethergo/submitter/chain_queue.go - About 1 hr to fix

                                Function TestSnapshotRootAndProofs has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func TestSnapshotRootAndProofs(t *testing.T) {
                                    // TODO (Max Planck): Fix me
                                    ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
                                    defer cancel()
                                
                                
                                Severity: Minor
                                Found in agents/types/snapshot_test.go - About 1 hr to fix

                                  Method QuoteRequestHandler.commitPendingBalance has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func (q *QuoteRequestHandler) commitPendingBalance(ctx context.Context, span trace.Span, request *reldb.QuoteRequest) (err error) {
                                      // lock the consumed balance
                                      key := getBalanceMtxKey(q.Dest.ChainID, request.Transaction.DestToken)
                                      span.SetAttributes(attribute.String("balance_lock_key", key))
                                      unlocker, ok := q.balanceMtx.TryLock(key)
                                  Severity: Minor
                                  Found in services/rfq/relayer/service/handlers.go - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language