vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Method engine.doKnativeHTTPRequest has 8 return statements (exceeds 4 allowed).
Open

func (engine *engine) doKnativeHTTPRequest(ctx context.Context,
    ar *functionRequest, arReq *enginerefactor.ActionRequest,
) {
    ctx, spanEnd, err := tracing.NewSpan(ctx, "executing knative request to action")
    if err != nil {
Severity: Major
Found in pkg/flow/temporary.go - About 50 mins to fix

    Method actionLogic.scheduleAction has 8 return statements (exceeds 4 allowed).
    Open

    func (logic *actionLogic) scheduleAction(ctx context.Context, attempt int) error {
        input, files, err := generateActionInput(ctx, &generateActionInputArgs{
            Instance: logic.Instance,
            Source:   logic.GetInstanceData(),
            Action:   logic.Action,
    Severity: Major
    Found in pkg/flow/states/action.go - About 50 mins to fix

      Method SlackWebhookPlugin.Execute has 8 return statements (exceeds 4 allowed).
      Open

      func (p *SlackWebhookPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
          // check request is already authenticated
          if gateway.ExtractContextActiveConsumer(r) != nil {
              return r
          }
      Severity: Major
      Found in pkg/gateway/plugins/auth/slack-event.go - About 50 mins to fix

        Method actionLogic.Run has 8 return statements (exceeds 4 allowed).
        Open

        func (logic *actionLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
            // first schedule
            if len(wakedata) == 0 {
                err := noMemory(logic)
                if err != nil {
        Severity: Major
        Found in pkg/flow/states/action.go - About 50 mins to fix

          Method logController.getNewer has 8 return statements (exceeds 4 allowed).
          Open

          func (m logController) getNewer(ctx context.Context, t time.Time, params map[string]string) ([]logEntry, error) {
              var logs []core.LogEntry
              var err error
          
              // Determine the track based on the provided parameters
          Severity: Major
          Found in pkg/api/plattformlogs.go - About 50 mins to fix

            Method jxController.handler has 8 return statements (exceeds 4 allowed).
            Open

            func (c *jxController) handler(w http.ResponseWriter, r *http.Request) {
                data, err := io.ReadAll(r.Body)
                if err != nil {
                    return
                }
            Severity: Major
            Found in pkg/api/jx.go - About 50 mins to fix

              Method Workflow.validate has 8 return statements (exceeds 4 allowed).
              Open

              func (o *Workflow) validate() error {
                  if len(o.States) == 0 {
                      return errors.New("workflow has no defined states")
                  }
              
              
              Severity: Major
              Found in pkg/model/workflow.go - About 50 mins to fix

                Method Workflow.unmarshal has 8 return statements (exceeds 4 allowed).
                Open

                func (o *Workflow) unmarshal(m map[string]interface{}) error {
                    // split start out from the rest, and umarshal it
                    if err := o.unmStart(m); err != nil {
                        return err
                    }
                Severity: Major
                Found in pkg/model/workflow.go - About 50 mins to fix

                  Method events.handleEvent has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (events *events) handleEvent(ctx context.Context, ns *datastore.Namespace, ce *cloudevents.Event) error {
                      ctx = tracing.WithTrack(tracing.AddNamespace(ctx, ns.Name), tracing.BuildNamespaceTrack(ns.Name))
                      ctx, end, err := tracing.NewSpan(ctx, "handling event-messages")
                      if err != nil {
                          slog.Debug("GetListenersByTopic failed to init telemetry", "error", err)
                  Severity: Minor
                  Found in pkg/flow/events.go - About 45 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

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

                  func patchVarData(ctx context.Context, flowToken string, flowAddr string, namespace string, id string, body datastore.RuntimeVariablePatch) (int, error) {
                  Severity: Minor
                  Found in cmd/sidecar/api_v2_clients.go - About 45 mins to fix

                    Method engine.NewInstance has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (engine *engine) NewInstance(ctx context.Context, args *newInstanceArgs) (*instanceMemory, error) {
                        ctx = tracing.AddInstanceAttr(ctx, tracing.InstanceAttributes{
                            Namespace:    args.Namespace.Name,
                            InstanceID:   args.ID.String(),
                            Invoker:      args.Invoker,
                    Severity: Minor
                    Found in pkg/flow/engine.go - About 45 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 JSOutboundPlugin.Execute has 7 return statements (exceeds 4 allowed).
                    Open

                    func (js *JSOutboundPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
                        var (
                            err error
                            b   []byte
                        )
                    Severity: Major
                    Found in pkg/gateway/plugins/outbound/js_outbound.go - About 45 mins to fix

                      Method engine.enqueueInstanceMessage has 7 return statements (exceeds 4 allowed).
                      Open

                      func (engine *engine) enqueueInstanceMessage(ctx context.Context, id uuid.UUID, kind string, data interface{}) error {
                          // TODO: should this add state and step data? At some point these fields died so I have removed them.
                          payload, err := json.Marshal(map[string]interface{}{
                              "type": kind,
                              "data": data,
                      Severity: Major
                      Found in pkg/flow/instance_messages.go - About 45 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 forEachLogic.Run has 7 return statements (exceeds 4 allowed).
                            Open

                            func (logic *forEachLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
                                // first schedule
                                if len(wakedata) == 0 {
                                    err := noMemory(logic)
                                    if err != nil {
                            Severity: Major
                            Found in pkg/flow/states/foreach.go - About 45 mins to fix

                              Method instanceMemory.SetVariables has 7 return statements (exceeds 4 allowed).
                              Open

                              func (im *instanceMemory) SetVariables(ctx context.Context, vars []states.VariableSetter) error {
                                  tx, err := im.engine.flow.beginSQLTx(ctx)
                                  if err != nil {
                                      return err
                                  }
                              Severity: Major
                              Found in pkg/flow/temporary.go - About 45 mins to fix

                                Method Manager.gc has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (d *Manager) gc() {
                                    ctx := context.Background()
                                
                                    jitter := 1000
                                    interval := time.Second * 10
                                Severity: Minor
                                Found in pkg/mirror/manager.go - About 45 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 eventsXorLogic.Run has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (logic *eventsXorLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
                                    first, err := scheduleTwice(logic, wakedata)
                                    if err != nil {
                                        return nil, err
                                    }
                                Severity: Minor
                                Found in pkg/flow/states/eventsXor.go - About 45 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 server.getInstance has 7 return statements (exceeds 4 allowed).
                                Open

                                func (srv *server) getInstance(ctx context.Context, namespace, instanceID string) (*enginerefactor.Instance, error) {
                                    id, err := uuid.Parse(instanceID)
                                    if err != nil {
                                        return nil, err
                                    }
                                Severity: Major
                                Found in pkg/flow/grpc-instances.go - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language