waku-org/go-waku

View on GitHub

Showing 300 of 401 total issues

Function waku_store_query has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

func waku_store_query(ctx unsafe.Pointer, queryJSON *C.char, peerID *C.char, ms C.int, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
Severity: Minor
Found in library/c/api_store.go - About 45 mins to fix

    Function FilterUnsubscribe has 7 return statements (exceeds 4 allowed).
    Open

    func FilterUnsubscribe(instance *WakuInstance, filterJSON string, peerID string, ms int) error {
        cf, err := toContentFilter(filterJSON)
        if err != nil {
            return err
        }
    Severity: Major
    Found in library/filter.go - About 45 mins to fix

      Function DecodeAsymmetric has 7 return statements (exceeds 4 allowed).
      Open

      func DecodeAsymmetric(messageJSON string, privateKey string) (string, error) {
          var msg pb.WakuMessage
          err := json.Unmarshal([]byte(messageJSON), &msg)
          if err != nil {
              return "", err
      Severity: Major
      Found in library/encoding.go - About 45 mins to fix

        Function StringToQR has 7 return statements (exceeds 4 allowed).
        Open

        func StringToQR(qrString string) (QR, error) {
            values := strings.Split(qrString, ":")
            if len(values) != 5 {
                return QR{}, errors.New("invalid qr string")
            }
        Severity: Major
        Found in waku/v2/protocol/noise/qr.go - About 45 mins to fix

          Method DynamicGroupManager.loadCredential has 6 return statements (exceeds 4 allowed).
          Open

          func (gm *DynamicGroupManager) loadCredential(ctx context.Context) error {
              if gm.appKeystore == nil {
                  gm.log.Warn("no credentials were loaded. Node will only validate messages, but wont be able to generate proofs and attach them to messages")
                  return nil
              }
          Severity: Major
          Found in waku/v2/protocol/rln/group_manager/dynamic/dynamic.go - About 40 mins to fix

            Function main has 6 return statements (exceeds 4 allowed).
            Open

            func main() {
                // Removing noisy logs
                lvl, err := logging.LevelFromString("error")
                if err != nil {
                    panic(err)
            Severity: Major
            Found in examples/noise/main.go - About 40 mins to fix

              Method AppKeystore.AddMembershipCredentials has 6 return statements (exceeds 4 allowed).
              Open

              func (k *AppKeystore) AddMembershipCredentials(newCredential MembershipCredentials, password string) error {
                  credentials, err := k.GetMembershipCredentials(password, &newCredential.TreeIndex, newCredential.MembershipContractInfo)
                  if err != nil {
                      return err
                  }
              Severity: Major
              Found in waku/v2/protocol/rln/keystore/keystore.go - About 40 mins to fix

                Method DynamicGroupManager.Start has 6 return statements (exceeds 4 allowed).
                Open

                func (gm *DynamicGroupManager) Start(ctx context.Context) error {
                    if gm.cancel != nil {
                        return errors.New("already started")
                    }
                
                
                Severity: Major
                Found in waku/v2/protocol/rln/group_manager/dynamic/dynamic.go - About 40 mins to fix

                  Function Execute has 6 return statements (exceeds 4 allowed).
                  Open

                  func Execute() error {
                  
                      var cTopic, err = protocol.NewContentTopic("basic-relay", "1", "test", "proto")
                      if err != nil {
                          fmt.Println("Invalid contentTopic")
                  Severity: Major
                  Found in examples/basic-relay/main.go - About 40 mins to fix

                    Function Execute has 6 return statements (exceeds 4 allowed).
                    Open

                    func Execute() error {
                    
                        var cTopic, err = protocol.NewContentTopic("basic-light-client", "1", "test", "proto")
                        if err != nil {
                            return errors.New("invalid contentTopic")
                    Severity: Major
                    Found in examples/basic-light-client/main.go - About 40 mins to fix

                      Method WakuStore.queryFrom has 6 return statements (exceeds 4 allowed).
                      Open

                      func (store *WakuStore) queryFrom(ctx context.Context, historyRequest *pb.HistoryRPC, selectedPeer peer.ID) (*pb.HistoryResponse, error) {
                          logger := store.log.With(logging.HostID("peer", selectedPeer))
                          logger.Info("querying message history")
                      
                          stream, err := store.h.NewStream(ctx, selectedPeer, StoreID_v20beta4)
                      Severity: Major
                      Found in waku/v2/protocol/legacy_store/waku_store_client.go - About 40 mins to fix

                        Method WakuFilterLightNode.incorrectSubscribeRequest has 6 return statements (exceeds 4 allowed).
                        Open

                        func (wf *WakuFilterLightNode) incorrectSubscribeRequest(ctx context.Context, params *FilterSubscribeParameters,
                            reqType pb.FilterSubscribeRequest_FilterSubscribeType, contentFilter protocol.ContentFilter) error {
                        
                            const FilterSubscribeID_Incorrect1 = libp2pProtocol.ID("/vac/waku/filter-subscribe/abcd")
                        
                        
                        Severity: Major
                        Found in waku/v2/protocol/filter/filter_proto_ident_test.go - About 40 mins to fix

                          Function validateAndParse has 6 return statements (exceeds 4 allowed).
                          Open

                          func validateAndParse(input []byte) (*DecodedPayload, error) {
                              end := len(input)
                              if end < 1 {
                                  return nil, errors.New("invalid message length")
                              }
                          Severity: Major
                          Found in waku/v2/payload/waku_payload.go - About 40 mins to fix

                            Method WakuStore.Find has 6 return statements (exceeds 4 allowed).
                            Open

                            func (store *WakuStore) Find(ctx context.Context, query Query, cb CriteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error) {
                                if cb == nil {
                                    return nil, errors.New("callback can't be null")
                                }
                            
                            
                            Severity: Major
                            Found in waku/v2/protocol/legacy_store/waku_store_client.go - About 40 mins to fix

                              Function DecodeSymmetric has 6 return statements (exceeds 4 allowed).
                              Open

                              func DecodeSymmetric(messageJSON string, symmetricKey string) (string, error) {
                                  var msg pb.WakuMessage
                                  err := json.Unmarshal([]byte(messageJSON), &msg)
                                  if err != nil {
                                      return "", err
                              Severity: Major
                              Found in library/encoding.go - About 40 mins to fix

                                Method WakuMetadata.Connected has 6 return statements (exceeds 4 allowed).
                                Open

                                func (wakuM *WakuMetadata) Connected(n network.Network, cc network.Conn) {
                                    go func() {
                                        defer utils.LogOnPanic()
                                        wakuM.log.Debug("peer connected", zap.Stringer("peer", cc.RemotePeer()))
                                        // Metadata verification is done only if a clusterID is specified
                                Severity: Major
                                Found in waku/v2/protocol/metadata/waku_metadata.go - About 40 mins to fix

                                  Function execute has 6 return statements (exceeds 4 allowed).
                                  Open

                                  func execute(ctx context.Context) error {
                                      rlnInstance, err := rln.NewRLN()
                                      if err != nil {
                                          return err
                                      }
                                  Severity: Major
                                  Found in cmd/waku/rlngenerate/command_rln.go - About 40 mins to fix

                                    Function StringToContentTopic has 6 return statements (exceeds 4 allowed).
                                    Open

                                    func StringToContentTopic(s string) (ContentTopic, error) {
                                        p := strings.Split(s, "/")
                                        switch len(p) {
                                        case 5:
                                            if len(p[1]) == 0 || len(p[2]) == 0 || len(p[3]) == 0 || len(p[4]) == 0 {
                                    Severity: Major
                                    Found in waku/v2/protocol/content_topic.go - About 40 mins to fix

                                      Function generateSecureRandomData has 6 return statements (exceeds 4 allowed).
                                      Open

                                      func generateSecureRandomData(length int) ([]byte, error) {
                                          x := make([]byte, length)
                                          y := make([]byte, length)
                                          res := make([]byte, length)
                                      
                                      
                                      Severity: Major
                                      Found in waku/v2/payload/waku_payload.go - About 40 mins to fix

                                        Function SetBootnodes has 6 return statements (exceeds 4 allowed).
                                        Open

                                        func SetBootnodes(instance *WakuInstance, bootnodes string) error {
                                            if err := validateInstance(instance, MustBeStarted); err != nil {
                                                return err
                                            }
                                        
                                        
                                        Severity: Major
                                        Found in library/discovery.go - About 40 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language