GregBrimble/cf-workers-dashboard

View on GitHub

Showing 91 of 91 total issues

File dataCenters.ts has 1458 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export const dataCenters = [
  {
    group: "Africa",
    name: "Antananarivo, Madagascar",
    id: "TNR",
Severity: Major
Found in packages/server/src/lib/dataCenters.ts - About 3 days 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

    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

      Function Settings has 302 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const Settings = forwardRef((props, ref) => {
        const homeMatch = useRouteMatch({
          path: "/",
          exact: true,
        }) as Record<string, any>;
      Severity: Major
      Found in packages/client/src/components/Settings.tsx - About 1 day to fix

        Function Analytics has 286 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Analytics = () => {
          const { workerID: scriptID, accountID } = useParams();
        
          const now = new Date();
          const defaultDateFrom = new Date(now);
        Severity: Major
        Found in packages/client/src/components/workers/Analytics.tsx - About 1 day to fix

          Function Container has 247 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Container = () => {
            const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
            const [profileDropdownOpen, setProfileDropdownOpen] = useState(false);
            const location = useLocation();
          
          
          Severity: Major
          Found in packages/client/src/pages/Container.tsx - About 1 day to fix

            File Analytics.tsx has 436 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { useState } from "react";
            import Plot from "react-plotly.js";
            import { BigStatus } from "../BigStatus";
            import { useQuery, gql } from "@apollo/client";
            import { useParams } from "react-router-dom";
            Severity: Minor
            Found in packages/client/src/components/workers/Analytics.tsx - About 6 hrs 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

                Function Worker has 146 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const Worker: FC = () => {
                  const { workerID: scriptID, accountID } = useParams();
                  const { path, url } = useRouteMatch();
                  const history = useHistory();
                  const location = useLocation();
                Severity: Major
                Found in packages/client/src/pages/Worker.tsx - About 5 hrs to fix

                  Function analyticsToSeries has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const analyticsToSeries = (analytics: any, interval: string) => {
                    const min = {
                      x: [] as Date[],
                      y: [] as number[],
                      type: "scatter",
                  Severity: Major
                  Found in packages/client/src/components/workers/Analytics.tsx - About 5 hrs to fix

                    File analytics.ts has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import gql from "graphql-tag";
                    import {
                      GraphQLResolveInfo,
                      DocumentNode,
                      FieldNode,
                    Severity: Minor
                    Found in packages/server/src/graphql/schema/analytics.ts - About 4 hrs to fix

                      Function Workers has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const Workers: FC<{}> = ({}) => {
                        const { url } = useRouteMatch();
                        const { accountID } = useParams();
                        const { loading, error, data } = useQuery(WORKERS_QUERY, {
                          variables: { accountID },
                      Severity: Major
                      Found in packages/client/src/pages/Workers.tsx - About 3 hrs to fix

                        File Settings.tsx has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React, {
                          useState,
                          forwardRef,
                          useImperativeHandle,
                          createRef,
                        Severity: Minor
                        Found in packages/client/src/components/Settings.tsx - About 3 hrs to fix

                          File ExamplePeek.tsx has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, { useEffect, useState, useReducer } from "react";
                          import Plot from "react-plotly.js";
                          
                          type Location = {
                            location: string;
                          Severity: Minor
                          Found in packages/client/src/components/home/ExamplePeek.tsx - About 2 hrs to fix

                            File Container.tsx has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, { useState, useEffect, useRef, createRef } from "react";
                            import { Transition } from "../components/lib/Transition";
                            import { useWindowKey } from "../hooks/useWindowKey";
                            import { classNames } from "../utils/classNames";
                            import { useMouseOutside } from "../hooks/useMouseOutside";
                            Severity: Minor
                            Found in packages/client/src/pages/Container.tsx - About 2 hrs to fix

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

                                    {
                                      x: [0, 0.25, 0.5, 0.75, 0.9, 0.99, 0.999, 1],
                                      y: [380, 1054, 1535, 1843, 2303.4, 3113.2, 3638.56, 3815].map(
                                        (y) => y / 1000
                                      ),
                              Severity: Major
                              Found in packages/client/src/components/home/ExampleAnalytics.tsx and 1 other location - About 2 hrs to fix
                              packages/client/src/components/home/ExampleAnalytics.tsx on lines 18..26

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

                              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

                                    {
                                      x: [0, 0.25, 0.5, 0.75, 0.9, 0.99, 0.999, 1],
                                      y: [201, 240.2, 609, 2800, 3732, 4678, 4800, 4900].map((y) => y / 1000),
                                      type: "scatter",
                                      name: "error",
                              Severity: Major
                              Found in packages/client/src/components/home/ExampleAnalytics.tsx and 1 other location - About 2 hrs to fix
                              packages/client/src/components/home/ExampleAnalytics.tsx on lines 7..17

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

                              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

                              Function Accounts has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const Accounts: FC<{}> = ({}) => {
                                const { url } = useRouteMatch();
                                const { state: { autoSelect } = { autoSelect: false } } = useLocation();
                                const { loading, error, data } = useQuery(ACCOUNTS_QUERY);
                              
                              
                              Severity: Major
                              Found in packages/client/src/pages/Accounts.tsx - About 2 hrs to fix

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

                                                        <svg
                                                          className={classNames(
                                                            "h-6 w-6",
                                                            mobileMenuOpen ? "hidden" : "block"
                                                          )}
                                Severity: Major
                                Found in packages/client/src/pages/Container.tsx and 1 other location - About 1 hr to fix
                                packages/client/src/pages/Container.tsx on lines 170..185

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

                                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