waku-org/go-waku

View on GitHub

Showing 400 of 400 total issues

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

package main
 
import (
"fmt"
 
 
Severity: Major
Found in examples/chat2-reliable/flags.go and 1 other location - About 3 days to fix
examples/chat2/flags.go on lines 1..230

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

package main
 
import (
"fmt"
 
 
Severity: Major
Found in examples/chat2/flags.go and 1 other location - About 3 days to fix
examples/chat2-reliable/flags.go on lines 1..230

Method Chat.parseInput has a Cognitive Complexity of 94 (exceeds 20 allowed). Consider refactoring.
Open

func (c *Chat) parseInput() {
defer c.wg.Done()
 
var disconnectedPeers []peer.ID
 
 
Severity: Minor
Found in examples/chat2-reliable/chat.go - About 1 day to fix

Function Execute has a Cognitive Complexity of 91 (exceeds 20 allowed). Consider refactoring.
Open

func Execute(options NodeOptions) error {
// Set encoding for logs (console, json, ...)
// Note that libp2p reads the encoding from GOLOG_LOG_FMT env var.
lvl, err := zapcore.ParseLevel(options.LogLevel)
if err != nil {
Severity: Minor
Found in cmd/waku/node.go - About 1 day to fix

Function Execute has 285 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func Execute(options NodeOptions) error {
// Set encoding for logs (console, json, ...)
// Note that libp2p reads the encoding from GOLOG_LOG_FMT env var.
lvl, err := zapcore.ParseLevel(options.LogLevel)
if err != nil {
Severity: Major
Found in cmd/waku/node.go - About 1 day to fix

    Method Chat.parseInput has a Cognitive Complexity of 80 (exceeds 20 allowed). Consider refactoring.
    Open

    func (c *Chat) parseInput() {
    defer c.wg.Done()
    for {
    select {
    case <-c.ctx.Done():
    Severity: Minor
    Found in examples/chat2/chat.go - About 1 day to fix

    Method WakuNode.startKeepAlive has a Cognitive Complexity of 79 (exceeds 20 allowed). Consider refactoring.
    Open

    func (w *WakuNode) startKeepAlive(ctx context.Context, randomPeersPingDuration time.Duration, allPeersPingDuration time.Duration) {
    defer utils.LogOnPanic()
    defer w.wg.Done()
     
    if !w.opts.enableRelay {
    Severity: Minor
    Found in waku/v2/node/keepalive.go - About 1 day to fix

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

    package main
     
    import (
    "crypto/ecdsa"
    "errors"
    Severity: Major
    Found in examples/chat2/options.go and 1 other location - About 1 day to fix
    examples/chat2-reliable/options.go on lines 1..126

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

    package main
     
    import (
    "crypto/ecdsa"
    "errors"
    Severity: Major
    Found in examples/chat2-reliable/options.go and 1 other location - About 1 day to fix
    examples/chat2/options.go on lines 1..126

    File wakunode2.go has 781 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package node
     
    import (
    "context"
    "math/rand"
    Severity: Major
    Found in waku/v2/node/wakunode2.go - About 1 day to fix

      Method MissingMessageVerifier.fetchMessagesBatch has a Cognitive Complexity of 63 (exceeds 20 allowed). Consider refactoring.
      Open

      func (m *MissingMessageVerifier) fetchMessagesBatch(c chan<- *protocol.Envelope, interest criteriaInterest, batchFrom int, batchTo int, now time.Time) error {
      contentTopics := interest.contentFilter.ContentTopics.ToList()
       
      logger := m.logger.With(
      zap.Stringer("peerID", interest.peerInfo.ID),
      Severity: Minor
      Found in waku/v2/api/missing/missing_messages.go - About 7 hrs to fix

      Function getFlags has 193 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func getFlags() []cli.Flag {
      // Defaults
      options.Fleet = fleetProd
       
      testCT, err := protocol.NewContentTopic("toy-chat", "3", "mingde", "proto")
      Severity: Major
      Found in examples/chat2-reliable/flags.go - About 6 hrs to fix

        Function getFlags has 193 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func getFlags() []cli.Flag {
        // Defaults
        options.Fleet = fleetProd
         
        testCT, err := protocol.NewContentTopic("toy-chat", "3", "mingde", "proto")
        Severity: Major
        Found in examples/chat2/flags.go - About 6 hrs to fix

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

          switch msg := msg.(type) {
           
          case tea.WindowSizeMsg:
          m.width, m.height = msg.Width, msg.Height
           
           
          Severity: Major
          Found in examples/chat2/ui.go and 1 other location - About 6 hrs to fix
          examples/chat2-reliable/ui.go on lines 142..201

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

          switch msg := msg.(type) {
           
          case tea.WindowSizeMsg:
          m.width, m.height = msg.Width, msg.Height
           
           
          Severity: Major
          Found in examples/chat2-reliable/ui.go and 1 other location - About 6 hrs to fix
          examples/chat2/ui.go on lines 142..201

          File client.go has 649 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          package filter
           
          import (
          "context"
          "encoding/hex"
          Severity: Minor
          Found in waku/v2/protocol/filter/client.go - About 5 hrs to fix

            Function New has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
            Open

            func New(opts ...WakuNodeOption) (*WakuNode, error) {
            var err error
            params := new(WakuNodeParameters)
            params.libP2POpts = DefaultLibP2POptions
             
             
            Severity: Minor
            Found in waku/v2/node/wakunode2.go - About 5 hrs to fix

            WakuNode has 40 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type WakuNode struct {
            host host.Host
            opts *WakuNodeParameters
            log *zap.Logger
            timesource timesource.Timesource
            Severity: Minor
            Found in waku/v2/node/wakunode2.go - About 5 hrs to fix

              Method HistoryRetriever.Query has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
              Open

              func (hr *HistoryRetriever) Query(
              ctx context.Context,
              criteria store.FilterCriteria,
              storenode peer.AddrInfo,
              pageLimit uint64,
              Severity: Minor
              Found in waku/v2/api/history/history.go - About 4 hrs to fix

              Function getStoreParams has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
              Open

              func getStoreParams(r *http.Request) (store.Criteria, []store.RequestOption, error) {
              var options []store.RequestOption
              var err error
              peerAddrStr := r.URL.Query().Get("peerAddr")
              var m multiaddr.Multiaddr
              Severity: Minor
              Found in cmd/waku/server/rest/store.go - About 4 hrs to fix
              Severity
              Category
              Status
              Source
              Language