waku-org/go-waku

View on GitHub
waku/v2/api/history/history.go

Summary

Maintainability
C
1 day
Test Coverage
A
90%

Method HistoryRetriever.Query has 119 lines of code (exceeds 50 allowed). Consider refactoring.
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 3 hrs to fix

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

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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method HistoryRetriever.createMessagesRequest has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        ctx context.Context,
        peerID peer.ID,
        criteria store.FilterCriteria,
        cursor []byte,
        limit uint64,
    Severity: Major
    Found in waku/v2/api/history/history.go - About 1 hr 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

        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

          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

            There are no issues that match your filters.

            Category
            Status