status-im/status-go

View on GitHub

Showing 512 of 512 total issues

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

func defaultSettings(generatedAccountInfo generator.GeneratedAccountInfo, derivedAddresses map[string]generator.AccountInfo, mnemonic *string) (*settings.Settings, error) {
    chatKeyString := derivedAddresses[pathDefaultChat].PublicKey

    defaultSettings := &settings.Settings{}
    defaultSettings.KeyUID = generatedAccountInfo.KeyUID
Severity: Major
Found in cmd/populate-db/main.go and 2 other locations - About 7 hrs to fix
cmd/ping-community/main.go on lines 282..340
cmd/spiff-workflow/main.go on lines 229..287

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

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

HopL2OptimismBridgeSession has 53 methods (exceeds 21 allowed). Consider refactoring.
Open

type HopL2OptimismBridgeSession struct {
    Contract     *HopL2OptimismBridge // Generic contract binding to set the session for
    CallOpts     bind.CallOpts        // Call options to use throughout this session
    TransactOpts bind.TransactOpts    // Transaction auth options to use throughout this session
}
Severity: Major
Found in contracts/hop/l2Contracts/l2OptimismBridge/l2OptimismBridge.go - About 7 hrs to fix

    File messenger_handlers.go has 1120 lines of code (exceeds 900 allowed). Consider refactoring.
    Open

    //nolint
    // Code generated by generate_handlers.go. DO NOT EDIT.
    // source: generate_handlers.go
    
    package protocol
    Severity: Major
    Found in protocol/messenger_handlers.go - About 7 hrs to fix

      File sync_device_test.go has 1116 lines of code (exceeds 900 allowed). Consider refactoring.
      Open

      package pairing
      
      import (
          "context"
          "encoding/json"
      Severity: Major
      Found in server/pairing/sync_device_test.go - About 7 hrs to fix

        ClientWithFallback has 52 methods (exceeds 21 allowed). Consider refactoring.
        Open

        type ClientWithFallback struct {
            ChainID         uint64
            main            *ethclient.Client
            fallback        *ethclient.Client
            mainLimiter     *RPCRpsLimiter
        Severity: Major
        Found in rpc/chain/client.go - About 7 hrs to fix

          sqlitePersistence has 52 methods (exceeds 21 allowed). Consider refactoring.
          Open

          func (db sqlitePersistence) saveProfileShowcasePreferencesClock(tx *sql.Tx, clock uint64) error {
              _, err := tx.Exec(upsertProfileShowcasePreferencesQuery, clock, clock)
              return err
          }
          Severity: Major
          Found in protocol/persistence_profile_showcase.go - About 7 hrs to fix

            HopL2ArbitrumBridgeSession has 51 methods (exceeds 21 allowed). Consider refactoring.
            Open

            type HopL2ArbitrumBridgeSession struct {
                Contract     *HopL2ArbitrumBridge // Generic contract binding to set the session for
                CallOpts     bind.CallOpts        // Call options to use throughout this session
                TransactOpts bind.TransactOpts    // Transaction auth options to use throughout this session
            }
            Severity: Major
            Found in contracts/hop/l2Contracts/l2ArbitrumBridge/l2ArbitrumBridge.go - About 7 hrs to fix

              File messenger_mention.go has 1102 lines of code (exceeds 900 allowed). Consider refactoring.
              Open

              package protocol
              
              // this is a reimplementation of the mention feature in status-react
              // reference implementation: https://github.com/status-im/status-react/blob/972347963498fc4a2bb8f85541e79ed0541698da/src/status_im/chat/models/mentions.cljs#L1
              import (
              Severity: Major
              Found in protocol/messenger_mention.go - About 6 hrs to fix

                HopL1HopBridgeSession has 49 methods (exceeds 21 allowed). Consider refactoring.
                Open

                type HopL1HopBridgeSession struct {
                    Contract     *HopL1HopBridge   // Generic contract binding to set the session for
                    CallOpts     bind.CallOpts     // Call options to use throughout this session
                    TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
                }
                Severity: Minor
                Found in contracts/hop/l1Contracts/l1HopBridge/l1HopBridge.go - About 6 hrs to fix

                  Database has 49 methods (exceeds 21 allowed). Consider refactoring.
                  Open

                  type Database struct {
                      settings.DatabaseSettingsManager
                      *notificationssettings.NotificationsSettings
                      *walletsettings.WalletSettings
                      db *sql.DB
                  Severity: Minor
                  Found in multiaccounts/accounts/database.go - About 6 hrs to fix

                    StatusNode has 49 methods (exceeds 21 allowed). Consider refactoring.
                    Open

                    func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server.MediaServer) error {
                        accountsFeed := &event.Feed{}
                        settingsFeed := &event.Feed{}
                        accDB, err := accounts.NewDB(b.appDB)
                        if err != nil {
                    Severity: Minor
                    Found in node/status_node_services.go - About 6 hrs to fix

                      File handlers.go has 1082 lines of code (exceeds 900 allowed). Consider refactoring.
                      Open

                      package server
                      
                      import (
                          "bytes"
                          "database/sql"
                      Severity: Major
                      Found in server/handlers.go - About 6 hrs to fix

                        File commands_sequential.go has 1076 lines of code (exceeds 900 allowed). Consider refactoring.
                        Open

                        package transfer
                        
                        import (
                            "context"
                            "math/big"
                        Severity: Major
                        Found in services/wallet/transfer/commands_sequential.go - About 6 hrs to fix

                          HopL1Erc20BridgeSession has 46 methods (exceeds 21 allowed). Consider refactoring.
                          Open

                          type HopL1Erc20BridgeSession struct {
                              Contract     *HopL1Erc20Bridge // Generic contract binding to set the session for
                              CallOpts     bind.CallOpts     // Call options to use throughout this session
                              TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
                          }
                          Severity: Minor
                          Found in contracts/hop/l1Contracts/l1Erc20Bridge/l1Erc20Bridge.go - About 6 hrs to fix

                            gethWakuV2Wrapper has 46 methods (exceeds 21 allowed). Consider refactoring.
                            Open

                            type gethWakuV2Wrapper struct {
                                waku *wakuv2.Waku
                            }
                            Severity: Minor
                            Found in eth-node/bridge/geth/wakuv2.go - About 6 hrs to fix

                              GethWakuWrapper has 46 methods (exceeds 21 allowed). Consider refactoring.
                              Open

                              type GethWakuWrapper struct {
                                  waku *waku.Waku
                              }
                              Severity: Minor
                              Found in eth-node/bridge/geth/waku.go - About 6 hrs to fix

                                HopL1EthBridgeSession has 45 methods (exceeds 21 allowed). Consider refactoring.
                                Open

                                type HopL1EthBridgeSession struct {
                                    Contract     *HopL1EthBridge   // Generic contract binding to set the session for
                                    CallOpts     bind.CallOpts     // Call options to use throughout this session
                                    TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
                                }
                                Severity: Minor
                                Found in contracts/hop/l1Contracts/l1EthBridge/l1EthBridge.go - About 6 hrs to fix

                                  TestClient has 45 methods (exceeds 21 allowed). Consider refactoring.
                                  Open

                                  type TestClient struct {
                                      t *testing.T
                                      // [][block, newBalance, nonceDiff]
                                      balances                       map[common.Address][][]int
                                      outgoingERC20Transfers         map[common.Address][]testERC20Transfer
                                  Severity: Minor
                                  Found in services/wallet/transfer/commands_sequential_test.go - About 6 hrs to fix

                                    File messenger_contacts.go has 1065 lines of code (exceeds 900 allowed). Consider refactoring.
                                    Open

                                    package protocol
                                    
                                    import (
                                        "context"
                                        "crypto/ecdsa"
                                    Severity: Major
                                    Found in protocol/messenger_contacts.go - About 5 hrs to fix

                                      MessengerSuite has 44 methods (exceeds 21 allowed). Consider refactoring.
                                      Open

                                      type MessengerSuite struct {
                                          MessengerBaseTestSuite
                                      }
                                      Severity: Minor
                                      Found in protocol/messenger_test.go - About 5 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language