baublet/w8mngr

View on GitHub

Showing 365 of 365 total issues

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

    fn: async () => {
      const activities = await activityLogDataService.findBy(context, (q) =>
        q
          .where("userId", "=", parent.id)
          .where("day", ">=", from)
Severity: Major
Found in api/resolvers/user/activitySummary.ts - About 2 hrs to fix

    File NutritionChart.tsx has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import cx from "classnames";
    import React from "react";
    import {
      Bar,
      ComposedChart,
    Severity: Minor
    Found in client/components/Nutrition/NutritionChart.tsx - About 2 hrs to fix

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

                  <g id="adductors" {...musclesMap.ADDUCTORS}>
                    <path
                      d="M34.61,93.86C34.61,93.86 38.841,105.576 40.494,108.72C42.948,113.388 44.349,117.167 43.981,117.769C43.613,118.371 42.727,127.569 42.661,126.735C42.188,120.718 35.211,97.411 34.069,95.811C33.439,94.929 34.606,93.854 34.61,93.86Z"
                      className="fill-current"
                    ></path>
      Severity: Major
      Found in client/components/MuscleMap/MuscleMap.tsx and 1 other location - About 2 hrs to fix
      client/components/MuscleMap/MuscleMap.tsx on lines 256..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 86.

      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

                  <g id="quads" {...musclesMap.QUADS}>
                    <path
                      d="M31.462,95.811C31.462,95.811 42.535,119.444 41.73,130.509C40.925,141.574 39.718,145.396 39.718,148.213C39.718,151.029 40.079,144.004 36.553,143.988C32.421,143.969 29.334,147.32 28.215,151.011C28.056,151.538 27.216,140.514 27.216,140.514C27.216,140.514 25.8,137.476 24.83,127.273C23.362,111.825 35.129,106.258 31.462,95.811"
                      className="fill-current"
                    ></path>
      Severity: Major
      Found in client/components/MuscleMap/MuscleMap.tsx and 1 other location - About 2 hrs to fix
      client/components/MuscleMap/MuscleMap.tsx on lines 268..279

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

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

      export async function register(
        context: Context,
        userData: {
          email: string;
          password: string;
      Severity: Major
      Found in api/dataServices/user/register.ts - About 2 hrs to fix

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

              {props.showLabel === false ? (
                <label htmlFor={newProps.id} className="screen-reader-text">
                  {label}
                </label>
              ) : (
        Severity: Major
        Found in client/components/Forms/InputFoodEntry.tsx and 1 other location - About 2 hrs to fix
        client/components/Forms/InputInverted.tsx on lines 77..90

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

        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

              {props.showLabel === false ? (
                <label htmlFor={newProps.id} className="screen-reader-text">
                  {label}
                </label>
              ) : (
        Severity: Major
        Found in client/components/Forms/InputInverted.tsx and 1 other location - About 2 hrs to fix
        client/components/Forms/InputFoodEntry.tsx on lines 71..84

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

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

        export function MagicEmailLinkForm() {
          const formData = useForm<{ email: string }>();
          const { error, success } = useToast();
          const [sent, setSent] = React.useState(false);
          const [requestResetLink, { loading }] = useRequestEmailLoginLinkMutation({
        Severity: Major
        Found in client/components/MagicEmailLinkForm.tsx - About 2 hrs to fix

          Function emailService has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function emailService() {
            return async ({
              to,
              subject,
              html,
          Severity: Major
          Found in api/helpers/emailService.ts - About 2 hrs to fix

            Function AddableFoods has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            export function AddableFoods({
              foods,
              day,
              uniqueKey,
            }: {
            Severity: Minor
            Found in client/components/Foods/AddableFoods.tsx - About 2 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

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

                ({
                  description,
                  imageUploadId,
                  name,
                  measurements,
            Severity: Major
            Found in client/components/Foods/NewFoodForm.tsx and 1 other location - About 2 hrs to fix
            client/components/Foods/EditFoodForm.tsx on lines 30..40

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

            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

                  {
                    name,
                    description,
                    imageUploadId,
                    measurements,
            Severity: Major
            Found in client/components/Foods/EditFoodForm.tsx and 1 other location - About 2 hrs to fix
            client/components/Foods/NewFoodForm.tsx on lines 22..32

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

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

            export function ForgotPasswordForm() {
              const formData = useForm<{ email: string }>();
              const { error, success } = useToast();
              const [sent, setSent] = React.useState(false);
              const [requestResetLink, { loading }] = useRequestPasswordResetTokenMutation({
            Severity: Major
            Found in client/components/ForgotPasswordForm.tsx - About 2 hrs to fix

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

                  (q) => {
                    const id = input.id;
                    const publicId = input.publicId;
              
                    q.where("userId", "=", currentUserId);
              Severity: Major
              Found in api/resolvers/mutations/saveUploadData.ts and 1 other location - About 2 hrs to fix
              api/resolvers/mutations/saveUploadData.ts on lines 37..50

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

              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

                  getCurrentUserAccount: <T extends boolean | undefined>(orThrow?: T) => {
                    const currentUserAccount = userAccount;
                    if (!currentUserAccount && orThrow) {
                      throw new Error("Not logged in");
                    }
              Severity: Major
              Found in api/createContext.ts and 1 other location - About 2 hrs to fix
              api/createContext.ts on lines 114..122

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

              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

                  getCurrentUser: <T extends boolean | undefined>(orThrow?: T) => {
                    const currentUser = currentUserRecord;
                    if (!currentUser && orThrow) {
                      throw new Error("Not logged in");
                    }
              Severity: Major
              Found in api/createContext.ts and 1 other location - About 2 hrs to fix
              api/createContext.ts on lines 99..107

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

              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

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

                const upload = await uploadDataService.findOneOrFail(context, (q) => {
                  const id = input.id;
                  const publicId = input.publicId;
              
                  q.where("userId", "=", currentUserId);
              Severity: Major
              Found in api/resolvers/mutations/saveUploadData.ts and 1 other location - About 2 hrs to fix
              api/resolvers/mutations/saveUploadData.ts on lines 15..28

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

              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

                  case "WEIGHT":
                    return (
                      <div className="flex gap-2 w-full">
                        <div className="w-1/12 text-right">{reps}</div>
                        <div className="w-1/12 text-center">&times;</div>
              Severity: Major
              Found in client/components/Activity/ActivityStats.tsx and 1 other location - About 2 hrs to fix
              client/components/Activity/ActivityTileMap.tsx on lines 95..102

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

              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

                  case "WEIGHT":
                    return (
                      <div className="flex gap-2">
                        <div className="w-2/12 text-right">{reps}</div>
                        <div className="w-1/12 text-center">&times;</div>
              Severity: Major
              Found in client/components/Activity/ActivityTileMap.tsx and 1 other location - About 2 hrs to fix
              client/components/Activity/ActivityStats.tsx on lines 114..121

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

              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

                    <Link {...props} to={to} className={classNames}>
                      {leftIcon && (
                        <span className="opacity-75 group-hover:opacity-100">{leftIcon}</span>
                      )}
                      <div className={textClassNames}>{children}</div>
              Severity: Major
              Found in client/components/Button/Base.tsx and 1 other location - About 2 hrs to fix
              client/components/Button/Base.tsx on lines 73..79

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

              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