Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

  constructor(
    private readonly indicatorRecordRepository: IndicatorRecordRepository,
    private readonly materialToH3: MaterialsToH3sService,
    private readonly indicatorService: IndicatorsService,
    private readonly dependencyManager: IndicatorQueryDependencyManager,
api/src/modules/scenario-interventions/services/intervention-builder.service.ts on lines 28..37

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

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 component.tsx has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { cloneElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import classnames from 'classnames';
import { Transition, Combobox } from '@headlessui/react';
import { ChevronUpIcon, ChevronDownIcon, XIcon } from '@heroicons/react/solid';
import { flip, useFloating, size, autoUpdate, offset } from '@floating-ui/react-dom';
Severity: Minor
Found in client/src/components/forms/select/autocomplete/component.tsx - About 2 hrs to fix

    Function populateValuesRecursively has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private populateValuesRecursively(
        entity: ActualVsScenarioImpactTableRows,
        entityDataMap: Map<
          string,
          Map<number, ActualVsScenarioImpactTableRowsValues>
    Severity: Major
    Found in api/src/modules/impact/comparison/actual-vs-scenario.service.ts - About 2 hrs to fix

      Function EUDRModal has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const EUDRModal: React.FC = () => {
        const [isOpen, setIsOpen] = useState(false);
      
        const { start, stop } = useTimeout(() => {
          setIsOpen(true);
      Severity: Major
      Found in marketing/src/containers/home/eudr-modal/component.tsx - About 2 hrs to fix

        Function Contact has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Contact = (req: NextApiRequest, res: NextApiResponse): void => {
          if (req.method === 'POST') {
            const { name, email, message, company, topic, newsletter } = req.body;
        
            // Saving contacts and emails in Sendgrid
        Severity: Major
        Found in marketing/src/pages/api/contact.ts - About 2 hrs to fix

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

              cy.wait('@materialsTrees').then(() => {
                const $inputSelect = cy.get('[data-testid="materials-select"]');
                $inputSelect.click();
          
                $inputSelect.find('.rc-tree-list').contains('Cotton').click();
          Severity: Major
          Found in client/cypress/e2e/intervention-creation.cy.ts and 4 other locations - About 2 hrs to fix
          client/cypress/e2e/intervention-creation.cy.ts on lines 40..45
          client/cypress/e2e/intervention-creation.cy.ts on lines 73..77
          client/cypress/e2e/intervention-creation.cy.ts on lines 153..157
          client/cypress/e2e/intervention-creation.cy.ts on lines 312..317

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

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

              cy.wait('@materialsTrees').then(() => {
                const $inputSelect = cy.get('[data-testid="new-material-select"]');
                $inputSelect.click();
                $inputSelect.find('.rc-tree-list').contains('Fruits, berries and nuts').click();
              });
          Severity: Major
          Found in client/cypress/e2e/intervention-creation.cy.ts and 4 other locations - About 2 hrs to fix
          client/cypress/e2e/intervention-creation.cy.ts on lines 40..45
          client/cypress/e2e/intervention-creation.cy.ts on lines 120..125
          client/cypress/e2e/intervention-creation.cy.ts on lines 153..157
          client/cypress/e2e/intervention-creation.cy.ts on lines 312..317

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

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

              cy.wait('@materialsTrees').then(() => {
                const $inputSelect = cy.get('[data-testid="materials-select"]');
                $inputSelect.click();
          
                $inputSelect.find('.rc-tree-list').contains('Cotton').click();
          Severity: Major
          Found in client/cypress/e2e/intervention-creation.cy.ts and 4 other locations - About 2 hrs to fix
          client/cypress/e2e/intervention-creation.cy.ts on lines 73..77
          client/cypress/e2e/intervention-creation.cy.ts on lines 120..125
          client/cypress/e2e/intervention-creation.cy.ts on lines 153..157
          client/cypress/e2e/intervention-creation.cy.ts on lines 312..317

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

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

              cy.wait('@materialsTrees').then(() => {
                const $inputSelect = cy.get('[data-testid="materials-select"]');
                $inputSelect.click();
          
                $inputSelect.find('.rc-tree-list').contains('Cotton').click();
          Severity: Major
          Found in client/cypress/e2e/intervention-creation.cy.ts and 4 other locations - About 2 hrs to fix
          client/cypress/e2e/intervention-creation.cy.ts on lines 40..45
          client/cypress/e2e/intervention-creation.cy.ts on lines 73..77
          client/cypress/e2e/intervention-creation.cy.ts on lines 120..125
          client/cypress/e2e/intervention-creation.cy.ts on lines 153..157

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

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

              cy.wait('@materialsTrees').then(() => {
                const $inputSelect = cy.get('[data-testid="new-material-select"]');
                $inputSelect.click();
                $inputSelect.find('.rc-tree-list').contains('Fruits, berries and nuts').click();
              });
          Severity: Major
          Found in client/cypress/e2e/intervention-creation.cy.ts and 4 other locations - About 2 hrs to fix
          client/cypress/e2e/intervention-creation.cy.ts on lines 40..45
          client/cypress/e2e/intervention-creation.cy.ts on lines 73..77
          client/cypress/e2e/intervention-creation.cy.ts on lines 120..125
          client/cypress/e2e/intervention-creation.cy.ts on lines 312..317

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

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

                          <div>
                            <Label htmlFor="lname">Last name</Label>
                            <Input
                              {...register('lname')}
                              defaultValue={user.data.lname}
          Severity: Major
          Found in client/src/containers/update-profile-form/component.tsx and 2 other locations - About 2 hrs to fix
          client/src/containers/update-profile-form/component.tsx on lines 60..67
          client/src/containers/update-profile-form/component.tsx on lines 86..93

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

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

                          <div>
                            <Label htmlFor="title">Title</Label>
                            <Input
                              {...register('title')}
                              defaultValue={user.data.title}
          Severity: Major
          Found in client/src/containers/update-profile-form/component.tsx and 2 other locations - About 2 hrs to fix
          client/src/containers/update-profile-form/component.tsx on lines 60..67
          client/src/containers/update-profile-form/component.tsx on lines 68..75

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

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

                          <div>
                            <Label htmlFor="fname">First name</Label>
                            <Input
                              {...register('fname')}
                              defaultValue={user.data.fname}
          Severity: Major
          Found in client/src/containers/update-profile-form/component.tsx and 2 other locations - About 2 hrs to fix
          client/src/containers/update-profile-form/component.tsx on lines 68..75
          client/src/containers/update-profile-form/component.tsx on lines 86..93

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

          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 1645259040554-ImpactStoredFunctions.ts has 257 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { MigrationInterface, QueryRunner } from 'typeorm';
          
          export class ImpactStoredFunctions1645259040554 implements MigrationInterface {
            public async up(queryRunner: QueryRunner): Promise<void> {
              await queryRunner.query(`
          Severity: Minor
          Found in api/src/migrations/1645259040554-ImpactStoredFunctions.ts - About 2 hrs to fix

            Function handleSearchSelection has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                (newKey: Key) => {
                  resetSearch();
            
                  const selectedNode = flatTreeData.find((data) => data.key === newKey);
                  setKeyToScroll(newKey);
            Severity: Major
            Found in client/src/components/tree-select/component.tsx - About 2 hrs to fix

              Function Video has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Video: FC = () => {
                const videoRef = useRef<HTMLVideoElement>();
                const { ref, inView } = useInView();
              
                const onVideoEnded = useCallback(() => {
              Severity: Major
              Found in marketing/src/containers/compliance/hero/component.tsx - About 2 hrs to fix

                Function ContactUs has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const ContactUs: FC = () => {
                  return (
                    <section className="bg-orange-500 xl:bg-white">
                      <Wrapper>
                        <div className="relative z-10 pt-12 bg-orange-500 md:pt-20 xl:-mt-10 xl:px-20 xl:-mx-20">
                Severity: Major
                Found in marketing/src/containers/methodology/contact-us/component.tsx - About 2 hrs to fix

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

                          <div>
                            <h1 className="mb-2 text-5xl font-semibold text-gray-900">Server error</h1>
                  
                            <p className="text-lg font-normal leading-5 text-gray-400 ">
                              Something went wrong. Please try to reload the page. If the problem persists, feel free
                  Severity: Major
                  Found in client/src/pages/_error.tsx and 1 other location - About 2 hrs to fix
                  marketing/src/pages/_error.tsx on lines 13..24

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

                  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>
                            <h1 className="mb-2 text-5xl font-semibold text-gray-900">Server error</h1>
                  
                            <p className="text-lg font-normal leading-5 text-gray-400 ">
                              Something went wrong. Please try to reload the page. If the problem persists, feel free
                  Severity: Major
                  Found in marketing/src/pages/_error.tsx and 1 other location - About 2 hrs to fix
                  client/src/pages/_error.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 78.

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

                  const DatesRange = (): JSX.Element => {
                    const dispatch = useAppDispatch();
                    const {
                      filters: { dates },
                    } = useAppSelector(eudrDetail);
                    Severity
                    Category
                    Status
                    Source
                    Language