waku-org/go-waku

View on GitHub
waku/v2/protocol/relay/waku_relay.go

Summary

Maintainability
B
5 hrs
Test Coverage
C
78%

WakuRelay has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

type WakuRelay struct {
    host                host.Host
    relayParams         *relayParameters
    pubsub              *pubsub.PubSub
    params              pubsub.GossipSubParams
Severity: Minor
Found in waku/v2/protocol/relay/waku_relay.go - About 2 hrs to fix

    Method WakuRelay.Publish has 12 return statements (exceeds 4 allowed).
    Open

    func (w *WakuRelay) Publish(ctx context.Context, message *pb.WakuMessage, opts ...PublishOption) (pb.MessageHash, error) {
        // Publish a `WakuMessage` to a PubSub topic.
        if w.pubsub == nil {
            return pb.MessageHash{}, errors.New("PubSub hasn't been set")
        }
    Severity: Major
    Found in waku/v2/protocol/relay/waku_relay.go - About 1 hr to fix

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

      func NewWakuRelay(bcaster Broadcaster, minPeersToPublish int, timesource timesource.Timesource,
          reg prometheus.Registerer, log *zap.Logger, opts ...RelayOption) *WakuRelay {
      Severity: Minor
      Found in waku/v2/protocol/relay/waku_relay.go - About 45 mins to fix

        Method WakuRelay.upsertTopic has 5 return statements (exceeds 4 allowed).
        Open

        func (w *WakuRelay) upsertTopic(topic string) (*pubsub.Topic, error) {
            topicData, ok := w.topics[topic]
            if !ok { // Joins topic if node hasn't joined yet
                err := w.pubsub.RegisterTopicValidator(topic, w.topicValidator(topic))
                if err != nil {
        Severity: Major
        Found in waku/v2/protocol/relay/waku_relay.go - About 35 mins to fix

          Method WakuRelay.subscribeToPubsubTopic has 5 return statements (exceeds 4 allowed).
          Open

          func (w *WakuRelay) subscribeToPubsubTopic(topic string) (*pubsubTopicSubscriptionDetails, error) {
              w.topicsMutex.Lock()
              defer w.topicsMutex.Unlock()
              w.log.Info("subscribing to underlying pubsubTopic", zap.String("pubsubTopic", topic))
          
          
          Severity: Major
          Found in waku/v2/protocol/relay/waku_relay.go - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status