waku-org/go-waku

View on GitHub

Showing 299 of 400 total issues

Function register has 8 return statements (exceeds 4 allowed).
Open

func register(ctx context.Context, web3Config *web3.Config, idComm rln.IDCommitment) (rln.MembershipIndex, error) {
    // check if the contract exists by calling a static function
    membershipFee, err := getMembershipFee(ctx, web3Config.RLNContract)
    if err != nil {
        return 0, err
Severity: Major
Found in cmd/waku/rlngenerate/web3.go - About 50 mins to fix

    Method WakuFilterLightNode.IncorrectSubscribe has 8 return statements (exceeds 4 allowed).
    Open

    func (wf *WakuFilterLightNode) IncorrectSubscribe(ctx context.Context, contentFilter protocol.ContentFilter, opts ...FilterSubscribeOption) ([]*subscription.SubscriptionDetails, error) {
        wf.RLock()
        defer wf.RUnlock()
        if err := wf.ErrOnNotRunning(); err != nil {
            return nil, err
    Severity: Major
    Found in waku/v2/protocol/filter/filter_proto_ident_test.go - About 50 mins to fix

      Method WakuFilterLightNode.request has 8 return statements (exceeds 4 allowed).
      Open

      func (wf *WakuFilterLightNode) request(ctx context.Context, requestID []byte,
          reqType pb.FilterSubscribeRequest_FilterSubscribeType, contentFilter protocol.ContentFilter, peerID peer.ID) error {
          request := &pb.FilterSubscribeRequest{
              RequestId:           hex.EncodeToString(requestID),
              FilterSubscribeType: reqType,
      Severity: Major
      Found in waku/v2/protocol/filter/client.go - About 50 mins to fix

        Method WakuPeerExchange.Request has 8 return statements (exceeds 4 allowed).
        Open

        func (wakuPX *WakuPeerExchange) Request(ctx context.Context, numPeers int, opts ...RequestOption) error {
            params := new(PeerExchangeRequestParameters)
            params.host = wakuPX.h
            params.log = wakuPX.log
            params.pm = wakuPX.pm
        Severity: Major
        Found in waku/v2/protocol/peer_exchange/client.go - About 50 mins to fix

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

          func NewDiscoveryV5(priv *ecdsa.PrivateKey, localnode *enode.LocalNode, peerConnector PeerConnector, reg prometheus.Registerer, log *zap.Logger, opts ...DiscoveryV5Option) (*DiscoveryV5, error) {
          Severity: Minor
          Found in waku/v2/discv5/discover.go - About 45 mins to fix

            Method HistoryRetriever.Query has 7 return statements (exceeds 4 allowed).
            Open

            func (hr *HistoryRetriever) Query(
                ctx context.Context,
                criteria store.FilterCriteria,
                storenodeID peer.ID,
                pageLimit uint64,
            Severity: Major
            Found in waku/v2/api/history/history.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if err != nil {
                                              c.ui.ErrorMessage(err)
                                              return
                                          }
              Severity: Major
              Found in examples/chat2/chat.go - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if err != nil {
                                                c.ui.ErrorMessage(err)
                                                return
                                            }
                Severity: Major
                Found in examples/chat2-reliable/chat.go - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  if err := pm.metadata.DisconnectPeerOnShardMismatch(ctx, peerEvt.PeerID); err != nil {
                                      return
                                  }
                  Severity: Major
                  Found in waku/v2/peermanager/topic_event_handler.go - About 45 mins to fix

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

                    func NewPeerManager(maxConnections int, maxPeers int, metadata *metadata.WakuMetadata, relay *relay.WakuRelay, relayEnabled bool, logger *zap.Logger) *PeerManager {
                    Severity: Minor
                    Found in waku/v2/peermanager/peer_manager.go - About 45 mins to fix

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

                      func computeOffset(timeQuery ntpQuery, servers []string, allowedFailures int) (time.Duration, error) {
                          if len(servers) == 0 {
                              return 0, nil
                          }
                          responses := make(chan queryResponse, len(servers))
                      Severity: Major
                      Found in waku/v2/timesource/ntp.go - About 45 mins to fix

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

                        func execute(options Options) {
                            var err error
                            hostAddr, _ := net.ResolveTCPAddr("tcp", fmt.Sprintf("0.0.0.0:%d", options.Port))
                        
                            if options.NodeKey == nil {
                        Severity: Major
                        Found in examples/chat2/exec.go - About 45 mins to fix

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

                          func NewLocalnode(priv *ecdsa.PrivateKey, ipAddr *net.TCPAddr, udpPort int, wakuFlags wenr.WakuEnrBitfield, advertiseAddr *net.IP, log *zap.Logger) (*enode.LocalNode, error) {
                          Severity: Minor
                          Found in tests/utils.go - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if prevNodeVal == "" {
                                                    w.log.Info("local node enr record", logging.ENode("enr", w.localNode.Node()))
                                                } else {
                                                    w.log.Info("local node new enr record", logging.ENode("enr", w.localNode.Node()))
                                                }
                            Severity: Major
                            Found in waku/v2/node/wakunode2.go - About 45 mins to fix

                              Method StaticShardingPubsubTopic.Parse has 7 return statements (exceeds 4 allowed).
                              Open

                              func (s *StaticShardingPubsubTopic) Parse(topic string) error {
                                  if !strings.HasPrefix(topic, StaticShardingPubsubTopicPrefix) {
                                      return ErrInvalidShardedTopicPrefix
                                  }
                              
                              
                              Severity: Major
                              Found in waku/v2/protocol/pubsub_topic.go - About 45 mins to fix

                                Method HistoryRetriever.Query has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    ctx context.Context,
                                    criteria store.FilterCriteria,
                                    storenodeID peer.ID,
                                    pageLimit uint64,
                                    shouldProcessNextPage func(int) (bool, uint64),
                                Severity: Minor
                                Found in waku/v2/api/history/history.go - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if peerLen > len(relayPeers) {
                                                          peerLen = len(relayPeers)
                                                      }
                                  Severity: Major
                                  Found in waku/v2/node/keepalive.go - About 45 mins to fix

                                    Method HistoryRetriever.requestStoreMessages has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    func (hr *HistoryRetriever) requestStoreMessages(ctx context.Context, peerID peer.ID, criteria store.FilterCriteria, cursor []byte, limit uint64, processEnvelopes bool) ([]byte, int, error) {
                                    Severity: Minor
                                    Found in waku/v2/api/history/history.go - About 45 mins to fix

                                      Method WakuNode.AddDiscoveredPeer has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      func (w *WakuNode) AddDiscoveredPeer(ID peer.ID, addrs []ma.Multiaddr, origin wps.Origin, pubsubTopics []string, enr *enode.Node, connectNow bool) {
                                      Severity: Minor
                                      Found in waku/v2/node/wakunode2.go - About 45 mins to fix

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

                                        func NewFilterManager(ctx context.Context, logger *zap.Logger, minPeersPerFilter int, envProcessor EnevelopeProcessor, node *filter.WakuFilterLightNode, opts ...SubscribeOptions) *FilterManager {
                                        Severity: Minor
                                        Found in waku/v2/api/filter/filter_manager.go - About 45 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language