vorteil/direktiv

View on GitHub
ui/src/pages/namespace/Explorer/Endpoint/index.tsx

Summary

Maintainability
B
4 hrs
Test Coverage

Function EndpointPage has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EndpointPage: FC = () => {
  const pages = usePages();
  const { path } = pages.explorer.useParams();
  const namespace = useNamespace();
  const { segments } = analyzePath(path);
Severity: Major
Found in ui/src/pages/namespace/Explorer/Endpoint/index.tsx - About 2 hrs to fix

    Function EndpointPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const EndpointPage: FC = () => {
      const pages = usePages();
      const { path } = pages.explorer.useParams();
      const namespace = useNamespace();
      const { segments } = analyzePath(path);
    Severity: Minor
    Found in ui/src/pages/namespace/Explorer/Endpoint/index.tsx - About 45 mins 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

    Avoid too many return statements within this function.
    Open

        return (
          <Card className="m-5 flex grow">
            <NoPermissions>{noPermissionMessage}</NoPermissions>
          </Card>
        );
    Severity: Major
    Found in ui/src/pages/namespace/Explorer/Endpoint/index.tsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return (
          <>
            <div className="border-b border-gray-5 bg-gray-1 p-5 dark:border-gray-dark-5 dark:bg-gray-dark-1">
              <div className="flex flex-col gap-5 max-sm:space-y-4 sm:flex-row sm:items-center sm:justify-between">
                <h3 className="flex items-center gap-x-2 font-bold text-primary-500">
      Severity: Major
      Found in ui/src/pages/namespace/Explorer/Endpoint/index.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          if (!isRouteListFetched) return null;
        Severity: Major
        Found in ui/src/pages/namespace/Explorer/Endpoint/index.tsx - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status