vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

Method timers.addOneShot has 5 return statements (exceeds 4 allowed).
Open

func (timers *timers) addOneShot(name, fn string, timeos time.Time, data []byte) error {
    utc := timeos.UTC()

    t, err := timers.newTimer(name, fn, data, &utc, "")
    if err != nil {
Severity: Major
Found in pkg/flow/timers.go - About 35 mins to fix

    Method NamespaceVarPlugin.Execute has 5 return statements (exceeds 4 allowed).
    Open

    func (tnv *NamespaceVarPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
        currentNS := gateway.ExtractContextEndpoint(r).Namespace
        if tnv.Namespace == "" {
            tnv.Namespace = currentNS
        }
    Severity: Major
    Found in pkg/gateway/plugins/target/target-ns-var.go - About 35 mins to fix

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

      func jq(input interface{}, command string) ([]interface{}, error) {
          data, err := json.Marshal(input)
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in pkg/jqer/jqer.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

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

          func preprocessRetry(retry *model.RetryDefinition, attempt int, err error) (time.Duration, error) {
              var d time.Duration
          
              if retry == nil {
                  return d, err
          Severity: Major
          Found in pkg/flow/states/action-helpers.go - About 35 mins to fix

            Method engine.handleInstanceMessage has 5 return statements (exceeds 4 allowed).
            Open

            func (engine *engine) handleInstanceMessage(ctx context.Context, im *instanceMemory, msg *instancestore.InstanceMessageData) *states.Transition {
                instanceCtx := tracing.AddInstanceMemoryAttr(ctx,
                    tracing.InstanceAttributes{
                        Namespace:    im.Namespace().Name,
                        InstanceID:   im.GetInstanceID().String(),
            Severity: Major
            Found in pkg/flow/instance_messages.go - About 35 mins to fix

              Method generateEventLogic.Run has 5 return statements (exceeds 4 allowed).
              Open

              func (logic *generateEventLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
                  err := scheduleOnce(logic, wakedata)
                  if err != nil {
                      return nil, err
                  }
              Severity: Major
              Found in pkg/flow/states/generateEvent.go - About 35 mins to fix

                Method sqlEventListenerStore.Append has 5 return statements (exceeds 4 allowed).
                Open

                func (s *sqlEventListenerStore) Append(ctx context.Context, listener *datastore.EventListener) error {
                    q := `INSERT INTO event_listeners
                     (id, namespace_id, namespace, created_at, updated_at, deleted, received_events, trigger_type, events_lifespan, event_types, trigger_info, metadata, event_context_filters) 
                      VALUES ( $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 , $11, $12, $13);`
                
                
                Severity: Major
                Found in pkg/datastore/datastoresql/eventstore_listener.go - About 35 mins to fix

                  Method Workflow.unmStart has 5 return statements (exceeds 4 allowed).
                  Open

                  func (o *Workflow) unmStart(m map[string]interface{}) (err error) {
                      // split start out from the rest
                      y, startFound := m["start"]
                      if startFound {
                          // Start
                  Severity: Major
                  Found in pkg/model/workflow.go - About 35 mins to fix

                    Method secretsController.create has 5 return statements (exceeds 4 allowed).
                    Open

                    func (e *secretsController) create(w http.ResponseWriter, r *http.Request) {
                        ns := extractContextNamespace(r)
                    
                        db, err := e.db.BeginTx(r.Context())
                        if err != nil {
                    Severity: Major
                    Found in pkg/api/secrets.go - About 35 mins to fix

                      Method SubflowFunctionDefinition.Validate has 5 return statements (exceeds 4 allowed).
                      Open

                      func (o *SubflowFunctionDefinition) Validate() error {
                          if o == nil {
                              return nil
                          }
                      
                      
                      Severity: Major
                      Found in pkg/model/function-subflow.go - About 35 mins to fix

                        Method SwitchState.Validate has 5 return statements (exceeds 4 allowed).
                        Open

                        func (o *SwitchState) Validate() error {
                            if err := o.commonValidate(); err != nil {
                                return err
                            }
                        
                        
                        Severity: Major
                        Found in pkg/model/state-switch.go - About 35 mins to fix

                          Method sqlSecretsStore.Set has 5 return statements (exceeds 4 allowed).
                          Open

                          func (s sqlSecretsStore) Set(ctx context.Context, secret *datastore.Secret) error {
                              var res *gorm.DB
                              x, err := s.Get(ctx, secret.Namespace, secret.Name)
                              //nolint:nestif
                              if errors.Is(err, datastore.ErrNotFound) {
                          Severity: Major
                          Found in pkg/datastore/datastoresql/secrets.go - About 35 mins to fix

                            Function renderServiceManager has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func renderServiceManager(db *database.SQLStore, serviceManager core.ServiceManager) {
                                ctx := context.Background()
                                slog := slog.With("subscriber", "services file watcher")
                            
                                fStore, dStore := db.FileStore(), db.DataStore()
                            Severity: Minor
                            Found in pkg/cmd/main.go - About 35 mins 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 NamespacedFunctionDefinition.Validate has 5 return statements (exceeds 4 allowed).
                            Open

                            func (o *NamespacedFunctionDefinition) Validate() error {
                                if o == nil {
                                    return nil
                                }
                            
                            
                            Severity: Major
                            Found in pkg/model/function-namespaced.go - About 35 mins to fix

                              Method SetterState.Validate has 5 return statements (exceeds 4 allowed).
                              Open

                              func (o *SetterState) Validate() error {
                                  if err := o.commonValidate(); err != nil {
                                      return err
                                  }
                              
                              
                              Severity: Major
                              Found in pkg/model/state-setter.go - About 35 mins to fix

                                Method instController.getPagination has 5 return statements (exceeds 4 allowed).
                                Open

                                func (e *instController) getPagination(r *http.Request) (*paginationOptions, error) {
                                    opts := new(paginationOptions)
                                
                                    x := r.URL.Query().Get("limit")
                                    if x != "" {
                                Severity: Major
                                Found in pkg/api/instances.go - About 35 mins to fix

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

                                  func ParseEndpointFile(ns string, filePath string, data []byte) Endpoint {
                                      res := &EndpointFile{}
                                      err := yaml.Unmarshal(data, res)
                                      if err != nil {
                                          return Endpoint{
                                  Severity: Major
                                  Found in pkg/core/gateway.go - About 35 mins to fix

                                    Method GetterState.Validate has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (o *GetterState) Validate() error {
                                        if err := o.commonValidate(); err != nil {
                                            return err
                                        }
                                    
                                    
                                    Severity: Major
                                    Found in pkg/model/state-getter.go - About 35 mins to fix

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

                                      func InitTelemetry(cirCtx context.Context, addr string, svcName, imName string) (func(), error) {
                                          slog.Debug("Initializing telemetry.", "instrumentationName", imName)
                                          instrumentationName = imName
                                      
                                          // Setup context propagation format
                                      Severity: Major
                                      Found in pkg/tracing/telemetry.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language