synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function calculateRemoveLiquidityOne has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  this: SynapseSDK,
  chainId: number,
  poolAddress: string,
  amount: BigNumber,
  poolIndex: number
Severity: Minor
Found in packages/sdk-router/src/operations/pools.ts - About 35 mins to fix

    Function getTransactions has 5 return statements (exceeds 4 allowed).
    Open

    func getTransactions(ctx context.Context, c AuroraClient, txHashes []common.Hash, blockHash common.Hash) (txes []*types.Transaction, err error) {
        if len(txHashes) == 0 {
            return txes, nil
        }
    
    
    Severity: Major
    Found in ethergo/chain/client/near/transactions.go - About 35 mins to fix

      Function NewAnvilBackend has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

      func NewAnvilBackend(ctx context.Context, t *testing.T, args *OptionBuilder) (*Backend, error) {
          t.Helper()
      
          pool, err := dockertest.NewPool("")
          if err != nil {
      Severity: Minor
      Found in ethergo/backends/anvil/anvil.go - About 35 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 NewSqliteStore has 5 return statements (exceeds 4 allowed).
      Open

      func NewSqliteStore(parentCtx context.Context, dbPath string, handler metrics.Handler) (_ *db2.Store, err error) {
          logger := log.Logger("sqlite-store")
      
          logger.Debugf("creating sqlite store at %s", dbPath)
      
      
      Severity: Major
      Found in ethergo/listener/suite_test.go - About 35 mins to fix

        Function outputModuleChanges has 5 return statements (exceeds 4 allowed).
        Open

        func outputModuleChanges(workingDirectory string, ct tree.Tree, includeDeps bool, dependencyLevelResolution string) (changedJSON string, unchangedJSON string, allModulesJSON string, err error) {
            var modules map[string]bool
        
            if dependencyLevelResolution == "packages" {
                modules, err = packagedetector.DetectChangedModules(workingDirectory, ct, includeDeps)
        Severity: Major
        Found in contrib/git-changes-action/main.go - About 35 mins to fix

          Function createAndCopyBinary has 5 return statements (exceeds 4 allowed).
          Open

          func createAndCopyBinary(tr *tar.Reader, tmpFile string) error {
              var errs []error
          
              // Validate path before file operations
              if err := validatePath(tmpFile, os.TempDir()); err != nil {
          Severity: Major
          Found in contrib/golang-ci-lint/main.go - About 35 mins to fix

            Function getHeadBase has 5 return statements (exceeds 4 allowed).
            Open

            func getHeadBase(repo *git.Repository) (head string, base string, err error) {
                co, err := repo.Head()
                if err != nil {
                    return "", "", fmt.Errorf("could not get head: %w", err)
                }
            Severity: Major
            Found in contrib/git-changes-action/detector/git/git.go - About 35 mins to fix

              Function NewScreener has 5 return statements (exceeds 4 allowed).
              Open

              func NewScreener(ctx context.Context, cfg config.Config, metricHandler metrics.Handler) (_ Screener, err error) {
                  screener := screenerImpl{
                      metrics:    metricHandler,
                      cfg:        cfg,
                      requestMux: mapmutex.NewStringMapMutex(),
              Severity: Major
              Found in contrib/screener-api/screener/screener.go - About 35 mins to fix

                Method Store.GetTXS has 5 return statements (exceeds 4 allowed).
                Open

                func (s *Store) GetTXS(ctx context.Context, fromAddress common.Address, chainID *big.Int, options ...db.Option) (txs []db.TX, err error) {
                    var dbTXs []ETHTX
                
                    madeOptions := db.ParseOptions(options...)
                    inArgs := statusToArgs(madeOptions.Statuses()...)
                Severity: Major
                Found in ethergo/submitter/db/txdb/store.go - About 35 mins to fix

                  Method Store.GetAllTXAttemptByStatus has 5 return statements (exceeds 4 allowed).
                  Open

                  func (s *Store) GetAllTXAttemptByStatus(ctx context.Context, fromAddress common.Address, chainID *big.Int, options ...db.Option) (txs []db.TX, err error) {
                      var dbTXs []ETHTX
                  
                      madeOptions := db.ParseOptions(options...)
                      inArgs := statusToArgs(madeOptions.Statuses()...)
                  Severity: Major
                  Found in ethergo/submitter/db/txdb/store.go - About 35 mins to fix

                    Function downloadAndExtract has 5 return statements (exceeds 4 allowed).
                    Open

                    func downloadAndExtract(ctx context.Context, version, osName, arch, destPath string) error {
                        tmpFile, err := os.CreateTemp("", "golangci-lint-*.tar.gz")
                        if err != nil {
                            return fmt.Errorf("failed to create temp file: %w", err)
                        }
                    Severity: Major
                    Found in contrib/golang-ci-lint/main.go - About 35 mins to fix

                      Method Config.Validate has 5 return statements (exceeds 4 allowed).
                      Open

                      func (c *Config) Validate() error {
                          if c.SlackBotToken == "" {
                              return errors.New("slack_bot_token is required")
                          }
                          if !strings.HasPrefix(c.SlackBotToken, "xoxb-") {
                      Severity: Major
                      Found in contrib/opbot/config/config.go - About 35 mins to fix

                        Method fuzzData.matchesTX has 5 return statements (exceeds 4 allowed).
                        Open

                        func (f *fuzzData) matchesTX(tx *types.Transaction) bool {
                            if f.nonce != tx.Nonce() {
                                return false
                            }
                            if f.gasPrice != nil && f.gasPrice.Cmp(tx.GasPrice()) != 0 {
                        Severity: Major
                        Found in ethergo/util/copy_test.go - About 35 mins to fix

                          Method Signer.GetTransactor has 5 return statements (exceeds 4 allowed).
                          Open

                          func (signingHandler *Signer) GetTransactor(ctx context.Context, chainID *big.Int) (*bind.TransactOpts, error) {
                              pubKeyBytes := secp256k1.S256().Marshal(signingHandler.pubKeyData.ecdsaKey.X, signingHandler.pubKeyData.ecdsaKey.Y)
                              latestSigner := types.LatestSignerForChainID(chainID)
                          
                              signerFn := func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
                          Severity: Major
                          Found in ethergo/signer/signer/awssigner/signing.go - About 35 mins to fix

                            Function NewMysqlStore has 5 return statements (exceeds 4 allowed).
                            Open

                            func NewMysqlStore(parentCtx context.Context, dbURL string, handler metrics.Handler) (_ *Store, err error) {
                                logger := log.Logger("mysql-store")
                            
                                ctx, span := handler.Tracer().Start(parentCtx, "start-mysql")
                                defer func() {
                            Severity: Major
                            Found in ethergo/submitter/suite_test.go - About 35 mins to fix

                              Method managedKey.getSignatureFromKMS has 5 return statements (exceeds 4 allowed).
                              Open

                              func (mk *managedKey) getSignatureFromKMS(ctx context.Context, messageBytes []byte) ([]byte, error) {
                                  // resolve a signature
                                  req := kmspb.AsymmetricSignRequest{
                                      Name: mk.KeyName,
                                      Digest: &kmspb.Digest{
                              Severity: Major
                              Found in ethergo/signer/signer/gcpsigner/google.go - About 35 mins to fix

                                Method clientImpl.BlacklistAddress has 5 return statements (exceeds 4 allowed).
                                Open

                                func (c clientImpl) BlacklistAddress(ctx context.Context, appsecret string, appid string, body BlackListBody) (string, error) {
                                    var blacklistRes blacklistResponse
                                
                                    nonce := strings.ReplaceAll(uuid.New().String(), "-", "")[:32]
                                    timestamp := fmt.Sprintf("%d", time.Now().Unix())
                                Severity: Major
                                Found in contrib/screener-api/client/client.go - About 35 mins to fix

                                  Function GenerateABIFromEtherscan has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func GenerateABIFromEtherscan(ctx context.Context, chainID uint32, url string, contractAddress common.Address, fileName, solVersion, pkgName string) error {
                                      client, err := etherscan.NewEtherscanAbiGenClientFromChain(ctx, chainID, url)
                                      if err != nil {
                                          return fmt.Errorf("could not etherscan client for chain %d", chainID)
                                      }
                                  Severity: Major
                                  Found in tools/abigen/internal/generate.go - About 35 mins to fix

                                    Function copyGoFile has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func copyGoFile(filePath, packageName, dest string, info fs.FileInfo) error {
                                        fileContents, err := getUpdatedFileContents(filePath, packageName)
                                        if err != nil {
                                            return fmt.Errorf("could not get updated file contents: %w", err)
                                        }
                                    Severity: Major
                                    Found in tools/modulecopier/internal/copy.go - About 35 mins to fix

                                      Method txSubmitterImpl.chainPendingQueue has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (t *txSubmitterImpl) chainPendingQueue(parentCtx context.Context, chainID *big.Int, txes []db.TX) (err error) {
                                          ctx, span := t.metrics.Tracer().Start(parentCtx, "submitter.ChainQueue", trace.WithAttributes(
                                              attribute.String("chain_id", chainID.String()),
                                          ))
                                          defer func() {
                                      Severity: Major
                                      Found in ethergo/submitter/chain_queue.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language