status-im/status-go

View on GitHub

Showing 512 of 512 total issues

File status.go has 1030 lines of code (exceeds 900 allowed). Consider refactoring.
Open

package statusgo

import (
    "encoding/hex"
    "encoding/json"
Severity: Major
Found in mobile/status.go - About 5 hrs to fix

    Manager has 39 methods (exceeds 21 allowed). Consider refactoring.
    Open

    type Manager struct {
        db                   *sql.DB
        RPCClient            *rpc.Client
        ContractMaker        *contracts.ContractMaker
        networkManager       *network.Manager
    Severity: Minor
    Found in services/wallet/token/token.go - About 5 hrs to fix

      OwnerWithoutCommunityKeyCommunityEventsSuite has 37 methods (exceeds 21 allowed). Consider refactoring.
      Open

      type OwnerWithoutCommunityKeyCommunityEventsSuite struct {
          suite.Suite
          controlNode              *Messenger
          ownerWithoutCommunityKey *Messenger
          alice                    *Messenger
      Severity: Minor
      Found in protocol/communities_events_owner_without_community_key_test.go - About 4 hrs to fix

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

        type StatusNode struct {
            mu sync.RWMutex
        
            appDB           *sql.DB
            multiaccountsDB *multiaccounts.Database
        Severity: Minor
        Found in node/get_status_node.go - About 4 hrs to fix

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

          func (db sqlitePersistence) DeleteActivityCenterNotificationByID(id []byte, updatedAt uint64) error {
              _, err := db.db.Exec(`UPDATE activity_center_notifications SET deleted = 1, updated_at = ? WHERE id = ? AND NOT deleted`, updatedAt, id)
              return err
          }
          Severity: Minor
          Found in protocol/activity_center_persistence.go - About 4 hrs to fix

            MessengerStoreNodeRequestSuite has 37 methods (exceeds 21 allowed). Consider refactoring.
            Open

            type MessengerStoreNodeRequestSuite struct {
                suite.Suite
            
                cancel chan struct{}
            
            
            Severity: Minor
            Found in protocol/messenger_storenode_request_test.go - About 4 hrs to fix

              MessageSender has 37 methods (exceeds 21 allowed). Consider refactoring.
              Open

              type MessageSender struct {
                  identity    *ecdsa.PrivateKey
                  datasync    *datasync.DataSync
                  database    *sql.DB
                  protocol    *encryption.Protocol
              Severity: Minor
              Found in protocol/common/message_sender.go - About 4 hrs to fix

                File message_sender.go has 1006 lines of code (exceeds 900 allowed). Consider refactoring.
                Open

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

                  PublicResolverFilterer has 36 methods (exceeds 21 allowed). Consider refactoring.
                  Open

                  type PublicResolverFilterer struct {
                      contract *bind.BoundContract // Generic contract wrapper for the low level calls
                  }
                  Severity: Minor
                  Found in contracts/resolver/resolver.go - About 4 hrs to fix

                    HopL2ArbitrumBridgeFilterer has 36 methods (exceeds 21 allowed). Consider refactoring.
                    Open

                    type HopL2ArbitrumBridgeFilterer struct {
                        contract *bind.BoundContract // Generic contract wrapper for the low level calls
                    }
                    Severity: Minor
                    Found in contracts/hop/l2Contracts/l2ArbitrumBridge/l2ArbitrumBridge.go - About 4 hrs to fix

                      HopL2OptimismBridgeFilterer has 36 methods (exceeds 21 allowed). Consider refactoring.
                      Open

                      type HopL2OptimismBridgeFilterer struct {
                          contract *bind.BoundContract // Generic contract wrapper for the low level calls
                      }
                      Severity: Minor
                      Found in contracts/hop/l2Contracts/l2OptimismBridge/l2OptimismBridge.go - About 4 hrs to fix

                        ManagerSuite has 36 methods (exceeds 21 allowed). Consider refactoring.
                        Open

                        type ManagerSuite struct {
                            suite.Suite
                            manager        *Manager
                            archiveManager *ArchiveManager
                        }
                        Severity: Minor
                        Found in protocol/communities/manager_test.go - About 4 hrs to fix

                          Messenger has 36 methods (exceeds 21 allowed). Consider refactoring.
                          Open

                          func (m *Messenger) ActivityCenterNotifications(request ActivityCenterNotificationsRequest) (*ActivityCenterPaginationResponse, error) {
                              cursor, notifications, err := m.persistence.ActivityCenterNotifications(request.Cursor, request.Limit, request.ActivityTypes, request.ReadType, true)
                              if err != nil {
                                  return nil, err
                              }
                          Severity: Minor
                          Found in protocol/messenger_activity_center.go - About 4 hrs to fix

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

                                communityItem := struct {
                                    ID                          types.HexBytes                       `json:"id"`
                                    MemberRole                  protobuf.CommunityMember_Roles       `json:"memberRole"`
                                    IsControlNode               bool                                 `json:"isControlNode"`
                                    Verified                    bool                                 `json:"verified"`
                            Severity: Major
                            Found in protocol/communities/community.go and 1 other location - About 4 hrs to fix
                            protocol/communities/community.go on lines 419..483

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

                            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

                                communityItem := struct {
                                    ID                          types.HexBytes                       `json:"id"`
                                    MemberRole                  protobuf.CommunityMember_Roles       `json:"memberRole"`
                                    IsControlNode               bool                                 `json:"isControlNode"`
                                    Verified                    bool                                 `json:"verified"`
                            Severity: Major
                            Found in protocol/communities/community.go and 1 other location - About 4 hrs to fix
                            protocol/communities/community.go on lines 267..331

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

                            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

                            SettingsAPI has 34 methods (exceeds 21 allowed). Consider refactoring.
                            Open

                            type SettingsAPI struct {
                                messenger **protocol.Messenger
                                db        *accounts.Database
                                config    *params.NodeConfig
                            }
                            Severity: Minor
                            Found in services/accounts/settings.go - About 4 hrs to fix

                              MessengerContactRequestSuite has 34 methods (exceeds 21 allowed). Consider refactoring.
                              Open

                              type MessengerContactRequestSuite struct {
                                  MessengerBaseTestSuite
                              }
                              Severity: Minor
                              Found in protocol/messenger_contact_requests_test.go - About 4 hrs to fix

                                AdminCommunityEventsSuite has 34 methods (exceeds 21 allowed). Consider refactoring.
                                Open

                                type AdminCommunityEventsSuite struct {
                                    AdminCommunityEventsSuiteBase
                                }
                                Severity: Minor
                                Found in protocol/communities_messenger_admin_test.go - About 4 hrs to fix

                                  Messenger has 34 methods (exceeds 21 allowed). Consider refactoring.
                                  Open

                                  func (m *Messenger) fetchCollectibleOwner(contractAddress string, tokenID string, chainID uint64) ([]thirdparty.AccountBalance, error) {
                                      collectibleID, err := toCollectibleUniqueID(contractAddress, tokenID, chainID)
                                      if err != nil {
                                          return nil, err
                                      }
                                  Severity: Minor
                                  Found in protocol/messenger_profile_showcase.go - About 4 hrs to fix

                                    File messenger_mention_test.go has 990 lines of code (exceeds 900 allowed). Consider refactoring.
                                    Open

                                    package protocol
                                    
                                    import (
                                        "fmt"
                                        "reflect"
                                    Severity: Major
                                    Found in protocol/messenger_mention_test.go - About 4 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language