vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Function RoutesPage has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const RoutesPage = () => {
  const { isFetching, refetch } = useRoutes();
  const [search, setSearch] = useState("");
  const { data: routes } = useRoutes();

Severity: Minor
Found in ui/src/pages/namespace/Gateway/Routes/index.tsx - About 1 hr to fix

    Method Workflow.validate has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
    Open

    func (o *Workflow) validate() error {
        if len(o.States) == 0 {
            return errors.New("workflow has no defined states")
        }
    
    
    Severity: Minor
    Found in pkg/model/workflow.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 EventEngine.multiConditionEventAndHandler has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
    Open

    func (ee EventEngine) multiConditionEventAndHandler(l *datastore.EventListener, waitType bool) eventHandler {
        return func(ctx context.Context, events ...*datastore.Event) {
            for _, event := range events {
                if l.Deleted {
                    return // Skip processing for deleted listeners.
    Severity: Minor
    Found in pkg/events/process.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 fsController.updateFile has a Cognitive Complexity of 27 (exceeds 20 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: Minor
    Found in pkg/api/filesystem.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 engine.getInstanceMemory has 60 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (engine *engine) getInstanceMemory(ctx context.Context, id uuid.UUID) (*instanceMemory, error) {
        tx, err := engine.flow.beginSQLTx(ctx, &sql.TxOptions{
            Isolation: sql.LevelSerializable,
        })
        if err != nil {
    Severity: Minor
    Found in pkg/flow/memory.go - About 1 hr to fix

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

        Method events.addInstanceEventListener has 60 lines of code (exceeds 50 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 {
            // var ev []map[string]interface{}
        
            fEv := &datastore.EventListener{
                ID:                     uuid.New(),
        Severity: Minor
        Found in pkg/flow/db-events.go - About 1 hr to fix

          Method varController.listRaw has 60 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (e *varController) listRaw(w http.ResponseWriter, r *http.Request) {
              ns := extractContextNamespace(r)
          
              db, err := e.db.BeginTx(r.Context())
              if err != nil {
          Severity: Minor
          Found in pkg/api/variables.go - About 1 hr to fix

            Method logController.stream has 60 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (m logController) stream(w http.ResponseWriter, r *http.Request) {
                // cursor is set to multiple seconds before the current time to mitigate data loss
                // that may occur due to delays between submitting and processing the request, or when a sequence of client requests is necessary.
                cursor := time.Now().UTC().Add(-time.Second * 3)
            
            
            Severity: Minor
            Found in pkg/api/plattformlogs.go - About 1 hr to fix

              Function RoutesBreadcrumb has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const RoutesBreadcrumb = () => {
                const pages = usePages();
                const namespace = useNamespace();
                const { isGatewayRoutesPage, isGatewayRoutesDetailPage, routePath } =
                  pages.gateway.useParams();
              Severity: Minor
              Found in ui/src/components/Breadcrumb/Gateway/Routes.tsx - About 1 hr to fix

                Function buildEnvVars has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func buildEnvVars(forSidecar bool, c *core.Config, sv *core.ServiceFileData) []corev1.EnvVar {
                    proxyEnvs := []corev1.EnvVar{}
                
                    if len(c.KnativeProxyHTTP) > 0 {
                        proxyEnvs = append(proxyEnvs, corev1.EnvVar{
                Severity: Minor
                Found in pkg/service/helper.go - About 1 hr to fix

                  Function ServicesBreadcrumb has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const ServicesBreadcrumb = () => {
                    const pages = usePages();
                    const namespace = useNamespace();
                    const { isServicePage, isServiceDetailPage, service } =
                      pages.services.useParams();
                  Severity: Minor
                  Found in ui/src/components/Breadcrumb/ServicesBreadcrumb.tsx - About 1 hr to fix

                    Method generateEventLogic.Run has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

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

                      Function buildContainers has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func buildContainers(c *core.Config, sv *core.ServiceFileData) ([]corev1.Container, error) {
                          // set resource limits.
                          rl, err := buildResourceLimits(c, sv)
                          if err != nil {
                              return nil, err
                      Severity: Minor
                      Found in pkg/service/helper.go - About 1 hr to fix

                        Function getLayoutedElements has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const getLayoutedElements = (
                          incomingEles: (Edge | Node)[],
                          orientation: Orientation = "vertical"
                        ) => {
                          const dagreGraph = new dagre.graphlib.Graph();
                        Severity: Minor
                        Found in ui/src/design/WorkflowDiagram/utils.ts - About 1 hr to fix

                          Function recurseIntoString has 14 return statements (exceeds 4 allowed).
                          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 1 hr to fix

                            Function generateActionInput has 14 return statements (exceeds 4 allowed).
                            Open

                            func generateActionInput(ctx context.Context, args *generateActionInputArgs) ([]byte, []model.FunctionFileDefinition, error) {
                                var err error
                                var input interface{}
                            
                                input, err = jqObject(args.Source, "jq(.)") //nolint:contextcheck
                            Severity: Major
                            Found in pkg/flow/states/action-helpers.go - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                      if !(v.MIMEType == "text/plain; charset=utf-8" || v.MIMEType == "text/plain" || v.MIMEType == "application/octet-stream") && (d == "{}" || d == "[]" || d == "0" || d == `""` || d == "null") {
                              Severity: Critical
                              Found in pkg/flow/temporary.go - About 1 hr to fix

                                Function EditorLayoutSwitcher has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const EditorLayoutSwitcher = () => {
                                  const { t } = useTranslation();
                                  const currentLayout = useEditorLayout();
                                  const { setLayout: setCurrentLayout } = useEditorActions();
                                  return (
                                Severity: Minor
                                Found in ui/src/components/EditorLayoutSwitcher/index.tsx - About 1 hr to fix

                                  Function BaseInputTemplate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const BaseInputTemplate = (props: BaseInputTemplateProps) => {
                                    const type = useMemo(() => {
                                      if (props.schema.type === "integer") {
                                        return "number";
                                      } else if (props.type === "file") {
                                  Severity: Minor
                                  Found in ui/src/design/JSONschemaForm/index.tsx - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language