vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  <StartEndHandle highlight={data.wasExecuted} end>
    <CustomHandle
      type="target"
      position={
        data.orientation === "horizontal" ? Position.Left : Position.Top
Severity: Major
Found in ui/src/design/WorkflowDiagram/nodes.tsx and 1 other location - About 1 hr to fix
ui/src/design/WorkflowDiagram/nodes.tsx on lines 132..140

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          <ConditionalWrapper
            condition={isValidDate}
            wrapper={(children) => (
              <Tooltip>
                <TooltipTrigger>{children}</TooltipTrigger>
Severity: Major
Found in ui/src/pages/namespace/Monitoring/Instances/Row.tsx and 1 other location - About 1 hr to fix
ui/src/pages/namespace/Instances/List/Row.tsx on lines 117..141

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          <ConditionalWrapper
            condition={isValidDate}
            wrapper={(children) => (
              <Tooltip>
                <TooltipTrigger data-testid="tooltip-trigger">
Severity: Major
Found in ui/src/pages/namespace/Instances/List/Row.tsx and 1 other location - About 1 hr to fix
ui/src/pages/namespace/Monitoring/Instances/Row.tsx on lines 81..101

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const useUpdateFile = ({
  onSuccess,
  onError,
}: {
  onSuccess?: () => void;
Severity: Major
Found in ui/src/api/files/mutate/updateFile.ts and 1 other location - About 1 hr to fix
ui/src/api/enterprise/policy/mutate/update.ts on lines 17..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const SecretFormCreateEditSchema = z.object({
  name: z.string().nonempty(),
  data: z.string().nonempty(),
});
Severity: Major
Found in ui/src/api/secrets/schema.ts and 1 other location - About 1 hr to fix
ui/src/api/events/schema/index.ts on lines 50..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  test("empyt string", () => {
    expect(analyzePath("")).toEqual({
      path: null,
      isRoot: true,
      parent: null,
Severity: Minor
Found in ui/src/util/router/__tests___/utils.test.ts and 1 other location - About 55 mins to fix
ui/src/util/router/__tests___/utils.test.ts on lines 23..30

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          <Card className="flex flex-col gap-y-6">
            <ServicesTable
              services={serviceList?.data ?? []}
              isSuccess={isSuccess}
              setRebuildService={setRebuildService}
ui/src/pages/namespace/Services/List/index.tsx on lines 51..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  test("/", () => {
    expect(analyzePath("/")).toEqual({
      path: null,
      isRoot: true,
      parent: null,
Severity: Minor
Found in ui/src/util/router/__tests___/utils.test.ts and 1 other location - About 55 mins to fix
ui/src/util/router/__tests___/utils.test.ts on lines 14..21

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  await createFile({
    name: parentWorkflowName,
    namespace,
    type: "workflow",
    yaml: parentWorkflowContent({
Severity: Minor
Found in ui/e2e/instances/filter/index.spec.ts and 1 other location - About 55 mins to fix
ui/e2e/instances/list/index.spec.ts on lines 332..340

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        <Card>
          <ServicesTable
            services={serviceList?.data ?? []}
            isSuccess={isSuccess}
            setRebuildService={setRebuildService}
Severity: Minor
Found in ui/src/pages/namespace/Services/List/index.tsx and 1 other location - About 55 mins to fix
ui/src/pages/namespace/Explorer/Workflow/Services/ServicesList.tsx on lines 47..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  await createFile({
    name: parentWorkflow,
    namespace,
    type: "workflow",
    yaml: parentWorkflowContent({
Severity: Minor
Found in ui/e2e/instances/list/index.spec.ts and 1 other location - About 55 mins to fix
ui/e2e/instances/filter/index.spec.ts on lines 53..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

            Similar blocks of code found in 11 locations. Consider refactoring.
            Open

            func (o *SetterState) getTransitions() map[string]string {
                transitions := make(map[string]string)
                if o.Transition != "" {
                    transitions["transition"] = o.Transition
                }
            Severity: Major
            Found in pkg/model/state-setter.go and 10 other locations - About 55 mins to fix
            pkg/model/state-action.go on lines 21..34
            pkg/model/state-consume.go on lines 20..33
            pkg/model/state-delay.go on lines 19..32
            pkg/model/state-events-and.go on lines 20..33
            pkg/model/state-foreach.go on lines 23..36
            pkg/model/state-generate-event.go on lines 44..57
            pkg/model/state-getter.go on lines 50..63
            pkg/model/state-noop.go on lines 17..30
            pkg/model/state-parallel.go on lines 21..34
            pkg/model/state-validate.go on lines 22..35

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 125.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 11 locations. Consider refactoring.
            Open

            func (o *DelayState) getTransitions() map[string]string {
                transitions := make(map[string]string)
                if o.Transition != "" {
                    transitions["transition"] = o.Transition
                }
            Severity: Major
            Found in pkg/model/state-delay.go and 10 other locations - About 55 mins to fix
            pkg/model/state-action.go on lines 21..34
            pkg/model/state-consume.go on lines 20..33
            pkg/model/state-events-and.go on lines 20..33
            pkg/model/state-foreach.go on lines 23..36
            pkg/model/state-generate-event.go on lines 44..57
            pkg/model/state-getter.go on lines 50..63
            pkg/model/state-noop.go on lines 17..30
            pkg/model/state-parallel.go on lines 21..34
            pkg/model/state-setter.go on lines 101..114
            pkg/model/state-validate.go on lines 22..35

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 125.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language