Vizzuality/landgriffon

View on GitHub

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

            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

            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

              Function _getFlowLayerPickingInfo has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private async _getFlowLayerPickingInfo(
                  info: Record<string, any>,
                ): Promise<FlowLayerPickingInfo<L, F> | undefined> {
                  const { index, sourceLayer } = info;
                  const { dataProvider, accessors } = this.state || {};
              Severity: Major
              Found in cookie-traceability/src/lib/flowmap/layers/FlowMapLayer.ts - About 2 hrs to fix

                Function chartData has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const chartData = useMemo(() => {
                    const {
                      indicatorShortName,
                      rows,
                      yearSum,
                Severity: Minor
                Found in client/src/containers/analysis-chart/impact-chart/component.tsx - About 2 hrs to fix

                  Function comparisonColumn has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      <Mode extends ComparisonMode>(year: number): ColumnDefinition<ImpactRowType<Mode>> => {
                        const valueIsComparison = (
                          value: ImpactTableValueItem<ComparisonMode>,
                        ): value is ImpactTableValueItem<true> => {
                          return !isScenarioComparison && isComparison;

                    Function buildActualVsScenarioImpactTable has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private buildActualVsScenarioImpactTable(
                        queryDto: GetActualVsScenarioImpactTableDto,
                        indicators: Indicator[],
                        dataForImpactTable: ActualVsScenarioImpactTableData[],
                        entityTree: ImpactTableEntityType[],
                    Severity: Minor
                    Found in api/src/modules/impact/comparison/actual-vs-scenario.service.ts - About 1 hr to fix

                      Function buildImpactTable has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private buildImpactTable(
                          queryDto: GetScenarioVsScenarioImpactTableDto,
                          indicators: Indicator[],
                          dataForImpactTable: ScenarioVsScenarioImpactTableData[],
                          entityTree: ImpactTableEntityType[],
                      Severity: Minor
                      Found in api/src/modules/impact/comparison/scenario-vs-scenario.service.ts - About 1 hr to fix

                        Function Step01 has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const Step01: React.FC = () => {
                          return (
                            <article
                              className={cx({
                                'flex flex-col lg:flex-row justify-between space-y-10 lg:space-x-10 lg:space-y-0': true,
                        Severity: Minor
                        Found in marketing/src/containers/the-service/steps/01/component.tsx - About 1 hr to fix

                          Function Hero has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function Hero() {
                            return (
                              <div
                                className={cx({
                                  'relative px-4 pt-20 xl:pt-24 xl:pb-40 2xl:pt-32 2xl:pb-60': true,
                          Severity: Minor
                          Found in cookie-traceability/src/components/hero/component.tsx - About 1 hr to fix

                            Function postProcessYearIndicatorData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                              private postProcessYearIndicatorData(
                                entityMap: Map<
                                  string,
                                  Map<number, ScenarioVsScenarioImpactTableRowsValues>
                                >,
                            Severity: Minor
                            Found in api/src/modules/impact/comparison/scenario-vs-scenario.service.ts - About 1 hr 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 baseGetImpactMap has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                              private async baseGetImpactMap(
                                baseImpactMap: BaseImpactMap,
                              ): Promise<{ impactMap: H3IndexValueData[]; quantiles: number[] }> {
                                let baseMapQuery: SelectQueryBuilder<any> = this.baseMapQuery(
                                  baseImpactMap.indicatorId,
                            Severity: Minor
                            Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 hr 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 geoCodeLocations has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async geoCodeLocations(
                                sourcingData: SourcingData[],
                              ): Promise<{ geoCodedSourcingData: SourcingData[]; errors: any[] }> {
                                this.logger.log(
                                  `Geocoding locations for ${sourcingData.length} sourcing record elements`,
                            Severity: Minor
                            Found in api/src/modules/geo-coding/geo-coding.service.ts - About 1 hr 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 paramsToQueryInjector has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const paramsToQueryInjector = (
                              params: string[],
                              query: string,
                            ): string => {
                              while (query.includes('$')) {
                            Severity: Minor
                            Found in api/src/utils/helpers/params-to-query-injector.helper.ts - About 1 hr 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

                            Severity
                            Category
                            Status
                            Source
                            Language