vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Function buildService has 57 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func buildService(c *core.Config, sv *core.ServiceFileData, registrySecrets []corev1.LocalObjectReference) (*servingv1.Service, error) {
    containers, err := buildContainers(c, sv)
    if err != nil {
        return nil, err
    }
Severity: Minor
Found in pkg/service/helper.go - About 1 hr to fix

    Method manager.runCycle has 57 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (m *manager) runCycle() []error {
        if !m.servicesListHasBeenSet {
            return nil
        }
        // clone the list
    Severity: Minor
    Found in pkg/service/manager.go - About 1 hr to fix

      Function RoutesDetailPage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const RoutesDetailPage = () => {
        const pages = usePages();
        const { routePath } = pages.gateway.useParams();
        const { data, isAllowed, isFetched, noPermissionMessage } = useRoute({
          routePath: routePath ?? "",
      Severity: Minor
      Found in ui/src/pages/namespace/Gateway/Routes/Detail/index.tsx - About 1 hr to fix

        Function initLegacyServer has 13 return statements (exceeds 4 allowed).
        Open

        func initLegacyServer(circuit *core.Circuit, config *core.Config, db *gorm.DB, dbManager *database.SQLStore) (*server, error) {
            srv := new(server)
            srv.ID = uuid.New()
            srv.initJQ()
            srv.config = config
        Severity: Major
        Found in pkg/flow/server.go - About 1 hr to fix

          Method Pubsub.flush has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
          Open

          func (pubsub *Pubsub) flush() {
              slice := pubsub.buffer[:pubsub.bufferIdx]
              clusterMessages := make([]string, pubsub.bufferIdx)
              messageIndex := 0
              pubsub.bufferIdx = 0
          Severity: Minor
          Found in pkg/flow/pubsub/pubsub.go - About 1 hr 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 forEachLogic.processActionResults has 13 return statements (exceeds 4 allowed).
          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 1 hr to fix

            Method instController.getPagination has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
            Open

            func (e *instController) getPagination(r *http.Request) (*paginationOptions, error) {
                opts := new(paginationOptions)
            
                x := r.URL.Query().Get("limit")
                if x != "" {
            Severity: Minor
            Found in pkg/api/instances.go - About 1 hr 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 nsController.update has 13 return statements (exceeds 4 allowed).
            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/api/namespaces.go - About 1 hr to fix

              Method eventsController.registerCoudEvent has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
              Open

              func (c *eventsController) registerCoudEvent(w http.ResponseWriter, r *http.Request) {
                  ns := extractContextNamespace(r)
                  cType := r.Header.Get("Content-type")
                  limit := int64(1024 * 1024 * 32)
              
              
              Severity: Minor
              Found in pkg/api/events.go - About 1 hr 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 RootQuery.CreateFile has 13 return statements (exceeds 4 allowed).
              Open

              func (q *RootQuery) CreateFile(ctx context.Context, path string, typ filestore.FileType, mimeType string, data []byte) (*filestore.File, error) {
                  path, err := filestore.SanitizePath(path)
                  if err != nil {
                      return nil, fmt.Errorf("%w: %w", filestore.ErrInvalidPathParameter, err)
                  }
              Severity: Major
              Found in pkg/filestore/filestoresql/root_query.go - About 1 hr to fix

                Function LoadResource has 13 return statements (exceeds 4 allowed).
                Open

                func LoadResource(data []byte) (interface{}, error) {
                    m := make(map[string]interface{})
                    err := yaml.Unmarshal(data, &m)
                    if err != nil {
                        return nil, fmt.Errorf("%w: %w", ErrNotDirektivAPIResource, err)
                Severity: Major
                Found in pkg/model/resources.go - About 1 hr to fix

                  Method RequestConvertPlugin.Execute has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (rcp *RequestConvertPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
                      response := &RequestConvertResponse{
                          URLParams:   make(map[string]string),
                          QueryParams: make(map[string][]string),
                          Consumer: RequestConsumer{
                  Severity: Minor
                  Found in pkg/gateway/plugins/inbound/request-convert.go - About 1 hr to fix

                    Method engine.handleInstanceMessage has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                    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: Minor
                    Found in pkg/flow/instance_messages.go - About 1 hr to fix

                      Method actionLogic.scheduleAction has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                      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: Minor
                      Found in pkg/flow/states/action.go - About 1 hr to fix

                        Method varController.list has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (e *varController) list(w http.ResponseWriter, r *http.Request) {
                            // handle raw var read.
                            if r.URL.Query().Get("raw") == "true" {
                                e.listRaw(w, r)
                                return
                        Severity: Minor
                        Found in pkg/api/variables.go - About 1 hr to fix

                          Method engine.executor has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (engine *engine) executor(ctx context.Context, id uuid.UUID) {
                              var im *instanceMemory
                          
                              for attempts := range 3 {
                                  if attempts > 0 {
                          Severity: Minor
                          Found in pkg/flow/scheduling.go - About 1 hr to fix

                            Function Breadcrumb has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const Breadcrumb = () => {
                              const pages = usePages();
                              const namespace = useNamespace();
                              const { isExplorerPage } = pages.explorer.useParams();
                              const { isInstancePage } = pages.instances.useParams();
                            Severity: Minor
                            Found in ui/src/components/Breadcrumb/index.tsx - About 1 hr to fix

                              Function ScrollContainer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const ScrollContainer = () => {
                                const {
                                  rowVirtualizer,
                                  parentRef,
                                  logLines,
                              Severity: Minor
                              Found in ui/src/pages/namespace/Monitoring/Logs/Scrollcontainer.tsx - About 1 hr to fix

                                Function Run has 12 return statements (exceeds 4 allowed).
                                Open

                                func Run(circuit *core.Circuit) error {
                                    config := &core.Config{}
                                    if err := env.Parse(config); err != nil {
                                        return fmt.Errorf("parsing env variables: %w", err)
                                    }
                                Severity: Major
                                Found in pkg/flow/server.go - About 1 hr to fix

                                  Method engine.newIsolateRequest has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func (engine *engine) newIsolateRequest(im *instanceMemory, stateID string, timeout int,
                                      fn model.FunctionDefinition, inputData []byte,
                                      uid uuid.UUID, async bool, files []model.FunctionFileDefinition, iterator int,
                                  Severity: Major
                                  Found in pkg/flow/temporary.go - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language