GregBrimble/cf-workers-dashboard

View on GitHub
packages/client/src/pages/Home.tsx

Summary

Maintainability
F
1 wk
Test Coverage

Function Home has 405 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Home = () => {
  const { hasToken, hasKey } = useSettings();

  if (hasKey || hasToken) return <Redirect to="/accounts" />;

Severity: Major
Found in packages/client/src/pages/Home.tsx - About 2 days to fix

    File Home.tsx has 413 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from "react";
    import { Link, Redirect } from "react-router-dom";
    import { ExampleEditor } from "../components/home/ExampleEditor";
    import { ExampleAnalytics } from "../components/home/ExampleAnalytics";
    import { ExamplePeek } from "../components/home/ExamplePeek";
    Severity: Minor
    Found in packages/client/src/pages/Home.tsx - About 5 hrs to fix

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

                        <div className="lg:col-start-2">
                          <h4 className="text-2xl leading-8 font-extrabold text-gray-900 tracking-tight sm:text-3xl sm:leading-9">
                            WebSockets
                          </h4>
                          <p className="mt-3 text-lg leading-7 text-gray-500">
      Severity: Major
      Found in packages/client/src/pages/Home.tsx and 1 other location - About 2 days to fix
      packages/client/src/pages/Home.tsx on lines 144..212

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

      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="lg:col-start-2">
                          <h4 className="text-2xl leading-8 font-extrabold text-gray-900 tracking-tight sm:text-3xl sm:leading-9">
                            Editor
                          </h4>
                          <p className="mt-3 text-lg leading-7 text-gray-500">
      Severity: Major
      Found in packages/client/src/pages/Home.tsx and 1 other location - About 2 days to fix
      packages/client/src/pages/Home.tsx on lines 330..399

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

      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="mt-8 flex lg:flex-shrink-0 lg:mt-0">
                    <div className="ml-3 inline-flex rounded-md shadow">
                      <a
                        href="/accounts"
                        className="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out"
      Severity: Major
      Found in packages/client/src/pages/Home.tsx and 1 other location - About 1 hr to fix
      packages/client/src/pages/Workers.tsx on lines 35..44

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

      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