baublet/w8mngr

View on GitHub

Showing 365 of 365 total issues

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

      <div className="flex justify-between">
        <div className="flex-grow flex">
          <SystemOutlineButton
            to={previousPageLink}
            disabled={!hasPreviousPage}
Severity: Major
Found in client/components/Activity/ActivityList.tsx and 1 other location - About 5 hrs to fix
client/components/Foods/FoodsList.tsx on lines 39..58

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

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="flex justify-between">
        <div className="flex-grow">
          <SystemOutlineButton
            onClick={previousPage}
            disabled={!hasPreviousPage}
Severity: Major
Found in client/components/Foods/FoodsList.tsx and 1 other location - About 5 hrs to fix
client/components/Activity/ActivityList.tsx on lines 34..53

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

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

export function NewFood() {
  return (
    <div className="flex flex-col gap-4 w-full">
      <ContentContainer>
        <PageHeading
Severity: Major
Found in client/pages/NewFood.tsx and 1 other location - About 4 hrs to fix
client/pages/NewActivity.tsx on lines 9..29

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

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

export function NewActivity() {
  return (
    <div className="flex flex-col gap-4 w-full">
      <ContentContainer>
        <PageHeading
Severity: Major
Found in client/pages/NewActivity.tsx and 1 other location - About 4 hrs to fix
client/pages/NewFood.tsx on lines 9..29

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

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

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

              const previousPageLink = React.useMemo(() => {
                if (!firstCursor) return "";
                const params = new URLSearchParams(queryParams.toString());
                params.set("cursor", firstCursor);
                params.set("beforeOrAfter", "before");
            Severity: Major
            Found in client/helpers/usePaginatedQuery.ts and 1 other location - About 3 hrs to fix
            client/helpers/usePaginatedQuery.ts on lines 119..126

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

            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

              const nextPageLink = React.useMemo(() => {
                if (!lastCursor) return "";
                const params = new URLSearchParams(queryParams.toString());
                params.set("cursor", lastCursor);
                params.set("beforeOrAfter", "after");
            Severity: Major
            Found in client/helpers/usePaginatedQuery.ts and 1 other location - About 3 hrs to fix
            client/helpers/usePaginatedQuery.ts on lines 110..117

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

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

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

                  const connection: any = await buildConnectionResolver(
                    db.table(userTableName),
                    {
                      last: 3,
                      before: Buffer.from(
              api/helpers/buildConnectionResolver/buildConnectionResolver.test.ts on lines 318..333

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

              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

              async function contextUserOwnerOfFoodLog(
                context: Context,
                foodLogId: string
              ): Promise<true | Error> {
                const found = await foodLogDataService.findOneOrFail(context, (q) =>
              Severity: Major
              Found in api/permissionsServices/foodLog.ts and 1 other location - About 3 hrs to fix
              api/permissionsServices/activity.ts on lines 11..22

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

              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

                  const connection: any = await buildConnectionResolver(
                    db.table(userTableName),
                    {
                      last: 3,
                      before: Buffer.from(
              api/helpers/buildConnectionResolver/buildConnectionResolver.test.ts on lines 353..368

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

              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

              async function contextUserIsOwner(
                context: Context,
                activityId: string
              ): Promise<true | Error> {
                const found = await activityDataService.findOneOrFail(context, (q) =>
              Severity: Major
              Found in api/permissionsServices/activity.ts and 1 other location - About 3 hrs to fix
              api/permissionsServices/foodLog.ts on lines 15..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 105.

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

                          <g id="forearms" {...musclesMap.FOREARMS}>
                            <g transform="matrix(1,0,0,1,-30.9455,0)">
                              <path
                                d="M190.676,73.323C190.676,73.323 194.403,79.228 195.153,83.727C195.903,88.226 195.059,97.131 197.215,99.193C199.371,101.255 190.979,102.942 190.676,100.88C190.373,98.818 181.176,83.279 182.218,80.447C182.5,79.681 181.937,73.042 181.937,73.042L185.178,74.907C185.178,74.907 185.873,77.728 184.28,78.572C182.687,79.416 185.217,81.853 186.248,80.822C187.279,79.79 187.936,77.822 189.154,77.447C190.373,77.072 188.217,75.343 188.967,74.942C189.716,74.542 190.676,73.323 190.676,73.323Z"
                                className="fill-current"
              Severity: Major
              Found in client/components/MuscleMap/MuscleMap.tsx and 9 other locations - About 3 hrs to fix
              client/components/MuscleMap/MuscleMap.tsx on lines 103..116
              client/components/MuscleMap/MuscleMap.tsx on lines 117..130
              client/components/MuscleMap/MuscleMap.tsx on lines 145..158
              client/components/MuscleMap/MuscleMap.tsx on lines 159..172
              client/components/MuscleMap/MuscleMap.tsx on lines 173..186
              client/components/MuscleMap/MuscleMap.tsx on lines 192..205
              client/components/MuscleMap/MuscleMap.tsx on lines 206..219
              client/components/MuscleMap/MuscleMap.tsx on lines 220..233
              client/components/MuscleMap/MuscleMap.tsx on lines 234..247

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

              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

                const [requestResetLink, { loading }] = useRequestEmailLoginLinkMutation({
                  onError: error,
                  onCompleted: (response) => {
                    if (response.requestEmailLoginLink.errors.length > 0) {
                      error(response.requestEmailLoginLink.errors[0]);
              Severity: Major
              Found in client/components/MagicEmailLinkForm.tsx and 1 other location - About 3 hrs to fix
              client/components/ForgotPasswordForm.tsx on lines 14..25

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

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

                          <g id="glutes" {...musclesMap.GLUTES}>
                            <g transform="matrix(1.09042,0.212064,-0.190903,0.981609,-27.3959,-31.9699)">
                              <path
                                d="M147.846,92.187C148.535,91.902 160.874,95.712 163.173,105.215C165.472,114.718 159.341,119.623 153.363,119.163C147.386,118.703 146.487,111.077 146.318,109.233C146.198,107.917 146.705,104.792 146.398,97.557C146.344,96.304 147.156,92.473 147.846,92.187Z"
                                className="fill-current"
              Severity: Major
              Found in client/components/MuscleMap/MuscleMap.tsx and 9 other locations - About 3 hrs to fix
              client/components/MuscleMap/MuscleMap.tsx on lines 103..116
              client/components/MuscleMap/MuscleMap.tsx on lines 117..130
              client/components/MuscleMap/MuscleMap.tsx on lines 131..144
              client/components/MuscleMap/MuscleMap.tsx on lines 159..172
              client/components/MuscleMap/MuscleMap.tsx on lines 173..186
              client/components/MuscleMap/MuscleMap.tsx on lines 192..205
              client/components/MuscleMap/MuscleMap.tsx on lines 206..219
              client/components/MuscleMap/MuscleMap.tsx on lines 220..233
              client/components/MuscleMap/MuscleMap.tsx on lines 234..247

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

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

                          <g id="obliques" {...musclesMap.OBLIQUES}>
                            <g transform="matrix(1,0,0,1,-0.649628,0)">
                              <path
                                d="M36.583,62.749C36.583,62.749 37.978,94.557 36.583,95.693C35.188,96.829 34.904,89.351 29.792,88.499C28.84,88.34 29.629,71.269 27.344,67.199C25.059,63.128 35.611,61.424 36.583,62.749Z"
                                className="fill-current"
              Severity: Major
              Found in client/components/MuscleMap/MuscleMap.tsx and 9 other locations - About 3 hrs to fix
              client/components/MuscleMap/MuscleMap.tsx on lines 103..116
              client/components/MuscleMap/MuscleMap.tsx on lines 117..130
              client/components/MuscleMap/MuscleMap.tsx on lines 131..144
              client/components/MuscleMap/MuscleMap.tsx on lines 145..158
              client/components/MuscleMap/MuscleMap.tsx on lines 159..172
              client/components/MuscleMap/MuscleMap.tsx on lines 173..186
              client/components/MuscleMap/MuscleMap.tsx on lines 192..205
              client/components/MuscleMap/MuscleMap.tsx on lines 206..219
              client/components/MuscleMap/MuscleMap.tsx on lines 220..233

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

              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