vorteil/direktiv

View on GitHub
ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx

Summary

Maintainability
D
1 day
Test Coverage

Function Header has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Header = () => {
  const pages = usePages();
  const namespace = useNamespace();
  const { routePath } = pages.gateway.useParams();
  const { data: route } = useRoute({
Severity: Major
Found in ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx - About 3 hrs to fix

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

              <div className="flex gap-1">
                <MessagesOverlay messages={route.errors} variant="error">
                  {(errorCount) => (
                    <Badge variant="destructive">
                      {t("pages.gateway.routes.row.error.count", {
    Severity: Major
    Found in ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx and 1 other location - About 5 hrs to fix
    ui/src/pages/namespace/Gateway/Routes/Table/Row.tsx 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 153.

    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

            <div className="text-sm">
              <div className="text-gray-10 dark:text-gray-dark-10">
                {t("pages.gateway.routes.columns.anonymous")}
              </div>
              <AllowAnonymous allow={route.allow_anonymous} />
    Severity: Major
    Found in ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx and 2 other locations - About 1 hr to fix
    ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx on lines 61..66
    ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx on lines 67..72

    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

            <div className="text-sm">
              <div className="text-gray-10 dark:text-gray-dark-10">
                {t("pages.gateway.routes.columns.plugins")}
              </div>
              <Plugins plugins={route.plugins} />
    Severity: Major
    Found in ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx and 2 other locations - About 1 hr to fix
    ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx on lines 61..66
    ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx on lines 73..78

    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

            <div className="text-sm">
              <div className="text-gray-10 dark:text-gray-dark-10">
                {t("pages.gateway.routes.columns.methods")}
              </div>
              <Methods methods={route.methods} />
    Severity: Major
    Found in ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx and 2 other locations - About 1 hr to fix
    ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx on lines 67..72
    ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx on lines 73..78

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

            <div className="grow text-sm">
              {route.server_path && <PublicPathInput path={route.server_path} />}
            </div>
    Severity: Minor
    Found in ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx and 1 other location - About 35 mins to fix
    ui/src/pages/namespace/Gateway/Routes/Table/Row.tsx on lines 86..88

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

    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