vorteil/direktiv

View on GitHub
pkg/flow/db-events.go

Summary

Maintainability
C
7 hrs
Test Coverage

Function appendEventListenersToDB has 64 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func appendEventListenersToDB(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, lifespan time.Duration, ms *muxStart, tx *database.SQLStore) error {
    fEv := &datastore.EventListener{
        ID:                       uuid.New(),
        CreatedAt:                time.Now().UTC(),
        UpdatedAt:                time.Now().UTC(),
Severity: Minor
Found in pkg/flow/db-events.go - About 1 hr to fix

    Method events.addInstanceEventListener has 60 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (events *events) addInstanceEventListener(ctx context.Context, namespace uuid.UUID, nsName string, instance uuid.UUID, sevents []*model.ConsumeEventDefinition, all bool) error {
        // var ev []map[string]interface{}
    
        fEv := &datastore.EventListener{
            ID:                     uuid.New(),
    Severity: Minor
    Found in pkg/flow/db-events.go - About 1 hr to fix

      Function appendEventListenersToDB has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func appendEventListenersToDB(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, lifespan time.Duration, ms *muxStart, tx *database.SQLStore) error {
      Severity: Major
      Found in pkg/flow/db-events.go - About 50 mins to fix

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

        func renderStartEventListener(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, ms *muxStart, tx *database.SQLStore) error {
        Severity: Minor
        Found in pkg/flow/db-events.go - About 45 mins to fix

          Method events.addInstanceEventListener has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (events *events) addInstanceEventListener(ctx context.Context, namespace uuid.UUID, nsName string, instance uuid.UUID, sevents []*model.ConsumeEventDefinition, all bool) error {
          Severity: Minor
          Found in pkg/flow/db-events.go - About 45 mins to fix

            Method events.deleteWorkflowEventListeners has 5 return statements (exceeds 4 allowed).
            Open

            func (events *events) deleteWorkflowEventListeners(ctx context.Context, nsID uuid.UUID, fileID uuid.UUID) error {
                err := events.runSQLTx(ctx, func(tx *database.SQLStore) error {
                    ids, err := tx.DataStore().EventListener().DeleteAllForWorkflow(ctx, fileID)
                    if err != nil {
                        return err
            Severity: Major
            Found in pkg/flow/db-events.go - About 35 mins to fix

              Method events.deleteInstanceEventListeners has 5 return statements (exceeds 4 allowed).
              Open

              func (events *events) deleteInstanceEventListeners(ctx context.Context, im *instanceMemory) error {
                  err := events.runSQLTx(ctx, func(tx *database.SQLStore) error {
                      ids, err := tx.DataStore().EventListener().DeleteAllForWorkflow(ctx, im.instance.Instance.ID)
                      if err != nil {
                          return err
              Severity: Major
              Found in pkg/flow/db-events.go - About 35 mins to fix

                Method events.addInstanceEventListener has 5 return statements (exceeds 4 allowed).
                Open

                func (events *events) addInstanceEventListener(ctx context.Context, namespace uuid.UUID, nsName string, instance uuid.UUID, sevents []*model.ConsumeEventDefinition, all bool) error {
                    // var ev []map[string]interface{}
                
                    fEv := &datastore.EventListener{
                        ID:                     uuid.New(),
                Severity: Major
                Found in pkg/flow/db-events.go - About 35 mins to fix

                  Function renderStartEventListener has 5 return statements (exceeds 4 allowed).
                  Open

                  func renderStartEventListener(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, ms *muxStart, tx *database.SQLStore) error {
                      _, err := tx.DataStore().EventListener().DeleteAllForWorkflow(ctx, file.ID)
                      if err != nil {
                          return err
                      }
                  Severity: Major
                  Found in pkg/flow/db-events.go - About 35 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status