vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Method setterLogic.Run has 10 return statements (exceeds 4 allowed).
Open

func (logic *setterLogic) 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/setter.go - About 1 hr to fix

    Method fsController.updateFile has 10 return statements (exceeds 4 allowed).
    Open

    func (e *fsController) updateFile(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/filesystem.go - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

        if (value.states) {
          for (let i = 0; i < value.states.length; i++) {
            let transitions = false;
            // check if starting element
            if (i === 0) {
      Severity: Major
      Found in ui/src/design/WorkflowDiagram/utils.ts - About 1 hr to fix

        Method eventsXorLogic.Run has 9 return statements (exceeds 4 allowed).
        Open

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

          Method events.handleEvent has 9 return statements (exceeds 4 allowed).
          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: Major
          Found in pkg/flow/events.go - About 55 mins to fix

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

            func (engine *engine) Transition(ctx context.Context, im *instanceMemory, nextState string, attempt int) *states.Transition {
                ctx, cleanup, err := tracing.NewSpan(ctx, "engine transitions: "+nextState)
                if err != nil {
                    slog.Debug("transition failed to init telemetry", "error", err)
                }
            Severity: Minor
            Found in pkg/flow/engine.go - About 55 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 consumeEventLogic.Run has 9 return statements (exceeds 4 allowed).
            Open

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

              Function getReferencedFile has 9 return statements (exceeds 4 allowed).
              Open

              func getReferencedFile(ctx context.Context, flowToken, flowAddr, namespace string, path string) ([]byte, int, error) {
                  addr := fmt.Sprintf("http://%v/api/v2/namespaces/%v/files/%v", flowAddr, namespace, path)
                  var d []byte
              
                  resp, err := doRequest(ctx, http.MethodGet, flowToken, addr, nil)
              Severity: Major
              Found in cmd/sidecar/api_v2_clients.go - About 55 mins to fix

                Method FileQuery.SetPath has 9 return statements (exceeds 4 allowed).
                Open

                func (q *FileQuery) SetPath(ctx context.Context, path string) error {
                    path, err := filestore.SanitizePath(path)
                    if err != nil {
                        return fmt.Errorf("%w: %w", filestore.ErrInvalidPathParameter, err)
                    }
                Severity: Major
                Found in pkg/filestore/filestoresql/file_query.go - About 55 mins to fix

                  Function TargetPluginForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const TargetPluginForm: FC<TargetPluginFormProps> = ({
                    form,
                    onSave,
                  }) => {
                    const availablePlugins = useAvailablePlugins();

                  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 InstancesListPage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const InstancesListPage = () => {
                    const [offset, setOffset] = useState(0);
                    const [filters, setFilters] = useState<FiltersObj>({});
                    const { t } = useTranslation();
                    const { data, isSuccess, isAllowed, noPermissionMessage } = useInstances({
                  Severity: Minor
                  Found in ui/src/pages/namespace/Instances/List/index.tsx - About 55 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 RoutesTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const RoutesTable = ({
                    search,
                    filteredRoutes,
                  }: {
                    search: string;
                  Severity: Minor
                  Found in ui/src/pages/namespace/Gateway/Routes/Table/index.tsx - About 55 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 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 Initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func Initialize(app core.App, db *database.SQLStore, bus *pubsub2.Bus, instanceManager *instancestore.InstanceManager, wakeByEvents events.WakeEventsWaiter, startByEvents events.WorkflowStart, circuit *core.Circuit) error {
                    Severity: Major
                    Found in pkg/api/api.go - About 50 mins to fix

                      Method engine.NewInstance has 8 return statements (exceeds 4 allowed).
                      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: Major
                      Found in pkg/flow/engine.go - About 50 mins to fix

                        Function generateGetInstancesFilters has 8 return statements (exceeds 4 allowed).
                        Open

                        func generateGetInstancesFilters(opts *instancestore.ListOpts) ([]string, []interface{}, error) {
                            if opts == nil {
                                return []string{}, []interface{}{}, nil
                            }
                        
                        
                        Severity: Major
                        Found in pkg/instancestore/instancestoresql/sql_builders.go - About 50 mins to fix

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

                          func (logic *getterLogic) 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/getter.go - About 50 mins to fix

                            Method LocalServer.logHandler has 8 return statements (exceeds 4 allowed).
                            Open

                            func (srv *LocalServer) logHandler(w http.ResponseWriter, r *http.Request) {
                                actionId := r.URL.Query().Get("aid")
                            
                                srv.requestsLock.Lock()
                                req, ok := srv.requests[actionId]
                            Severity: Major
                            Found in cmd/sidecar/local-server.go - About 50 mins to fix

                              Method flow.cronHandler has 8 return statements (exceeds 4 allowed).
                              Open

                              func (flow *flow) cronHandler(data []byte) {
                                  ctx := context.Background()
                              
                                  t := time.Now().Truncate(time.Minute).UTC()
                              
                              
                              Severity: Major
                              Found in pkg/flow/routing.go - About 50 mins to fix

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

                                func (logic *eventsAndLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
                                    first, err := scheduleTwice(logic, wakedata)
                                    if err != nil {
                                        return nil, err
                                    }
                                Severity: Major
                                Found in pkg/flow/states/eventsAnd.go - About 50 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language