vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

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

  await expect(
    page.getByTestId("sync-row").first().getByRole("cell", { name: "failed" }),
    "The sync has failed"
  ).toBeVisible();
Severity: Minor
Found in ui/e2e/mirror.spec.ts and 1 other location - About 35 mins to fix
ui/e2e/mirror.spec.ts on lines 117..123

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

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

  <div className="flex grow flex-col">
    <Header syncId={syncId} />
    <Logs syncId={syncId} />
  </div>
Severity: Minor
Found in ui/src/pages/namespace/Mirror/Detail/Sync/SyncDetail.tsx and 1 other location - About 35 mins to fix
ui/src/pages/namespace/Mirror/Detail/Header/index.tsx on lines 26..29

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

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

          <h3 className="flex items-center gap-x-2 font-bold text-primary-500">
            <Box className="h-5" /> {instance.id.slice(0, 8)}
          </h3>
Severity: Minor
Found in ui/src/pages/namespace/Instances/Detail/Header/index.tsx and 1 other location - About 35 mins to fix
ui/src/pages/namespace/Mirror/Detail/Sync/Header/index.tsx on lines 21..23

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

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

    <Dialog
      open={dialogOpen}
      onOpenChange={(isOpen) => {
        if (isOpen === false) setEditIndex(undefined);
        setDialogOpen(isOpen);
ui/src/pages/namespace/Explorer/Endpoint/EndpointEditor/Form/plugins/Auth/index.tsx on lines 90..239
ui/src/pages/namespace/Explorer/Endpoint/EndpointEditor/Form/plugins/Outbound/index.tsx on lines 62..197
ui/src/pages/namespace/Explorer/Service/ServiceEditor/Form/Patches/index.tsx on lines 56..118

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

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

        <div className="flex grow justify-end gap-4">
          <EditDialog mirror={mirror} />
          <SyncDialog loading={loading} />
        </div>
Severity: Minor
Found in ui/src/pages/namespace/Mirror/Detail/Header/index.tsx and 1 other location - About 35 mins to fix
ui/src/pages/namespace/Mirror/Detail/Sync/SyncDetail.tsx on lines 5..8

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

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.deleteWorkflowEventListeners has 5 return statements (exceeds 4 allowed).
Open

func (events *events) deleteWorkflowEventListeners(ctx context.Context, nsID uuid.UUID, fileID uuid.UUID) error {
    err := events.runSQLTx(ctx, func(tx *database.SQLStore) error {
        ids, err := tx.DataStore().EventListener().DeleteAllForWorkflow(ctx, fileID)
        if err != nil {
            return err
Severity: Major
Found in pkg/flow/db-events.go - About 35 mins to fix

    Method events.deleteInstanceEventListeners has 5 return statements (exceeds 4 allowed).
    Open

    func (events *events) deleteInstanceEventListeners(ctx context.Context, im *instanceMemory) error {
        err := events.runSQLTx(ctx, func(tx *database.SQLStore) error {
            ids, err := tx.DataStore().EventListener().DeleteAllForWorkflow(ctx, im.instance.Instance.ID)
            if err != nil {
                return err
    Severity: Major
    Found in pkg/flow/db-events.go - About 35 mins to fix

      Method delayLogic.Run has 5 return statements (exceeds 4 allowed).
      Open

      func (logic *delayLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
          first, err := scheduleTwiceConst(logic, wakedata, `""`)
          if err != nil {
              return nil, err
          }
      Severity: Major
      Found in pkg/flow/states/delay.go - About 35 mins to fix

        Method FlowVarPlugin.Execute has 5 return statements (exceeds 4 allowed).
        Open

        func (tnv *FlowVarPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
            currentNS := gateway.ExtractContextEndpoint(r).Namespace
            if tnv.Namespace == "" {
                tnv.Namespace = currentNS
            }
        Severity: Major
        Found in pkg/gateway/plugins/target/target-workflow-var.go - About 35 mins to fix

          Method errorLogic.Run has 5 return statements (exceeds 4 allowed).
          Open

          func (logic *errorLogic) 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/error.go - About 35 mins to fix

            Function findProjectRoot has 5 return statements (exceeds 4 allowed).
            Open

            func findProjectRoot(path string) (string, error) {
                fi, err := os.Stat(path)
                if err != nil {
                    return "", err
                }
            Severity: Major
            Found in cmd/exec/cli/utils.go - About 35 mins to fix

              Method Manager.Execute has 5 return statements (exceeds 4 allowed).
              Open

              func (d *Manager) Execute(ctx context.Context, p *datastore.MirrorProcess, m *datastore.MirrorConfig, applyer Applyer) {
                  ctx, cancel := context.WithCancel(ctx)
                  defer func() {
                      cancel()
                      // TODO: find a way to store a separate status 'cancelled' instead of 'error'?
              Severity: Major
              Found in pkg/mirror/manager.go - About 35 mins to fix

                Method KeyAuthPlugin.Execute has 5 return statements (exceeds 4 allowed).
                Open

                func (ka *KeyAuthPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
                    // check request is already authenticated
                    if gateway.ExtractContextActiveConsumer(r) != nil {
                        return r
                    }
                Severity: Major
                Found in pkg/gateway/plugins/auth/key-auth.go - About 35 mins to fix

                  Function getVariables has 5 return statements (exceeds 4 allowed).
                  Open

                  func getVariables(ctx context.Context, flowToken, addr string) (*variablesResponse, int, error) {
                      resp, err := doRequest(ctx, http.MethodGet, flowToken, addr, nil)
                      if err != nil {
                          return nil, resp.StatusCode, err
                      }
                  Severity: Major
                  Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

                    Function getVariableDataViaID has 5 return statements (exceeds 4 allowed).
                    Open

                    func getVariableDataViaID(ctx context.Context, flowToken string, flowAddr string, namespace string, id string) (variable, error) {
                        addr := fmt.Sprintf("http://%v/api/v2/namespaces/%v/variables/%v", flowAddr, namespace, id)
                        client := &http.Client{}
                        req, err := http.NewRequestWithContext(ctx, http.MethodGet, addr, nil)
                        if err != nil {
                    Severity: Major
                    Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

                      Method BasicAuthPlugin.Execute has 5 return statements (exceeds 4 allowed).
                      Open

                      func (ba *BasicAuthPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
                          // check request is already authenticated
                          if gateway.ExtractContextActiveConsumer(r) != nil {
                              return r
                          }
                      Severity: Major
                      Found in pkg/gateway/plugins/auth/basic-auth.go - About 35 mins to fix

                        Method FlowPlugin.Execute has 5 return statements (exceeds 4 allowed).
                        Open

                        func (tf *FlowPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
                            currentNS := gateway.ExtractContextEndpoint(r).Namespace
                            if tf.Namespace == "" {
                                tf.Namespace = currentNS
                            }
                        Severity: Major
                        Found in pkg/gateway/plugins/target/target-workflow.go - About 35 mins to fix

                          Function parseFetchSecretExpressionTwoArgs has 5 return statements (exceeds 4 allowed).
                          Open

                          func parseFetchSecretExpressionTwoArgs(callExpression string) (*fetchSecretArgs, error) {
                              // parse fetchSecret( g1 ) pattern
                              pattern := `^[ ]{0,}fetchSecret[ ]{0,}\((.*)\)[ ]{0,}$`
                              regex := regexp.MustCompile(pattern)
                              matches := regex.FindStringSubmatch(callExpression)
                          Severity: Major
                          Found in pkg/gateway/fetch_secret.go - About 35 mins to fix

                            Function handleResponse has 5 return statements (exceeds 4 allowed).
                            Open

                            func handleResponse(resp *http.Response, next func(resp *http.Response) (int, error)) (int, error) {
                                defer resp.Body.Close()
                            
                                if resp.StatusCode != http.StatusOK {
                                    var apiErrorResp apiError
                            Severity: Major
                            Found in cmd/sidecar/api_v2_clients.go - About 35 mins to fix

                              Method events.addInstanceEventListener has 5 return statements (exceeds 4 allowed).
                              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: Major
                              Found in pkg/flow/db-events.go - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language