ucpr/mongo-streamer

View on GitHub

Showing 6 of 6 total issues

Method App.Run has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
Open

func (a *App) Run(ctx context.Context) error {
col := a.mcli.Collection("tweets")
for {
select {
case <-ctx.Done():
Severity: Minor
Found in hack/tester/main.go - About 2 hrs to fix

Method App.Run has 56 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (a *App) Run(ctx context.Context) error {
col := a.mcli.Collection("tweets")
for {
select {
case <-ctx.Done():
Severity: Minor
Found in hack/tester/main.go - About 1 hr to fix

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

    func NewMongoDB(ctx context.Context) (*MongoDB, error) {
    conf := &MongoDB{}
    pl := envconfig.PrefixLookuper(mongoDBPrefix, envconfig.OsLookuper())
    if err := envconfig.ProcessWith(ctx, &envconfig.Config{
    Target: conf,
    Severity: Major
    Found in internal/config/config.go and 2 other locations - About 40 mins to fix
    internal/config/config.go on lines 66..77
    internal/config/config.go on lines 79..90

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

    func NewMetrics(ctx context.Context) (*Metrics, error) {
    conf := &Metrics{}
    pl := envconfig.PrefixLookuper(mrtricsPrefix, envconfig.OsLookuper())
    if err := envconfig.ProcessWith(ctx, &envconfig.Config{
    Target: conf,
    Severity: Major
    Found in internal/config/config.go and 2 other locations - About 40 mins to fix
    internal/config/config.go on lines 53..64
    internal/config/config.go on lines 66..77

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

    func NewPubSub(ctx context.Context) (*PubSub, error) {
    conf := &PubSub{}
    pl := envconfig.PrefixLookuper(pubSubPrefix, envconfig.OsLookuper())
    if err := envconfig.ProcessWith(ctx, &envconfig.Config{
    Target: conf,
    Severity: Major
    Found in internal/config/config.go and 2 other locations - About 40 mins to fix
    internal/config/config.go on lines 53..64
    internal/config/config.go on lines 79..90

    Function NewChangeStream has 5 return statements (exceeds 4 allowed).
    Confirmed

    func NewChangeStream(ctx context.Context, params ChangeStreamParams, opts ...ChangeStreamOption) (*ChangeStream, error) {
    chopts := &options.ChangeStreamOptions{}
    for _, opt := range opts {
    opt(&ChangeStreamOptions{chopts})
    }
    Severity: Major
    Found in internal/mongo/change_stream.go - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language