vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

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

export const serializeConsumerFile = (yaml: string): SerializeReturnType => {
  const json = yamlToJsonOrNull(yaml);

  const jsonParsed = ConsumerFormSchema.safeParse(json);
  if (jsonParsed.success) {
ui/src/pages/namespace/Explorer/Endpoint/EndpointEditor/utils.ts on lines 10..19
ui/src/pages/namespace/Explorer/Service/ServiceEditor/utils.ts on lines 10..19

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 83.

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 3 locations. Consider refactoring.
Open

export const serializeServiceFile = (yaml: string): SerializeReturnType => {
  const json = yamlToJsonOrNull(yaml);

  const jsonParsed = ServiceFormSchema.safeParse(json);
  if (jsonParsed.success) {
ui/src/pages/namespace/Explorer/Consumer/ConsumerEditor/utils.ts on lines 10..19
ui/src/pages/namespace/Explorer/Endpoint/EndpointEditor/utils.ts on lines 10..19

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 83.

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 3 locations. Consider refactoring.
Open

export const serializeEndpointFile = (yaml: string): SerializeReturnType => {
  const json = yamlToJsonOrNull(yaml);

  const jsonParsed = EndpointFormSchema.safeParse(json);
  if (jsonParsed.success) {
ui/src/pages/namespace/Explorer/Consumer/ConsumerEditor/utils.ts on lines 10..19
ui/src/pages/namespace/Explorer/Service/ServiceEditor/utils.ts on lines 10..19

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 83.

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 Promise.all(
    groups.map(async (group, index) => {
      await expect(
        page
          .locator("fieldset")
Severity: Major
Found in ui/e2e/explorer/consumer/index.spec.ts and 1 other location - About 2 hrs to fix
ui/e2e/explorer/consumer/index.spec.ts on lines 144..154

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 83.

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 Promise.all(
    tags.map(async (group, index) => {
      await expect(
        page
          .locator("fieldset")
Severity: Major
Found in ui/e2e/explorer/consumer/index.spec.ts and 1 other location - About 2 hrs to fix
ui/e2e/explorer/consumer/index.spec.ts on lines 132..142

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 83.

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

    <TableCell>
      <div data-testid="consumer-groups" className="flex flex-wrap gap-1">
        {consumer.groups?.map((group) => (
          <Badge key={group} variant="outline">
            {group}
Severity: Major
Found in ui/src/pages/namespace/Gateway/Consumers/Table/Row/index.tsx and 1 other location - About 2 hrs to fix
ui/src/pages/namespace/Gateway/Consumers/Table/Row/index.tsx on lines 32..40

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 82.

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

    <TableCell>
      <div data-testid="consumer-tags" className="flex flex-wrap gap-1">
        {consumer.tags?.map((tag) => (
          <Badge key={tag} variant="outline">
            {tag}
Severity: Major
Found in ui/src/pages/namespace/Gateway/Consumers/Table/Row/index.tsx and 1 other location - About 2 hrs to fix
ui/src/pages/namespace/Gateway/Consumers/Table/Row/index.tsx on lines 23..31

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 82.

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

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

import { createNamespace, deleteNamespace } from "../utils/namespace";
import { expect, test } from "@playwright/test";

import { createRegistries } from "../utils/registries";
import { createSecrets } from "../utils/secrets";
Severity: Minor
Found in ui/e2e/settings/index.spec.ts - About 2 hrs to fix

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

    export const getServices = apiFactory({
      url: ({ namespace, baseUrl }: { baseUrl?: string; namespace: string }) =>
        `${baseUrl ?? ""}/api/v2/namespaces/${namespace}/services`,
      method: "GET",
      schema: ServicesListSchema,
    Severity: Major
    Found in ui/src/api/services/query/services.ts and 3 other locations - About 2 hrs to fix
    ui/src/api/gateway/query/getConsumers.ts on lines 9..14
    ui/src/api/gateway/query/getRoutes.ts on lines 11..16
    ui/src/api/variables/mutate/create.ts on lines 16..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 81.

    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 4 locations. Consider refactoring.
    Open

    export const getConsumers = apiFactory({
      url: ({ baseUrl, namespace }: { baseUrl?: string; namespace: string }) =>
        `${baseUrl ?? ""}/api/v2/namespaces/${namespace}/gateway/consumers`,
      method: "GET",
      schema: ConsumersListSchema,
    Severity: Major
    Found in ui/src/api/gateway/query/getConsumers.ts and 3 other locations - About 2 hrs to fix
    ui/src/api/gateway/query/getRoutes.ts on lines 11..16
    ui/src/api/services/query/services.ts on lines 11..16
    ui/src/api/variables/mutate/create.ts on lines 16..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 81.

    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 4 locations. Consider refactoring.
    Open

    export const getRoutes = apiFactory({
      url: ({ baseUrl, namespace }: { baseUrl?: string; namespace: string }) =>
        `${baseUrl ?? ""}/api/v2/namespaces/${namespace}/gateway/routes`,
      method: "GET",
      schema: RoutesListSchema,
    Severity: Major
    Found in ui/src/api/gateway/query/getRoutes.ts and 3 other locations - About 2 hrs to fix
    ui/src/api/gateway/query/getConsumers.ts on lines 9..14
    ui/src/api/services/query/services.ts on lines 11..16
    ui/src/api/variables/mutate/create.ts on lines 16..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 81.

    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 4 locations. Consider refactoring.
    Open

    export const createVar = apiFactory({
      url: ({ baseUrl, namespace }: { baseUrl?: string; namespace: string }) =>
        `${baseUrl ?? ""}/api/v2/namespaces/${namespace}/variables`,
      method: "POST",
      schema: VarCreatedUpdatedSchema,
    Severity: Major
    Found in ui/src/api/variables/mutate/create.ts and 3 other locations - About 2 hrs to fix
    ui/src/api/gateway/query/getConsumers.ts on lines 9..14
    ui/src/api/gateway/query/getRoutes.ts on lines 11..16
    ui/src/api/services/query/services.ts on lines 11..16

    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 81.

    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

              {(service.conditions ?? []).map((condition) => (
                <StatusBadge
                  key={condition.type}
                  status={condition.status}
                  message={condition.message}
    Severity: Major
    Found in ui/src/pages/namespace/Services/Detail/Header.tsx and 1 other location - About 2 hrs to fix
    ui/src/pages/namespace/Services/List/Row/index.tsx on lines 90..99

    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 81.

    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

                  {(service.conditions ?? []).map((condition) => (
                    <StatusBadge
                      key={condition.type}
                      status={condition.status}
                      message={condition.message}
    Severity: Major
    Found in ui/src/pages/namespace/Services/List/Row/index.tsx and 1 other location - About 2 hrs to fix
    ui/src/pages/namespace/Services/Detail/Header.tsx on lines 99..108

    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 81.

    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 engine.Transition has 82 lines of code (exceeds 50 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: Major
    Found in pkg/flow/engine.go - About 2 hrs to fix

      Function EndpointPage has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const EndpointPage: FC = () => {
        const pages = usePages();
        const { path } = pages.explorer.useParams();
        const namespace = useNamespace();
        const { segments } = analyzePath(path);
      Severity: Major
      Found in ui/src/pages/namespace/Explorer/Endpoint/index.tsx - About 2 hrs to fix

        Function JqState has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
        Open

        func JqState(l *lexer.L) lexer.StateFunc {
            src := make([]string, 3)
            var jdxJ int
        
            mover := func(rewind int, forward bool) {
        Severity: Minor
        Found in pkg/jqer/jqer.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 events.handleEvent has 81 lines of code (exceeds 50 allowed). Consider refactoring.
        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 2 hrs to fix

          Method getterLogic.Run has 81 lines of code (exceeds 50 allowed). Consider refactoring.
          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 2 hrs to fix

            Method instController.getPagination has 81 lines of code (exceeds 50 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: Major
            Found in pkg/api/instances.go - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language