baublet/w8mngr

View on GitHub

Showing 137 of 365 total issues

Function UserPreferences has 246 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function UserPreferences() {
  const { data } = useGetCurrentUserQuery();
  const [loading, setLoading] = React.useState(true);
  const [, setUserPreferences] = React.useState<PreferencesForm>({
    birthday: "",
Severity: Major
Found in client/pages/UserPreferences.tsx - About 1 day to fix

    File Upload.tsx has 484 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import cx from "classnames";
    import React from "react";
    
    import { filterFalsyKeys } from "../../../shared";
    import {
    Severity: Minor
    Found in client/components/Forms/Upload.tsx - About 7 hrs to fix

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

      export async function buildConnectionResolver<TEntity, TNode = TEntity>(
        query: QueryBuilder,
        args: {
          before?: string | null;
          last?: number | null;
      Severity: Major
      Found in api/helpers/buildConnectionResolver/buildConnectionResolver.ts - About 7 hrs to fix

        Function Routes has 177 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function Routes() {
          useVerifyEmail();
          return (
            <div className="relative">
              <div className="toast">
        Severity: Major
        Found in client/Routes.tsx - About 7 hrs to fix

          Function AddableFoodMeasurements has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

          export function AddableFoodMeasurements({
            food,
            saveSelectedFood,
          }: {
            saveSelectedFood: (input: FoodLogInput) => void;
          Severity: Minor
          Found in client/components/Foods/AddableFoodMeasurements.tsx - About 6 hrs 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

          Function up has 143 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function up(knex: Knex): Promise<void> {
            await withSchema(knex).createTable("user", function (table) {
              table.text("id").notNullable().primary();
              table.string("preferredName");
              table.string("legacyPreferences").nullable();
          Severity: Major
          Found in migrations/20211120170020_InitialMigration.ts - About 5 hrs to fix

            Function buildConnectionResolver has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

            export async function buildConnectionResolver<TEntity, TNode = TEntity>(
              query: QueryBuilder,
              args: {
                before?: string | null;
                last?: number | null;
            Severity: Minor
            Found in api/helpers/buildConnectionResolver/buildConnectionResolver.ts - About 5 hrs 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

            File ScannerResults.tsx has 385 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from "react";
            import cx from "classnames";
            
            import {
              GetCurrentUserFoodLogDocument,
            Severity: Minor
            Found in client/components/BarcodeScanner/ScannerResults.tsx - About 5 hrs to fix

              File createDataService.ts has 345 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Knex } from "knex";
              import omit from "lodash.omit";
              import { ulid } from "ulid";
              
              import { assertIsError } from "../../shared";
              Severity: Minor
              Found in api/dataServices/createDataService.ts - About 4 hrs to fix

                File buildConnectionResolver.test.ts has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { Knex } from "knex";
                import { ulid } from "ulid";
                
                import { getConnection } from "../../config/db";
                import { buildConnectionResolver } from "./buildConnectionResolver";
                Severity: Minor
                Found in api/helpers/buildConnectionResolver/buildConnectionResolver.test.ts - About 4 hrs to fix

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

                  export function Home() {
                    const { ratio } = useWindowSize();
                    const splashImage = React.useMemo(() => {
                      if (
                        isWithin({
                  Severity: Major
                  Found in client/pages/Home.tsx - About 4 hrs to fix

                    File seedData.ts has 332 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import "minifaker/locales/en";
                    
                    import addDays from "date-fns/addDays";
                    import subYears from "date-fns/subYears";
                    import knex from "knex";
                    Severity: Minor
                    Found in scripts/seedData.ts - About 4 hrs to fix

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

                      export function Application(): React.ReactComponentElement<any> {
                        // When the URL changes, scroll to the top
                        const { pathname, search } = useLocation();
                        React.useEffect(() => {
                          document.body.scrollTop = 0;
                      Severity: Major
                      Found in client/Application.tsx - About 3 hrs to fix

                        Function Register has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function Register() {
                          const navigate = useNavigateToUrl();
                          const registerForm = useForm<{
                            email: string;
                            password: string;
                        Severity: Major
                        Found in client/pages/Register.tsx - About 3 hrs to fix

                          File MuscleMap.tsx has 306 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import cx from "classnames";
                          import React from "react";
                          
                          import { Muscle } from "../../generated";
                          
                          
                          Severity: Minor
                          Found in client/components/MuscleMap/MuscleMap.tsx - About 3 hrs to fix

                            File FoodListItem.tsx has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import cx from "classnames";
                            import React from "react";
                            import { Link, useHistory } from "react-router-dom";
                            
                            import { or } from "../../../shared";
                            Severity: Minor
                            Found in client/components/Foods/FoodListItem.tsx - About 3 hrs to fix

                              Function Upload has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export function Upload({
                                limit = 1,
                                bodyDrop = true,
                                type = "IMAGE",
                                aspectRatio = "1/1",
                              Severity: Minor
                              Found in client/components/Forms/Upload.tsx - About 3 hrs 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

                              File UserPreferences.tsx has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React from "react";
                              import { boolean, date, number, object, string } from "yup";
                              
                              import { getWithDefault, objectEntries } from "../../shared";
                              import { GhostButton } from "../components/Button/Ghost";
                              Severity: Minor
                              Found in client/pages/UserPreferences.tsx - About 3 hrs to fix

                                Function userActivitySummary has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const userActivitySummary: UserResolvers["activitySummary"] = async (
                                  parent,
                                  args,
                                  context
                                ) => {
                                Severity: Major
                                Found in api/resolvers/user/activitySummary.ts - About 2 hrs to fix

                                  Function ActivityLog has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function ActivityLog() {
                                    const { id, day = "" } = useParams<{ id: string; day: string }>();
                                    const { data, loading } = useGetActivityDetailsQuery({
                                      variables: {
                                        id,
                                  Severity: Major
                                  Found in client/pages/ActivityLog.tsx - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language