vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

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

      <div className="flex flex-col gap-4 sm:flex-row">
        <h3 className="flex grow items-center gap-x-2 pb-1 font-bold">
          <Boxes className="h-5" />
          {t("pages.instances.list.title")}
        </h3>
Severity: Major
Found in ui/src/pages/namespace/Instances/List/index.tsx and 1 other location - About 1 hr to fix
ui/src/pages/namespace/Settings/DeleteNamespace/index.tsx on lines 17..22

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

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("page 1 / 11", () => {
      const pagination = describePagination({ pages: 11, currentPage: 1 });
      expect(pagination).toStrictEqual([1, 2, "…", 10, 11]);
    });
ui/src/components/Pagination/__tests__/describePagination.test.ts on lines 45..48

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

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 EventListenersResponseSchema = z.object({
  meta: z.object({
    total: z.number(),
  }),
  data: z.array(EventListenerSchema),
Severity: Major
Found in ui/src/api/eventListeners/schema.ts and 1 other location - About 1 hr to fix
ui/src/api/instances/schema.ts on lines 109..114

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

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("page 11 / 11", () => {
      const pagination = describePagination({ pages: 11, currentPage: 11 });
      expect(pagination).toStrictEqual([1, 2, "…", 10, 11]);
    });
ui/src/components/Pagination/__tests__/describePagination.test.ts on lines 7..10

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

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.enqueueInstanceMessage has 51 lines of code (exceeds 50 allowed). Consider refactoring.
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: Minor
Found in pkg/flow/instance_messages.go - About 1 hr to fix

    Function Navigation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Navigation: FC = () => {
      const pages = usePages();
      const namespace = useNamespace();
      const { t } = useTranslation();
      const [, secondPathLevel] = useMatches();
    Severity: Minor
    Found in ui/src/components/Navigation/index.tsx - About 1 hr to fix

      Function PermissionsBreadcrumb has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const PermissionsBreadcrumb = () => {
        const pages = usePages();
        const namespace = useNamespace();
        const { t } = useTranslation();
      
      
      Severity: Minor
      Found in ui/src/components/Breadcrumb/Permissions/index.tsx - About 1 hr to fix

        Function getErrorComponent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const getErrorComponent = () => {
            if (!workflowPath) {
              return (
                <VariablePickerError>
                  {t("components.workflowVariablepicker.error.unselected")}
        Severity: Minor
        Found in ui/src/components/WorkflowVariablepicker/index.tsx - About 1 hr to fix

          Method setterLogic.Run has 10 return statements (exceeds 4 allowed).
          Open

          func (logic *setterLogic) 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/setter.go - About 1 hr to fix

            Method fsController.updateFile has 10 return statements (exceeds 4 allowed).
            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: Major
            Found in pkg/api/filesystem.go - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                if (value.states) {
                  for (let i = 0; i < value.states.length; i++) {
                    let transitions = false;
                    // check if starting element
                    if (i === 0) {
              Severity: Major
              Found in ui/src/design/WorkflowDiagram/utils.ts - About 1 hr to fix

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

                func reconcileCreate(src []Item, target []Item) []string {
                    result := []string{}
                
                    keys := map[string]bool{}
                    for _, item := range target {
                Severity: Major
                Found in pkg/reconcile/reconcile.go and 1 other location - About 1 hr to fix
                pkg/reconcile/reconcile.go on lines 23..38

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

                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 reconcileDelete(src []Item, target []Item) []string {
                    result := []string{}
                    search := map[string]bool{}
                    for _, item := range src {
                        search[item.GetID()] = true
                Severity: Major
                Found in pkg/reconcile/reconcile.go and 1 other location - About 1 hr to fix
                pkg/reconcile/reconcile.go on lines 40..56

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

                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 useUpdatePolicy = ({
                  onSuccess,
                  onError,
                }: {
                  onSuccess?: () => void;
                Severity: Major
                Found in ui/src/api/enterprise/policy/mutate/update.ts and 1 other location - About 1 hr to fix
                ui/src/api/files/mutate/updateFile.ts on lines 11..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 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

                    <TooltipContent
                      data-testid="tooltip-copy-content"
                      className="flex gap-2 align-middle"
                    >
                      {value}
                Severity: Major
                Found in ui/src/design/TooltipCopyBadge/index.tsx and 1 other location - About 1 hr to fix
                ui/src/pages/namespace/Events/Listeners/Row.tsx on lines 83..94

                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

                  <StartEndHandle highlight={data.wasExecuted}>
                    <CustomHandle
                      type="source"
                      position={
                        data.orientation === "horizontal" ? Position.Right : Position.Bottom
                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 144..152

                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

                            <TooltipContent>
                              {eventTypes}
                              <CopyButton
                                value={eventTypes}
                                buttonProps={{
                Severity: Major
                Found in ui/src/pages/namespace/Events/Listeners/Row.tsx and 1 other location - About 1 hr to fix
                ui/src/design/TooltipCopyBadge/index.tsx on lines 16..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 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

                        {!isNew && storedValue === "keep-token" && (
                          <SelectItem
                            value="keep-token"
                            onClick={() => onValueChange("keep-token")}
                          >
                Severity: Major
                Found in ui/src/components/NamespaceEdit/FormTypeSelect.tsx and 1 other location - About 1 hr to fix
                ui/src/components/NamespaceEdit/FormTypeSelect.tsx on lines 41..48

                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

                        {!isNew && storedValue === "keep-ssh" && (
                          <SelectItem
                            value="keep-ssh"
                            onClick={() => onValueChange("keep-ssh")}
                          >
                Severity: Major
                Found in ui/src/components/NamespaceEdit/FormTypeSelect.tsx and 1 other location - About 1 hr to fix
                ui/src/components/NamespaceEdit/FormTypeSelect.tsx on lines 33..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 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 MetaData = z.object({
                  previousPage: z.string().nullable(),
                  startingFrom: z.string().nullable(),
                });
                Severity: Major
                Found in ui/src/api/events/schema/index.ts and 1 other location - About 1 hr to fix
                ui/src/api/secrets/schema.ts on lines 40..43

                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

                Severity
                Category
                Status
                Source
                Language