waku-org/go-waku

View on GitHub

Showing 400 of 400 total issues

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

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

      func buildTransactor(ctx context.Context, membershipFee *big.Int, chainID *big.Int) (*bind.TransactOpts, error) {
          auth, err := bind.NewKeyedTransactorWithChainID(options.ETHPrivateKey, chainID)
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in cmd/waku/rlngenerate/web3.go - About 40 mins to fix

        Method WakuLightPush.request has 6 return statements (exceeds 4 allowed).
        Open

        func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, params *lightPushRequestParameters, peerID peer.ID) (*pb.PushResponse, error) {
        
            logger := wakuLP.log.With(logging.HostID("peer", peerID))
        
            stream, err := wakuLP.h.NewStream(ctx, peerID, LightPushID_v20beta1)
        Severity: Major
        Found in waku/v2/protocol/lightpush/waku_lightpush.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

            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

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

                  for _, m := range messages {
                      s.subDetails = append(s.subDetails, s.getSub(m.PubSubTopic, m.ContentTopic, s.FullNodeHost.ID())...)
                      _, err = s.relayNode.Subscribe(context.Background(), protocol.NewContentFilter(m.PubSubTopic))
                      s.Require().NoError(err)
                  }
              Severity: Minor
              Found in waku/v2/protocol/filter/filter_unsubscribe_test.go and 1 other location - About 40 mins to fix
              waku/v2/protocol/filter/filter_unsubscribe_test.go on lines 90..94

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

              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

                  for _, m := range messages {
                      s.subDetails = append(s.subDetails, s.getSub(m.PubSubTopic, m.ContentTopic, s.FullNodeHost.ID())...)
                      _, err = s.relayNode.Subscribe(context.Background(), protocol.NewContentFilter(m.PubSubTopic))
                      s.Require().NoError(err)
                  }
              Severity: Minor
              Found in waku/v2/protocol/filter/filter_unsubscribe_test.go and 1 other location - About 40 mins to fix
              waku/v2/protocol/filter/filter_unsubscribe_test.go on lines 221..225

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

              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

              type UI struct {
                  ready bool
                  err   error
              
                  quitChan  chan struct{}
              Severity: Minor
              Found in examples/chat2/ui.go and 1 other location - About 40 mins to fix
              examples/chat2-reliable/ui.go on lines 56..77

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

              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

              type UI struct {
                  ready bool
                  err   error
              
                  quitChan  chan struct{}
              Severity: Minor
              Found in examples/chat2-reliable/ui.go and 1 other location - About 40 mins to fix
              examples/chat2/ui.go on lines 56..77

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

              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

              Method PeerManager.DiscoverAndConnectToPeers has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func (pm *PeerManager) DiscoverAndConnectToPeers(ctx context.Context, cluster uint16,
                  shard uint16, serviceProtocol protocol.ID, maxCount int) error {
              Severity: Minor
              Found in waku/v2/peermanager/peer_discovery.go - About 35 mins to fix

                Method PeerManager.addPeer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func (pm *PeerManager) addPeer(ID peer.ID, addrs []ma.Multiaddr, origin wps.Origin, pubSubTopics []string, protocols ...protocol.ID) error {
                Severity: Minor
                Found in waku/v2/peermanager/peer_manager.go - About 35 mins to fix

                  Function createHostWithDiscv5AndPM has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func createHostWithDiscv5AndPM(t *testing.T, hostName string, topic string, enrField uint8, bootnode ...*enode.Node) (host.Host, *PeerManager, *discv5.DiscoveryV5) {
                  Severity: Minor
                  Found in waku/v2/peermanager/peer_manager_test.go - About 35 mins to fix

                    Method PeerManager.discoverOnDemand has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func (pm *PeerManager) discoverOnDemand(cluster uint16,
                        shard uint16, wakuProtocol protocol.ID, ctx context.Context, maxCount int) ([]service.PeerData, error) {
                    Severity: Minor
                    Found in waku/v2/peermanager/peer_discovery.go - About 35 mins to fix

                      Function WaitForTimeout has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func WaitForTimeout(t *testing.T, ctx context.Context, timeout time.Duration, wg *sync.WaitGroup, ch chan *protocol.Envelope) {
                      Severity: Minor
                      Found in tests/utils.go - About 35 mins to fix

                        Function NewMissingMessageVerifier has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func NewMissingMessageVerifier(storenodeRequester common.StorenodeRequestor, messageTracker MessageTracker, timesource timesource.Timesource, logger *zap.Logger, options ...MissingMessageVerifierOption) *MissingMessageVerifier {
                        Severity: Minor
                        Found in waku/v2/api/missing/missing_messages.go - About 35 mins to fix

                          Method defaultStorenodeMessageVerifier.MessageHashesExist has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          func (d *defaultStorenodeMessageVerifier) MessageHashesExist(ctx context.Context, requestID []byte, peerID peer.ID, pageSize uint64, messageHashes []pb.MessageHash) ([]pb.MessageHash, error) {
                          Severity: Minor
                          Found in waku/v2/api/publish/default_verifier.go - About 35 mins to fix

                            Method MissingMessageVerifier.fetchMessagesBatch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            func (m *MissingMessageVerifier) fetchMessagesBatch(c chan<- *protocol.Envelope, interest criteriaInterest, batchFrom int, batchTo int, now time.Time) error {
                            Severity: Minor
                            Found in waku/v2/api/missing/missing_messages.go - About 35 mins to fix

                              Function NewConnectionNotifier has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func NewConnectionNotifier(ctx context.Context, h host.Host, connNotifCh chan<- PeerConnection, metrics Metrics, log *zap.Logger) ConnectionNotifier {
                              Severity: Minor
                              Found in waku/v2/node/connectedness.go - About 35 mins to fix

                                Method Rendezvous.DiscoverShard has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                func (r *Rendezvous) DiscoverShard(ctx context.Context, rp *RendezvousPoint, cluster uint16, shard uint16, numPeers int) {
                                Severity: Minor
                                Found in waku/v2/rendezvous/rendezvous.go - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language