vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

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

func (o *Workflow) unmState(state interface{}, sIndex int) error {
    stateMap, stateType, err := processInterfaceMap(state)
    if err != nil {
        return fmt.Errorf("state[%d]: %w", sIndex, err)
    }
Severity: Major
Found in pkg/model/workflow.go and 1 other location - About 1 hr to fix
pkg/model/workflow.go on lines 149..172

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

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

func (s *sqlRuntimeVariablesStore) GetByID(ctx context.Context, id uuid.UUID) (*datastore.RuntimeVariable, error) {
    variable := &datastore.RuntimeVariable{}
    res := s.db.WithContext(ctx).Raw(`
                            SELECT 
                                id, namespace, workflow_path, instance_id, 
Severity: Major
Found in pkg/datastore/datastoresql/runtime_variables.go and 1 other location - About 1 hr to fix
pkg/datastore/datastoresql/namespaces.go on lines 19..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 158.

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

func (q *RootQuery) ListDirektivFilesWithData(ctx context.Context) ([]*filestore.File, error) {
    var list []*filestore.File

    // check if root exists.
    if err := q.checkRootExists(ctx); err != nil {
Severity: Major
Found in pkg/filestore/filestoresql/root_query.go and 1 other location - About 1 hr to fix
pkg/filestore/filestoresql/root_query.go on lines 33..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 158.

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

func (o *Workflow) unmFunction(state interface{}, fIndex int) error {
    fMap, fType, err := processInterfaceMap(state)
    if err != nil {
        return fmt.Errorf("function[%d]: %w", fIndex, err)
    }
Severity: Major
Found in pkg/model/workflow.go and 1 other location - About 1 hr to fix
pkg/model/workflow.go on lines 124..147

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

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

func (s *sqlNamespacesStore) GetByID(ctx context.Context, id uuid.UUID) (*datastore.Namespace, error) {
    namespace := &datastore.Namespace{}
    res := s.db.WithContext(ctx).Raw(`
                            SELECT id, name, created_at, updated_at 
                            FROM namespaces 
Severity: Major
Found in pkg/datastore/datastoresql/namespaces.go and 1 other location - About 1 hr to fix
pkg/datastore/datastoresql/runtime_variables.go on lines 94..111

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

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

func (q *RootQuery) ListAllFiles(ctx context.Context) ([]*filestore.File, error) {
    var list []*filestore.File

    // check if root exists.
    if err := q.checkRootExists(ctx); err != nil {
Severity: Major
Found in pkg/filestore/filestoresql/root_query.go and 1 other location - About 1 hr to fix
pkg/filestore/filestoresql/root_query.go on lines 55..74

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

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

    await waitFor(() => {
      expect(result.current.isSuccess).toBe(true);
      expect(result.current.data?.response).toBe("this works");
    });
Severity: Major
Found in ui/src/api/__tests__/apiFactory.test.ts and 2 other locations - About 1 hr to fix
ui/src/api/__tests__/apiFactory.test.ts on lines 373..376
ui/src/api/__tests__/apiFactory.test.ts on lines 436..439

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

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

    await waitFor(() => {
      expect(result.current.isSuccess).toBe(true);
      expect(result.current.data?.my).toBe("custom header");
    });
Severity: Major
Found in ui/src/api/__tests__/apiFactory.test.ts and 2 other locations - About 1 hr to fix
ui/src/api/__tests__/apiFactory.test.ts on lines 195..198
ui/src/api/__tests__/apiFactory.test.ts on lines 373..376

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

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

    await waitFor(() => {
      expect(result.current.isSuccess).toBe(true);
      expect(result.current.data?.response).toBe("dynamic segment this works");
    });
Severity: Major
Found in ui/src/api/__tests__/apiFactory.test.ts and 2 other locations - About 1 hr to fix
ui/src/api/__tests__/apiFactory.test.ts on lines 195..198
ui/src/api/__tests__/apiFactory.test.ts on lines 436..439

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

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 Workflow.validate has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (o *Workflow) validate() error {
    if len(o.States) == 0 {
        return errors.New("workflow has no defined states")
    }

Severity: Minor
Found in pkg/model/workflow.go - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

func (ee EventEngine) multiConditionEventAndHandler(l *datastore.EventListener, waitType bool) eventHandler {
    return func(ctx context.Context, events ...*datastore.Event) {
        for _, event := range events {
            if l.Deleted {
                return // Skip processing for deleted listeners.
Severity: Minor
Found in pkg/events/process.go - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

func (e *fsController) updateFile(w http.ResponseWriter, r *http.Request) {
    ns := extractContextNamespace(r)

    db, err := e.db.BeginTx(r.Context())
    if err != nil {
Severity: Minor
Found in pkg/api/filesystem.go - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

func (e *registryController) delete(w http.ResponseWriter, r *http.Request) {
    ns := extractContextNamespace(r)
    id := chi.URLParam(r, "id")

    err := e.manager.DeleteRegistry(ns.Name, id)
Severity: Major
Found in pkg/api/registries.go and 1 other location - About 1 hr to fix
pkg/api/services.go on lines 60..80

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

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

func (e *serviceController) rebuild(w http.ResponseWriter, r *http.Request) {
    ns := extractContextNamespace(r)
    serviceID := chi.URLParam(r, "serviceID")

    err := e.manager.Rebuild(ns.Name, serviceID)
Severity: Major
Found in pkg/api/services.go and 1 other location - About 1 hr to fix
pkg/api/registries.go on lines 39..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 155.

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.getInstanceMemory has 60 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    Method instanceMemory.SetVariables has 60 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (im *instanceMemory) SetVariables(ctx context.Context, vars []states.VariableSetter) error {
        tx, err := im.engine.flow.beginSQLTx(ctx)
        if err != nil {
            return err
        }
    Severity: Minor
    Found in pkg/flow/temporary.go - About 1 hr to fix

      Method events.addInstanceEventListener has 60 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (events *events) addInstanceEventListener(ctx context.Context, namespace uuid.UUID, nsName string, instance uuid.UUID, sevents []*model.ConsumeEventDefinition, all bool) error {
          // var ev []map[string]interface{}
      
          fEv := &datastore.EventListener{
              ID:                     uuid.New(),
      Severity: Minor
      Found in pkg/flow/db-events.go - About 1 hr to fix

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

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

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

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

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

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