vorteil/direktiv

View on GitHub
ui/src/pages/namespace/Settings/Secrets/index.tsx

Summary

Maintainability
D
2 days
Test Coverage

Function SecretsList has 183 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SecretsList: FC = () => {
  const { t } = useTranslation();
  const [dialogOpen, setDialogOpen] = useState(false);
  const [deleteSecret, setDeleteSecret] = useState<SecretSchemaType>();
  const [editItem, setEditItem] = useState<SecretSchemaType>();
Severity: Major
Found in ui/src/pages/namespace/Settings/Secrets/index.tsx - About 7 hrs to fix

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

                <div className="mb-4 flex flex-col gap-4 sm:flex-row">
                  <h3 className="flex grow items-center gap-x-2 pb-2 pt-1 font-bold">
                    <SquareAsterisk className="h-5" />
                    {t("pages.settings.secrets.list.title")}
                  </h3>
    Severity: Major
    Found in ui/src/pages/namespace/Settings/Secrets/index.tsx and 2 other locations - About 6 hrs to fix
    ui/src/pages/namespace/Explorer/Workflow/Settings/Variables/index.tsx on lines 87..113
    ui/src/pages/namespace/Settings/Variables/index.tsx on lines 95..117

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

    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

                {totalPages > 1 && (
                  <Pagination>
                    <PaginationLink
                      icon="left"
                      onClick={() => goToPreviousPage()}
    Severity: Major
    Found in ui/src/pages/namespace/Settings/Secrets/index.tsx and 3 other locations - About 5 hrs to fix
    ui/src/pages/namespace/Mirror/Detail/index.tsx on lines 118..135
    ui/src/pages/namespace/Settings/Registries/index.tsx on lines 133..150
    ui/src/pages/namespace/Settings/Variables/index.tsx on lines 151..168

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

    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

      const filteredItems = useMemo(
        () =>
          (secrets?.data ?? [])?.filter(
            (item) => !isSearch || item.name.includes(search)
          ),
    Severity: Major
    Found in ui/src/pages/namespace/Settings/Secrets/index.tsx and 2 other locations - About 1 hr to fix
    ui/src/pages/namespace/Explorer/Workflow/Settings/Variables/index.tsx on lines 53..59
    ui/src/pages/namespace/Settings/Registries/index.tsx on lines 32..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 62.

    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

      useEffect(() => {
        if (dialogOpen === false) {
          setDeleteSecret(undefined);
          setCreateSecret(false);
          setEditItem(undefined);
    Severity: Minor
    Found in ui/src/pages/namespace/Settings/Secrets/index.tsx and 2 other locations - About 35 mins to fix
    ui/src/pages/namespace/Explorer/Workflow/Settings/Variables/index.tsx on lines 63..69
    ui/src/pages/namespace/Settings/Variables/index.tsx on lines 67..73

    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

    There are no issues that match your filters.

    Category
    Status