baublet/w8mngr

View on GitHub

Showing 365 of 365 total issues

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

    if (element) {
      element.addEventListener("drop", onDrop);
      for (const event of allWatchEvents) {
        element.addEventListener(event, onAllDragEventsFunction);
      }
Severity: Major
Found in client/components/Forms/Upload.tsx and 1 other location - About 2 hrs to fix
client/components/Forms/Upload.tsx on lines 237..248

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

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

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

                          <div className="w-1/3">
                            <Input
                              className="w-full"
                              disabled={!preferencesForm.getValue("faturdays")}
                              label="Carbs"
      Severity: Major
      Found in client/pages/UserPreferences.tsx and 3 other locations - About 2 hrs to fix
      client/pages/UserPreferences.tsx on lines 231..243
      client/pages/UserPreferences.tsx on lines 246..256
      client/pages/UserPreferences.tsx on lines 268..278

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

      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

                    <IsLoggedIn>
                      <ul className="list-disc list-inside">
                        <li>
                          <FooterLink to="/nutrition">Dashboard</FooterLink>
                        </li>
      Severity: Major
      Found in client/Application.tsx and 1 other location - About 2 hrs to fix
      client/Application.tsx on lines 68..77

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

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

                          <div className="w-1/3">
                            <Input
                              className="w-full"
                              disabled={!preferencesForm.getValue("faturdays")}
                              label="Protein"
      Severity: Major
      Found in client/pages/UserPreferences.tsx and 3 other locations - About 2 hrs to fix
      client/pages/UserPreferences.tsx on lines 231..243
      client/pages/UserPreferences.tsx on lines 246..256
      client/pages/UserPreferences.tsx on lines 257..267

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

      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

                    <IsLoggedOut>
                      <ul className="list-disc list-inside">
                        <li>
                          <FooterLink to="/register">Get Started</FooterLink>
                        </li>
      Severity: Major
      Found in client/Application.tsx and 1 other location - About 2 hrs to fix
      client/Application.tsx on lines 78..87

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

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

                          <div className="w-full">
                            <Input
                              className="w-full"
                              disabled={!preferencesForm.getValue("faturdays")}
                              label="Faturday Calories"
      Severity: Major
      Found in client/pages/UserPreferences.tsx and 3 other locations - About 2 hrs to fix
      client/pages/UserPreferences.tsx on lines 246..256
      client/pages/UserPreferences.tsx on lines 257..267
      client/pages/UserPreferences.tsx on lines 268..278

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

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

                          <div className="w-1/3">
                            <Input
                              className="w-full"
                              disabled={!preferencesForm.getValue("faturdays")}
                              label="Fat"
      Severity: Major
      Found in client/pages/UserPreferences.tsx and 3 other locations - About 2 hrs to fix
      client/pages/UserPreferences.tsx on lines 231..243
      client/pages/UserPreferences.tsx on lines 257..267
      client/pages/UserPreferences.tsx on lines 268..278

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

      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 Login has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function Login() {
        const { push } = useHistory();
        const loginForm = useForm<{
          email: string;
          password: string;
      Severity: Major
      Found in client/pages/Login.tsx - About 2 hrs to fix

        Function ResetPassword has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function ResetPassword() {
          const { token } = useParams<{ token: string }>();
          const navigate = useNavigateToUrl();
          const formData = useForm<{
            password: string;
        Severity: Major
        Found in client/pages/ResetPassword.tsx - About 2 hrs to fix

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

                          <div className="md:w-1/2 flex flex-col gap-2">
                            <Input
                              label="Height"
                              placeholder={`e.g., 5 ft 3 inches`}
                              type="text"
          Severity: Major
          Found in client/pages/UserPreferences.tsx and 1 other location - About 2 hrs to fix
          client/pages/UserPreferences.tsx on lines 199..211

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

          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="md:w-1/2 flex flex-col gap-2">
                            <Input
                              label="Birthday"
                              placeholder={`e.g., October 13, 1982`}
                              type="text"
          Severity: Major
          Found in client/pages/UserPreferences.tsx and 1 other location - About 2 hrs to fix
          client/pages/UserPreferences.tsx on lines 186..198

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

          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

          File TileMap.tsx has 280 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import cx from "classnames";
          import addDays from "date-fns/addDays";
          import format from "date-fns/format";
          import getDay from "date-fns/getDay";
          import subDays from "date-fns/subDays";
          Severity: Minor
          Found in client/components/TileMap.tsx - About 2 hrs to fix

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

              return (
                <div className="flex flex-col gap-4 w-full">
                  <ContentContainer>
                    <PageHeading className="text-center">Logging out...</PageHeading>
                  </ContentContainer>
            Severity: Major
            Found in client/pages/Logout.tsx and 1 other location - About 2 hrs to fix
            client/pages/LoggingIn.tsx on lines 10..21

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

            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

              return (
                <div className="flex flex-col gap-4 w-full">
                  <ContentContainer>
                    <PageHeading className="text-center">Logging in...</PageHeading>
                  </ContentContainer>
            Severity: Major
            Found in client/pages/LoggingIn.tsx and 1 other location - About 2 hrs to fix
            client/pages/Logout.tsx on lines 25..36

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

            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

            File AddableFoodMeasurements.tsx has 279 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import cx from "classnames";
            import React from "react";
            
            import { coalesce, or } from "../../../shared";
            import { useForm, useKeyPressHandler } from "../../helpers";
            Severity: Minor
            Found in client/components/Foods/AddableFoodMeasurements.tsx - About 2 hrs to fix

              Function fn has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  fn: async () => {
                    const foodLogsInRange = await foodLogDataService.findBy(context, (q) =>
                      q
                        .where("userId", "=", userId)
                        .andWhere("day", ">=", from)
              Severity: Major
              Found in api/dataServices/foodLog/stats.ts - About 2 hrs to fix

                Function Input has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function Input(props: InputProps) {
                  const id = or(props.id, `input-${count++}`);
                  const label = props.label;
                  const {
                    showLabel = true,
                Severity: Major
                Found in client/components/Forms/Input.tsx - About 2 hrs to fix

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

                  import { assertIsError } from "../../../shared";
                  import { Resolvable } from "../../../shared/types";
                  import { QueryBuilder } from "../../config/db";
                  import { log } from "../../config/log";
                  import { isBefore } from "./isBefore";
                  Severity: Minor
                  Found in api/helpers/buildConnectionResolver/buildConnectionResolver.ts - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language