inklabs/rangedb

View on GitHub

Showing 90 of 90 total issues

File eventstore.go has 760 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package eventstore
 
import (
"bytes"
"context"
Severity: Major
Found in provider/eventstore/eventstore.go - About 1 day to fix

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

    // Code generated by go generate; DO NOT EDIT.
    // This file was generated at
    // 2021-01-30 11:27:48.039104 -0800 PST m=+0.001821984
    package chat
     
     
    Severity: Major
    Found in examples/chat/room_commands_gen.go and 1 other location - About 7 hrs to fix
    examples/chat/room_events_gen.go on lines 1..28

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

    // Code generated by go generate; DO NOT EDIT.
    // This file was generated at
    // 2021-01-15 23:18:17.029174 -0800 PST m=+0.003738011
    package chat
     
     
    Severity: Major
    Found in examples/chat/room_events_gen.go and 1 other location - About 7 hrs to fix
    examples/chat/room_commands_gen.go on lines 1..28

    File postgres_store.go has 671 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package postgresstore
     
    import (
    "context"
    "database/sql"
    Severity: Minor
    Found in provider/postgresstore/postgres_store.go - About 6 hrs to fix

      Method structVisitor.Visit has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
      Open

      func (v *structVisitor) Visit(node ast.Node) (w ast.Visitor) {
      switch n := node.(type) {
      case *ast.TypeSpec:
      if value, ok := n.Type.(*ast.StructType); ok {
      var subjectID string
      Severity: Minor
      Found in pkg/eventparser/event_parser.go - About 6 hrs to fix

      Method eventStore.EventsByStream has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
      Open

      func (s *eventStore) EventsByStream(ctx context.Context, streamSequenceNumber uint64, streamName string) rangedb.RecordIterator {
      resultRecords := make(chan rangedb.ResultRecord)
       
      go func() {
      defer close(resultRecords)
      Severity: Minor
      Found in provider/eventstore/eventstore.go - About 5 hrs to fix

      Method eventStore.Events has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
      Open

      func (s *eventStore) Events(ctx context.Context, globalSequenceNumber uint64) rangedb.RecordIterator {
      resultRecords := make(chan rangedb.ResultRecord)
       
      go func() {
      defer close(resultRecords)
      Severity: Minor
      Found in provider/eventstore/eventstore.go - About 4 hrs to fix

      Method eventStore.EventsByAggregateTypes has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
      Open

      func (s *eventStore) EventsByAggregateTypes(ctx context.Context, globalSequenceNumber uint64, aggregateTypes ...string) rangedb.RecordIterator {
      resultRecords := make(chan rangedb.ResultRecord)
       
      go func() {
      defer close(resultRecords)
      Severity: Minor
      Found in provider/eventstore/eventstore.go - About 4 hrs to fix

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

      for _, event := range req.Events {
      var data interface{}
      err := json.Unmarshal([]byte(event.Data), &data)
      if err != nil {
      message := fmt.Sprintf("unable to read event data: %v", err)
      Severity: Major
      Found in pkg/grpc/rangedbserver/server.go and 1 other location - About 4 hrs to fix
      pkg/grpc/rangedbserver/server.go on lines 164..193

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

      for _, event := range req.Events {
      var data interface{}
      err := json.Unmarshal([]byte(event.Data), &data)
      if err != nil {
      message := fmt.Sprintf("unable to read event data: %v", err)
      Severity: Major
      Found in pkg/grpc/rangedbserver/server.go and 1 other location - About 4 hrs to fix
      pkg/grpc/rangedbserver/server.go on lines 219..248

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

      for _, eventRecord := range eventRecords {
      // TODO: Allow mixed aggregate types?
      if aggregateType != "" && aggregateType != eventRecord.Event.AggregateType() {
      return 0, fmt.Errorf("unmatched aggregate type")
      }
      Severity: Major
      Found in provider/remotestore/remote_store.go and 1 other location - About 3 hrs to fix
      provider/remotestore/remote_store.go on lines 154..185

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

      for _, eventRecord := range eventRecords {
      // TODO: Allow mixed aggregate types?
      if aggregateType != "" && aggregateType != eventRecord.Event.AggregateType() {
      return 0, fmt.Errorf("unmatched aggregate type")
      }
      Severity: Major
      Found in provider/remotestore/remote_store.go and 1 other location - About 3 hrs to fix
      provider/remotestore/remote_store.go on lines 217..248

      Method eventStore.EventsByStream has 100 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (s *eventStore) EventsByStream(ctx context.Context, streamSequenceNumber uint64, streamName string) rangedb.RecordIterator {
      resultRecords := make(chan rangedb.ResultRecord)
       
      go func() {
      defer close(resultRecords)
      Severity: Major
      Found in provider/eventstore/eventstore.go - About 3 hrs to fix

        Function main has 98 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func main() {
        fmt.Println("RangeDB API")
        flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
         
        port := flag.Int("port", 8080, "port")
        Severity: Major
        Found in cmd/rangedb/main.go - About 2 hrs to fix

          postgresStore has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type postgresStore struct {
          config *Config
          db *sql.DB
          clock clock.Clock
          uuidGenerator shortuuid.Generator
          Severity: Minor
          Found in provider/postgresstore/postgres_store.go - About 2 hrs to fix

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

            switch e := event.(type) {
             
            case RoomWasOnBoarded:
            a.roomWasOnBoarded(e)
             
             
            Severity: Major
            Found in examples/chat/room_aggregate_gen.go and 1 other location - About 2 hrs to fix
            examples/chat/room_aggregate_gen.go on lines 64..102

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

            switch c := command.(type) {
             
            case OnBoardRoom:
            a.onBoardRoom(c)
             
             
            Severity: Major
            Found in examples/chat/room_aggregate_gen.go and 1 other location - About 2 hrs to fix
            examples/chat/room_aggregate_gen.go on lines 22..60

            Method eventStore.Events has 85 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (s *eventStore) Events(ctx context.Context, globalSequenceNumber uint64) rangedb.RecordIterator {
            resultRecords := make(chan rangedb.ResultRecord)
             
            go func() {
            defer close(resultRecords)
            Severity: Major
            Found in provider/eventstore/eventstore.go - About 2 hrs to fix

              eventStore has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type eventStore struct {
              client *esdb.Client
              clock clock.Clock
              streamPrefixer StreamPrefixer
              uuidGenerator shortuuid.Generator
              Severity: Minor
              Found in provider/eventstore/eventstore.go - About 2 hrs to fix

                Method eventStore.EventsByAggregateTypes has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (s *eventStore) EventsByAggregateTypes(ctx context.Context, globalSequenceNumber uint64, aggregateTypes ...string) rangedb.RecordIterator {
                resultRecords := make(chan rangedb.ResultRecord)
                 
                go func() {
                defer close(resultRecords)
                Severity: Major
                Found in provider/eventstore/eventstore.go - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language