vorteil/direktiv

View on GitHub

Showing 467 of 1,322 total issues

Method nsController.update has 105 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (e *nsController) update(w http.ResponseWriter, r *http.Request) {
    name := chi.URLParam(r, "name")

    db, err := e.db.BeginTx(r.Context())
    if err != nil {
Severity: Major
Found in pkg/refactor/api/namespaces.go - About 3 hrs to fix

    Method instController.list has 105 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (e *instController) list(w http.ResponseWriter, r *http.Request) {
        ctx := r.Context()
        ns := extractContextNamespace(r)
    
        pagination, err := e.getPagination(r)
    Severity: Major
    Found in pkg/refactor/api/instances.go - About 3 hrs to fix

      Method LocalServer.setVar has 103 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (srv *LocalServer) setVar(ctx context.Context, ir *functionRequest, totalSize int64, r io.Reader, scope, key, vMimeType string) error {
          var err error
          var client varSetClient
          var send func(*varSetClientMsg) error
      
      
      Severity: Major
      Found in cmd/sidecar/local-server.go - About 3 hrs to fix

        Function Header has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Header = () => {
          const namespace = useNamespace();
          const { routePath } = pages.gateway.useParams();
          const { data: route } = useRoute({
            routePath: routePath ?? "",
        Severity: Major
        Found in ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx - About 3 hrs to fix

          Method forEachLogic.processActionResults has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
          Open

          func (logic *forEachLogic) processActionResults(ctx context.Context, children []*ChildInfo, results *actionResultPayload) (*Transition, error) {
              var err error
          
              var found bool
              var idx int
          Severity: Minor
          Found in pkg/flow/states/foreach.go - About 3 hrs 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

          File index.spec.ts has 293 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { createNamespace, deleteNamespace } from "e2e/utils/namespace";
          import { createRouteYaml, removeLines } from "./utils";
          import { expect, test } from "@playwright/test";
          
          import { createFile } from "e2e/utils/files";
          Severity: Minor
          Found in ui/e2e/explorer/route/index.spec.ts - About 3 hrs to fix

            Method forEachLogic.processActionResults has 99 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (logic *forEachLogic) processActionResults(ctx context.Context, children []*ChildInfo, results *actionResultPayload) (*Transition, error) {
                var err error
            
                var found bool
                var idx int
            Severity: Major
            Found in pkg/flow/states/foreach.go - About 2 hrs to fix

              File tree.go has 539 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              // nolint
              package endpoints
              
              // This file has been copied and modified from https://github.com/go-chi/chi
              // Radix tree implementation below is a based on the original work by
              Severity: Minor
              Found in pkg/refactor/gateway/endpoints/tree.go - About 2 hrs to fix

                File index.spec.ts has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { createNamespace, deleteNamespace } from "../../utils/namespace";
                import { expect, test } from "@playwright/test";
                import {
                  parentWorkflow as parentWorkflowContent,
                  simpleWorkflow as simpleWorkflowContent,
                Severity: Minor
                Found in ui/e2e/instances/list/index.spec.ts - About 2 hrs to fix

                  Function ToGRPCCloudEvents has 97 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func ToGRPCCloudEvents(r *http.Request) ([]cloudevents.Event, error) {
                      var events []cloudevents.Event
                      ct := r.Header.Get("Content-type")
                      oct := ct
                  
                  
                  Severity: Major
                  Found in pkg/api/flow.go - About 2 hrs to fix

                    Method engine.runState has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (engine *engine) runState(ctx context.Context, im *instanceMemory, wakedata []byte, err error) *states.Transition {
                        loggingCtx := im.Namespace().WithTags(ctx)
                        instanceTrackCtx := enginerefactor.WithTrack(loggingCtx, enginerefactor.BuildInstanceTrack(im.instance))
                        slog.Debug("Starting state execution.", enginerefactor.GetSlogAttributesWithStatus(ctx, core.LogRunningStatus)...)
                    
                    
                    Severity: Major
                    Found in pkg/flow/engine.go - About 2 hrs to fix

                      Function recurseIntoString has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func recurseIntoString(data interface{}, s string) ([]interface{}, error) {
                          out := make([]interface{}, 0)
                      
                          if TrimWhitespaceOnQueryStrings {
                              s = strings.TrimSpace(s)
                      Severity: Major
                      Found in pkg/jqer/jqer.go - About 2 hrs to fix

                        Function Default has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const Default = () => {
                          const [pageSize, setPageSize] = useState(3);
                          return (
                            <div
                              className="flex flex-col items-center space-y-5 p-5
                        Severity: Major
                        Found in ui/src/components/PaginationProvider/index.stories.tsx - About 2 hrs to fix

                          Method instanceMemory.GetVariables has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (im *instanceMemory) GetVariables(ctx context.Context, vars []states.VariableSelector) ([]states.Variable, error) {
                              x := make([]states.Variable, 0)
                          
                              tx, err := im.engine.flow.beginSQLTx(ctx)
                              if err != nil {
                          Severity: Minor
                          Found in pkg/flow/temporary.go - About 2 hrs 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 jxController.handler has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                          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/refactor/api/jx.go - About 2 hrs to fix

                            Method dockerClient.createService has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (c *dockerClient) createService(sv *core.ServiceFileData) error {
                                // don't pull any image that has 'local' prefix.
                                if !strings.HasPrefix(sv.Image, "local") {
                                    out, err := c.cli.ImagePull(context.Background(), sv.Image, types.ImagePullOptions{})
                                    if err != nil {
                            Severity: Major
                            Found in pkg/refactor/service/docker_client.go - About 2 hrs to fix

                              Method fsController.updateFile has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                              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/refactor/api/filesystem.go - About 2 hrs to fix

                                Function SendEvent has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const SendEvent = () => {
                                  const [body, setBody] = useState<string | undefined>(exampleEvent);
                                  const [isOpen, setIsOpen] = useState(false);
                                  const theme = useTheme();
                                  const { t } = useTranslation();
                                Severity: Major
                                Found in ui/src/pages/namespace/Events/History/SendEvent.tsx - About 2 hrs to fix

                                  Pubsub has 24 methods (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  type Pubsub struct {
                                      id       uuid.UUID
                                      notifier Notifier
                                  
                                      handlers map[string]func(*PubsubUpdate)
                                  Severity: Minor
                                  Found in pkg/flow/pubsub/pubsub.go - About 2 hrs to fix

                                    File events.go has 525 lines of code (exceeds 500 allowed). Consider refactoring.
                                    Open

                                    package flow
                                    
                                    import (
                                        "context"
                                        "encoding/gob"
                                    Severity: Minor
                                    Found in pkg/flow/events.go - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language