status-im/status-go

View on GitHub

Showing 519 of 519 total issues

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

func NewPeer(host common.WakuHost, p2pPeer *p2p.Peer, rw p2p.MsgReadWriter, logger *zap.Logger, stats *common.StatsTracker) common.Peer {
    if logger == nil {
        logger = zap.NewNop()
    }

Severity: Major
Found in waku/v1/peer.go and 1 other location - About 1 hr to fix
waku/v0/peer.go on lines 62..80

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

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

    config params.NodeConfig,
    identity *ecdsa.PrivateKey,
    appDb *sql.DB,
    walletDb *sql.DB,
    httpServer *server.MediaServer,
Severity: Major
Found in services/ext/service.go - About 1 hr to fix

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

        err = tt.RetryWithBackOff(func() error {
            _, err = server.RetrieveAll()
            if err != nil {
                return err
            }
    Severity: Major
    Found in protocol/push_notification_test.go and 1 other location - About 1 hr to fix
    protocol/push_notification_test.go on lines 1073..1097

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

    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

        err = tt.RetryWithBackOff(func() error {
            _, err = server.RetrieveAll()
            if err != nil {
                return err
            }
    Severity: Major
    Found in protocol/push_notification_test.go and 1 other location - About 1 hr to fix
    protocol/push_notification_test.go on lines 197..221

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

    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

        err = tt.RetryWithBackOff(func() error {
            response, err = bobRetrieveAll()
            if err != nil {
                return err
            }
    Severity: Major
    Found in protocol/communities_messenger_test.go and 1 other location - About 1 hr to fix
    protocol/communities_messenger_test.go on lines 1324..1345

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

    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

        err = tt.RetryWithBackOff(func() error {
            response, err = bobRetrieveAll()
            if err != nil {
                return err
            }
    Severity: Major
    Found in protocol/communities_messenger_test.go and 1 other location - About 1 hr to fix
    protocol/communities_messenger_test.go on lines 1109..1130

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

    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 4 locations. Consider refactoring.
    Open

    func printVersion(config *params.NodeConfig) {
        fmt.Println(strings.Title(config.Name))
        fmt.Println("Version:", config.Version)
        fmt.Println("Network ID:", config.NetworkID)
        fmt.Println("Go Version:", runtime.Version())
    Severity: Major
    Found in cmd/populate-db/main.go and 3 other locations - About 1 hr to fix
    cmd/ping-community/main.go on lines 252..262
    cmd/spiff-workflow/main.go on lines 195..205
    cmd/statusd/main.go on lines 423..433

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

    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 4 locations. Consider refactoring.
    Open

    func printVersion(config *params.NodeConfig) {
        fmt.Println(strings.Title(config.Name))
        fmt.Println("Version:", config.Version)
        fmt.Println("Network ID:", config.NetworkID)
        fmt.Println("Go Version:", runtime.Version())
    Severity: Major
    Found in cmd/ping-community/main.go and 3 other locations - About 1 hr to fix
    cmd/populate-db/main.go on lines 296..306
    cmd/spiff-workflow/main.go on lines 195..205
    cmd/statusd/main.go on lines 423..433

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

    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 4 locations. Consider refactoring.
    Open

    func printVersion(config *params.NodeConfig) {
        fmt.Println(strings.Title(config.Name))
        fmt.Println("Version:", config.Version)
        fmt.Println("Network ID:", config.NetworkID)
        fmt.Println("Go Version:", runtime.Version())
    Severity: Major
    Found in cmd/spiff-workflow/main.go and 3 other locations - About 1 hr to fix
    cmd/ping-community/main.go on lines 252..262
    cmd/populate-db/main.go on lines 296..306
    cmd/statusd/main.go on lines 423..433

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

    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 4 locations. Consider refactoring.
    Open

    func printVersion(config *params.NodeConfig) {
        fmt.Println(strings.Title(config.Name))
        fmt.Println("Version:", config.Version)
        fmt.Println("Network ID:", config.NetworkID)
        fmt.Println("Go Version:", runtime.Version())
    Severity: Major
    Found in cmd/statusd/main.go and 3 other locations - About 1 hr to fix
    cmd/ping-community/main.go on lines 252..262
    cmd/populate-db/main.go on lines 296..306
    cmd/spiff-workflow/main.go on lines 195..205

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

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

        db *sql.DB,
        accountsDB *accounts.Database,
        appDB *sql.DB,
        rpcClient *rpc.Client,
        accountFeed *event.Feed,
    Severity: Major
    Found in services/wallet/service.go - About 1 hr to fix

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

      func setupTestMultiDB() (*multiaccounts.Database, func() error, error) {
          tmpfile, err := ioutil.TempFile("", "tests")
          if err != nil {
              return nil, nil, err
          }
      Severity: Major
      Found in api/backend_test.go and 1 other location - About 1 hr to fix
      node/status_node_rpc_client_test.go on lines 50..66

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

      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

      func setupTestMultiDB() (*multiaccounts.Database, func() error, error) {
          tmpfile, err := ioutil.TempFile("", "tests")
          if err != nil {
              return nil, nil, err
          }
      Severity: Major
      Found in node/status_node_rpc_client_test.go and 1 other location - About 1 hr to fix
      api/backend_test.go on lines 75..91

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

      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

          iter, err := db.BuildIterator(CursorQuery{
              start:  NewDBKey(uint32(time.Now().Add(-time.Hour).Unix()), types.BytesToTopic(topic), types.Hash{}).Bytes(),
              end:    NewDBKey(uint32(time.Now().Add(time.Second).Unix()), types.BytesToTopic(topic), types.Hash{}).Bytes(),
              topics: [][]byte{topic},
              limit:  10,
      Severity: Major
      Found in mailserver/mailserver_db_postgres_test.go and 1 other location - About 1 hr to fix
      mailserver/mailserver_db_leveldb_test.go on lines 25..30

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

      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

      func (p *Peer) expire() {
          unmark := make(map[gethcommon.Hash]struct{})
          p.known.Each(func(v interface{}) bool {
              if !p.host.IsEnvelopeCached(v.(gethcommon.Hash)) {
                  unmark[v.(gethcommon.Hash)] = struct{}{}
      Severity: Major
      Found in waku/v1/peer.go and 1 other location - About 1 hr to fix
      waku/v0/peer.go on lines 519..531

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

      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

          iter, err := db.BuildIterator(CursorQuery{
              start:  NewDBKey(uint32(time.Now().Add(-time.Hour).Unix()), types.BytesToTopic(topic), types.Hash{}).Bytes(),
              end:    NewDBKey(uint32(time.Now().Add(time.Second).Unix()), types.BytesToTopic(topic), types.Hash{}).Bytes(),
              topics: [][]byte{topic},
              limit:  10,
      Severity: Major
      Found in mailserver/mailserver_db_leveldb_test.go and 1 other location - About 1 hr to fix
      mailserver/mailserver_db_postgres_test.go on lines 84..89

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

      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

      func (p *Peer) expire() {
          unmark := make(map[gethcommon.Hash]struct{})
          p.known.Each(func(v interface{}) bool {
              if !p.host.IsEnvelopeCached(v.(gethcommon.Hash)) {
                  unmark[v.(gethcommon.Hash)] = struct{}{}
      Severity: Major
      Found in waku/v0/peer.go and 1 other location - About 1 hr to fix
      waku/v1/peer.go on lines 560..572

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

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

      func newLoadBlocksAndTransfersCommand(accounts []common.Address, db *Database, accountsDB *accounts.Database,
          blockDAO *BlockDAO, blockRangesSeqDAO BlockRangeDAOer, chainClient chain.ClientInterface, feed *event.Feed,
          transactionManager *TransactionManager, pendingTxManager *transactions.PendingTxTracker,
          tokenManager *token.Manager, balanceCacher balance.Cacher, omitHistory bool,
          blockChainState *blockchainstate.BlockChainState) *loadBlocksAndTransfersCommand {
      Severity: Major
      Found in services/wallet/transfer/commands_sequential.go - About 1 hr to fix

        Function NewSequentialFetchStrategy has 13 arguments (exceeds 6 allowed). Consider refactoring.
        Open

        func NewSequentialFetchStrategy(db *Database, blockDAO *BlockDAO, blockRangesSeqDAO *BlockRangeSequentialDAO, accountsDB *accounts.Database, feed *event.Feed,
            transactionManager *TransactionManager, pendingTxManager *transactions.PendingTxTracker,
            tokenManager *token.Manager,
            chainClients map[uint64]chain.ClientInterface,
            accounts []common.Address,
        Severity: Major
        Found in services/wallet/transfer/sequential_fetch_strategy.go - About 1 hr to fix

          Method HopL2OptimismBridgeTransactor.Withdraw has 12 arguments (exceeds 6 allowed). Consider refactoring.
          Open

          func (_HopL2OptimismBridge *HopL2OptimismBridgeTransactor) Withdraw(opts *bind.TransactOpts, recipient common.Address, amount *big.Int, transferNonce [32]byte, bonderFee *big.Int, amountOutMin *big.Int, deadline *big.Int, rootHash [32]byte, transferRootTotalAmount *big.Int, transferIdTreeIndex *big.Int, siblings [][32]byte, totalLeaves *big.Int) (*types.Transaction, error) {
          Severity: Major
          Found in contracts/hop/l2Contracts/l2OptimismBridge/l2OptimismBridge.go - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language