vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

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

const apiPost = apiFactory({
  url: () => apiEndpointPost,
  method: "POST",
  schema: z.object({
    body: z.string(),
Severity: Major
Found in ui/src/api/__tests__/apiFactory.test.ts and 4 other locations - About 50 mins to fix
ui/src/api/__tests__/apiFactory.test.ts on lines 103..109
ui/src/api/__tests__/apiFactory.test.ts on lines 125..129
ui/src/api/__tests__/apiFactory.test.ts on lines 131..137
ui/src/api/__tests__/apiFactory.test.ts on lines 139..145

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

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

const textResponse = apiFactory({
  url: () => apiEndpointTextResponse,
  method: "GET",
  schema: z.object({ body: z.string() }),
});
Severity: Major
Found in ui/src/api/__tests__/apiFactory.test.ts and 4 other locations - About 50 mins to fix
ui/src/api/__tests__/apiFactory.test.ts on lines 103..109
ui/src/api/__tests__/apiFactory.test.ts on lines 131..137
ui/src/api/__tests__/apiFactory.test.ts on lines 139..145
ui/src/api/__tests__/apiFactory.test.ts on lines 147..153

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

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

  test("it must detect javascript", () => {
    expect(mimeTypeToEditorSyntax("application/javascript")).toBe("javascript");
    expect(mimeTypeToEditorSyntax("text/javascript")).toBe("javascript");
  });
Severity: Major
Found in ui/src/design/Editor/__tests__/utils.test.ts and 2 other locations - About 50 mins to fix
ui/src/design/Editor/__tests__/utils.test.ts on lines 18..21
ui/src/design/Editor/__tests__/utils.test.ts on lines 23..26

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

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.error && (
                <StatusBadge
                  status="False"
                  className="w-fit"
                  message={service.error}
Severity: Minor
Found in ui/src/pages/namespace/Services/List/Row/index.tsx and 1 other location - About 50 mins to fix
ui/src/pages/namespace/Services/Detail/Header.tsx on lines 90..98

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

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

  test("it must detect shell", () => {
    expect(mimeTypeToEditorSyntax("application/x-sh")).toBe("shell");
    expect(mimeTypeToEditorSyntax("application/x-csh")).toBe("shell");
  });
Severity: Major
Found in ui/src/design/Editor/__tests__/utils.test.ts and 2 other locations - About 50 mins to fix
ui/src/design/Editor/__tests__/utils.test.ts on lines 23..26
ui/src/design/Editor/__tests__/utils.test.ts on lines 28..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 51.

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

  test("it must detect plaintext", () => {
    expect(mimeTypeToEditorSyntax("text/")).toBe("plaintext");
    expect(mimeTypeToEditorSyntax("text/whatever")).toBe("plaintext");
  });
Severity: Major
Found in ui/src/design/Editor/__tests__/utils.test.ts and 2 other locations - About 50 mins to fix
ui/src/design/Editor/__tests__/utils.test.ts on lines 18..21
ui/src/design/Editor/__tests__/utils.test.ts on lines 28..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 51.

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

        {selectedPlugin === authPluginTypes.keyAuth.name && (
          <KeyAuthForm
            formId={formId}
            defaultConfig={getKeyAuthConfigAtIndex(fields, editIndex)}
            onSubmit={handleSubmit}
ui/src/pages/namespace/Explorer/Endpoint/EndpointEditor/Form/plugins/Auth/index.tsx on lines 208..214

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

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

        {selectedPlugin === authPluginTypes.basicAuth.name && (
          <BasicAuthForm
            formId={formId}
            defaultConfig={getBasicAuthConfigAtIndex(fields, editIndex)}
            onSubmit={handleSubmit}
ui/src/pages/namespace/Explorer/Endpoint/EndpointEditor/Form/plugins/Auth/index.tsx on lines 215..221

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

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.error && (
            <StatusBadge
              status="False"
              className="w-fit"
              message={service.error}
Severity: Minor
Found in ui/src/pages/namespace/Services/Detail/Header.tsx and 1 other location - About 50 mins to fix
ui/src/pages/namespace/Services/List/Row/index.tsx on lines 81..89

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

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 events.handleEvent has a Cognitive Complexity of 23 (exceeds 20 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: Minor
Found in pkg/flow/events.go - About 45 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

Function patchVarData has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

func patchVarData(ctx context.Context, flowToken string, flowAddr string, namespace string, id string, body datastore.RuntimeVariablePatch) (int, error) {
Severity: Minor
Found in cmd/sidecar/api_v2_clients.go - About 45 mins to fix

    Method engine.NewInstance has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
    Open

    func (engine *engine) NewInstance(ctx context.Context, args *newInstanceArgs) (*instanceMemory, error) {
        ctx = tracing.AddInstanceAttr(ctx, tracing.InstanceAttributes{
            Namespace:    args.Namespace.Name,
            InstanceID:   args.ID.String(),
            Invoker:      args.Invoker,
    Severity: Minor
    Found in pkg/flow/engine.go - About 45 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 JSOutboundPlugin.Execute has 7 return statements (exceeds 4 allowed).
    Open

    func (js *JSOutboundPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
        var (
            err error
            b   []byte
        )
    Severity: Major
    Found in pkg/gateway/plugins/outbound/js_outbound.go - About 45 mins to fix

      Method engine.enqueueInstanceMessage has 7 return statements (exceeds 4 allowed).
      Open

      func (engine *engine) enqueueInstanceMessage(ctx context.Context, id uuid.UUID, kind string, data interface{}) error {
          // TODO: should this add state and step data? At some point these fields died so I have removed them.
          payload, err := json.Marshal(map[string]interface{}{
              "type": kind,
              "data": data,
      Severity: Major
      Found in pkg/flow/instance_messages.go - About 45 mins to fix

        Function renderStartEventListener has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func renderStartEventListener(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, ms *muxStart, tx *database.SQLStore) error {
        Severity: Minor
        Found in pkg/flow/db-events.go - About 45 mins to fix

          Method events.addInstanceEventListener has 6 arguments (exceeds 4 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 {
          Severity: Minor
          Found in pkg/flow/db-events.go - About 45 mins to fix

            Method forEachLogic.Run has 7 return statements (exceeds 4 allowed).
            Open

            func (logic *forEachLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
                // first schedule
                if len(wakedata) == 0 {
                    err := noMemory(logic)
                    if err != nil {
            Severity: Major
            Found in pkg/flow/states/foreach.go - About 45 mins to fix

              Method instanceMemory.SetVariables has 7 return statements (exceeds 4 allowed).
              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: Major
              Found in pkg/flow/temporary.go - About 45 mins to fix

                Method Manager.gc has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                Open

                func (d *Manager) gc() {
                    ctx := context.Background()
                
                    jitter := 1000
                    interval := time.Second * 10
                Severity: Minor
                Found in pkg/mirror/manager.go - About 45 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 eventsXorLogic.Run has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                Open

                func (logic *eventsXorLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
                    first, err := scheduleTwice(logic, wakedata)
                    if err != nil {
                        return nil, err
                    }
                Severity: Minor
                Found in pkg/flow/states/eventsXor.go - About 45 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

                Severity
                Category
                Status
                Source
                Language