Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

Function useBottomScrollListener has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function useBottomScrollListener<T extends HTMLDivElement>(
  onBottom: () => void,
  scrollref?: MutableRefObject<HTMLDivElement | null>,
  options?: {
    offset?: number;
Severity: Major
Found in client/src/hooks/scroll/index.ts - About 2 hrs to fix

    Function DatesRange has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const DatesRange = (): JSX.Element => {
      const dispatch = useAppDispatch();
      const {
        filters: { dates },
      } = useAppSelector(eudr);
    Severity: Major
    Found in client/src/containers/analysis-eudr/filters/years-range/index.tsx - About 2 hrs to fix

      Function findSourcingLocationsWithSourcingRecords has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async findSourcingLocationsWithSourcingRecords(
          createInterventionDto: CreateScenarioInterventionDto,
        ): Promise<SourcingLocation[]> {
          const queryBuilder: SelectQueryBuilder<SourcingLocation> =
            this.sourcingLocationRepository
      Severity: Major
      Found in api/src/modules/sourcing-locations/sourcing-locations.service.ts - About 2 hrs to fix

        Function getImpactRawDataForAllSourcingRecords has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async getImpactRawDataForAllSourcingRecords(
            activeIndicators: Indicator[],
          ): Promise<SourcingRecordsWithIndicatorRawData[]> {
            const { params, query } = this.dependencyManager.buildQueryForImport(
              activeIndicators.map(

          File component.tsx has 255 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { FC, useState } from 'react';
          import cx from 'classnames';
          import Image from 'next/image';
          import FadeIn from 'components/fade';
          
          
          Severity: Minor
          Found in marketing/src/containers/methodology/data-providers/component.tsx - About 2 hrs to fix

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

              useEffect(() => {
                const counters = Object.values(moreFilters).map((value) => value.length);
                const total = counters.reduce((a, b) => a + b);
                setCounter(total);
              }, [moreFilters]);
            client/src/containers/analysis-eudr/filters/more-filters/index.tsx on lines 157..161

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

            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

                cy.wait('@fetchImpactTable').then((i) => {
                  expect(i.request.query).haveOwnProperty('sortingYear');
                  expect(i.request.query.sortingOrder).eq('DESC');
                });
            Severity: Major
            Found in client/cypress/e2e/analysis/table.cy.ts and 1 other location - About 2 hrs to fix
            client/cypress/e2e/analysis/table.cy.ts on lines 93..96

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

            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

              useEffect(() => {
                const counters = Object.values(filters).map((value) => value.length);
                const total = counters.reduce((a, b) => a + b);
                setCounter(total);
              }, [filters]);
            client/src/containers/analysis-visualization/analysis-filters/more-filters/component.tsx on lines 293..297

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

            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

                cy.wait('@fetchImpactTable').then((i) => {
                  expect(i.request.query).haveOwnProperty('sortingYear');
                  expect(i.request.query.sortingOrder).eq('ASC');
                });
            Severity: Major
            Found in client/cypress/e2e/analysis/table.cy.ts and 1 other location - About 2 hrs to fix
            client/cypress/e2e/analysis/table.cy.ts on lines 87..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 77.

            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 postProcessYearIndicatorData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

              private postProcessYearIndicatorData(
                entityMap: Map<string, Map<number, ActualVsScenarioImpactTableRowsValues>>,
                rangeOfYears: number[],
                lastYearWithData: number,
              ): void {
            Severity: Minor
            Found in api/src/modules/impact/comparison/actual-vs-scenario.service.ts - 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

            Function geoCodeAggregationPoint has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

              async geoCodeAggregationPoint(sourcingData: SourcingData): Promise<any> {
                /**
                 * The user must specify a country, and either an address OR coordinates
                 */
                if (this.hasBothAddressAndCoordinates(sourcingData))

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function relateSourcingDataWithOrganizationalEntities has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

              async relateSourcingDataWithOrganizationalEntities(
                suppliers: Supplier[],
                businessUnits: Record<string, any>[],
                materials: Material[],
                sourcingData: SourcingData[],

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

            const TableBody = React.forwardRef<
              HTMLTableSectionElement,
              React.HTMLAttributes<HTMLTableSectionElement>
            >(({ className, ...props }, ref) => (
              <tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props} />
            Severity: Major
            Found in client/src/components/ui/table.tsx and 6 other locations - About 2 hrs to fix
            client/src/components/ui/table.tsx on lines 14..19
            client/src/components/ui/table.tsx on lines 30..39
            client/src/components/ui/table.tsx on lines 42..53
            client/src/components/ui/table.tsx on lines 56..68
            client/src/components/ui/table.tsx on lines 71..80
            client/src/components/ui/table.tsx on lines 83..88

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

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

            const TableHeader = React.forwardRef<
              HTMLTableSectionElement,
              React.HTMLAttributes<HTMLTableSectionElement>
            >(({ className, ...props }, ref) => (
              <thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />
            Severity: Major
            Found in client/src/components/ui/table.tsx and 6 other locations - About 2 hrs to fix
            client/src/components/ui/table.tsx on lines 22..27
            client/src/components/ui/table.tsx on lines 30..39
            client/src/components/ui/table.tsx on lines 42..53
            client/src/components/ui/table.tsx on lines 56..68
            client/src/components/ui/table.tsx on lines 71..80
            client/src/components/ui/table.tsx on lines 83..88

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

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

            const TableHead = React.forwardRef<
              HTMLTableCellElement,
              React.ThHTMLAttributes<HTMLTableCellElement>
            >(({ className, ...props }, ref) => (
              <th
            Severity: Major
            Found in client/src/components/ui/table.tsx and 6 other locations - About 2 hrs to fix
            client/src/components/ui/table.tsx on lines 14..19
            client/src/components/ui/table.tsx on lines 22..27
            client/src/components/ui/table.tsx on lines 30..39
            client/src/components/ui/table.tsx on lines 42..53
            client/src/components/ui/table.tsx on lines 71..80
            client/src/components/ui/table.tsx on lines 83..88

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

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

            const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
              ({ className, ...props }, ref) => (
                <tr
                  ref={ref}
                  className={cn(
            Severity: Major
            Found in client/src/components/ui/table.tsx and 6 other locations - About 2 hrs to fix
            client/src/components/ui/table.tsx on lines 14..19
            client/src/components/ui/table.tsx on lines 22..27
            client/src/components/ui/table.tsx on lines 30..39
            client/src/components/ui/table.tsx on lines 56..68
            client/src/components/ui/table.tsx on lines 71..80
            client/src/components/ui/table.tsx on lines 83..88

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

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

            const TableCell = React.forwardRef<
              HTMLTableCellElement,
              React.TdHTMLAttributes<HTMLTableCellElement>
            >(({ className, ...props }, ref) => (
              <td
            Severity: Major
            Found in client/src/components/ui/table.tsx and 6 other locations - About 2 hrs to fix
            client/src/components/ui/table.tsx on lines 14..19
            client/src/components/ui/table.tsx on lines 22..27
            client/src/components/ui/table.tsx on lines 30..39
            client/src/components/ui/table.tsx on lines 42..53
            client/src/components/ui/table.tsx on lines 56..68
            client/src/components/ui/table.tsx on lines 83..88

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

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

            const TableFooter = React.forwardRef<
              HTMLTableSectionElement,
              React.HTMLAttributes<HTMLTableSectionElement>
            >(({ className, ...props }, ref) => (
              <tfoot
            Severity: Major
            Found in client/src/components/ui/table.tsx and 6 other locations - About 2 hrs to fix
            client/src/components/ui/table.tsx on lines 14..19
            client/src/components/ui/table.tsx on lines 22..27
            client/src/components/ui/table.tsx on lines 42..53
            client/src/components/ui/table.tsx on lines 56..68
            client/src/components/ui/table.tsx on lines 71..80
            client/src/components/ui/table.tsx on lines 83..88

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

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

            const TableCaption = React.forwardRef<
              HTMLTableCaptionElement,
              React.HTMLAttributes<HTMLTableCaptionElement>
            >(({ className, ...props }, ref) => (
              <caption ref={ref} className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />
            Severity: Major
            Found in client/src/components/ui/table.tsx and 6 other locations - About 2 hrs to fix
            client/src/components/ui/table.tsx on lines 14..19
            client/src/components/ui/table.tsx on lines 22..27
            client/src/components/ui/table.tsx on lines 30..39
            client/src/components/ui/table.tsx on lines 42..53
            client/src/components/ui/table.tsx on lines 56..68
            client/src/components/ui/table.tsx on lines 71..80

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

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

            import { useCallback, useMemo, useState } from 'react';
            import { useRouter } from 'next/router';
            import { omit } from 'lodash-es';
            import {
              LineChart,
            Severity: Minor
            Found in client/src/containers/analysis-chart/comparison-chart/component.tsx - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language