Vizzuality/landgriffon

View on GitHub

Showing 438 of 1,408 total issues

Function MapPage has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MapPage: NextPageWithLayout = () => {
  const scrollRef = useRef<HTMLDivElement>(null);
  const [isCollapsed, setIsCollapsed] = useState(false);
  const { planetCompareLayer } = useAppSelector((state) => state.eudr);
  const {
Severity: Major
Found in client/src/pages/eudr/suppliers/[supplierId].tsx - About 2 hrs to fix

    Function YearsRange has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const YearsRange: React.FC = () => {
      const dispatch = useAppDispatch();
    
      const [years, setYears] = useState<number[]>([]);
      const { visualizationMode } = useAppSelector(analysisUI);

      Function createIndicatorRecordsBySourcingRecords has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async createIndicatorRecordsBySourcingRecords(
          sourcingData: {
            sourcingRecordId: string;
            geoRegionId: string;
            materialId: string;

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

          static addFilters<Entity extends ObjectLiteral>(
            queryBuilder: SelectQueryBuilder<Entity>,
            filters: CommonFiltersDto,
          ): SelectQueryBuilder<Entity> {
            if (filters.materialIds) {
        Severity: Major
        Found in api/src/utils/base.query-builder.ts - About 2 hrs to fix

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

            _getModel(gl: WebGLRenderingContext): Record<string, any> {
              let positions: number[] = [];
              let pixelOffsets: number[] = [];
          
              const { drawOutline, outlineThickness } = this.props;

            Function renderLayers has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              renderLayers(): Array<any> {
                const layers = [];
                if (this.state?.layersData) {
                  const { layersData, highlightedObject } = this.state;
                  const { circleAttributes, lineAttributes } = layersData || {};
            Severity: Minor
            Found in cookie-traceability/src/lib/flowmap/layers/FlowMapLayer.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 baseGetImpactMap has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private async baseGetImpactMap(
                baseImpactMap: BaseImpactMap,
              ): Promise<{ impactMap: H3IndexValueData[]; quantiles: number[] }> {
                let baseMapQuery: SelectQueryBuilder<any> = this.baseMapQuery(
                  baseImpactMap.indicatorId,
            Severity: Major
            Found in api/src/modules/h3-data/h3-data.repository.ts - About 2 hrs to fix

              Function Testimonials has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Testimonials: React.FC = () => {
                const [slide, setSlide] = useState(0);
              
                return (
                  <section className="relative py-12 bg-blue-600 md:py-32">
              Severity: Major
              Found in marketing/src/containers/testimonials/component.tsx - About 2 hrs to fix

                Function Snow has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function Snow() {
                  const pointsRef = useRef<Points>(null);
                
                  const { viewport } = useThree();
                
                
                Severity: Major
                Found in cookie-traceability/src/components/snow/component.tsx - About 2 hrs to fix

                  Function parseInterventionFormDataToDto has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function parseInterventionFormDataToDto(
                    interventionFormData: InterventionFormData,
                  ): InterventionDto {
                    // removing some fields which API doesn't support
                    delete interventionFormData.cityAddressCoordinates;
                  Severity: Major
                  Found in client/src/containers/interventions/utils.ts - About 2 hrs to fix

                    File index.tsx has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { useCallback, useState, useEffect, useMemo } from 'react';
                    import { FilterIcon } from '@heroicons/react/solid';
                    import {
                      offset,
                      shift,
                    Severity: Minor
                    Found in client/src/containers/analysis-eudr/filters/more-filters/index.tsx - About 2 hrs to fix

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

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

                        Function geoCodeLocations has 62 lines of code (exceeds 25 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: Major
                        Found in api/src/modules/geo-coding/geo-coding.service.ts - About 2 hrs to fix

                          Function OpenScience has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const OpenScience: React.FC = () => {
                            return (
                              <section className="relative py-12 space-y-12 bg-blue-600 bg-cover md:space-y-64 md:py-36 overflow-hidden">
                                <Wrapper>
                                  <div className="grid grid-cols-2">
                          Severity: Major
                          Found in marketing/src/containers/methodology/open-science/component.tsx - About 2 hrs to fix

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

                            const ScenariosComparison: FC = () => {
                              const { query, push } = useRouter();
                              const { scenarioId, compareScenarioId } = query;
                              const dispatch = useAppDispatch();
                            
                            
                            Severity: Major
                            Found in client/src/containers/scenarios/comparison/component.tsx - About 2 hrs to fix

                              File index.tsx has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { useCallback, useMemo, useState } from 'react';
                              import Head from 'next/head';
                              import { useRouter } from 'next/router';
                              import { PlusIcon, SortDescendingIcon } from '@heroicons/react/solid';
                              import Lottie from 'lottie-react';
                              Severity: Minor
                              Found in client/src/pages/data/scenarios/index.tsx - About 2 hrs to fix

                                File eudr.controller.ts has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import {
                                  Controller,
                                  Get,
                                  Param,
                                  Query,
                                Severity: Minor
                                Found in api/src/modules/eudr-alerts/eudr.controller.ts - About 2 hrs to fix

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

                                  const YearsRange: React.FC = () => {
                                    const dispatch = useAppDispatch();
                                  
                                    const [years, setYears] = useState<number[]>([]);
                                    const { visualizationMode } = useAppSelector(analysisUI);

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

                                  const UserDropdown: React.FC = () => {
                                    const { x, y, refs, strategy } = useFloating({
                                      placement: 'top-start',
                                      middleware: [offset({ crossAxis: 20, mainAxis: 10 }), shift()],
                                    });
                                  Severity: Major
                                  Found in client/src/containers/user-dropdown/component.tsx - About 2 hrs to fix

                                    Function importEudr has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      async importEudr(filePath: string, taskId: string): Promise<any> {
                                        this.logger.log(`Starting eudr import process`);
                                        await this.fileService.isFilePresentInFs(filePath);
                                        try {
                                          const parsedEudrData: any = await this.fileService.transformToJson(
                                    Severity: Major
                                    Found in api/src/modules/import-data/eudr/eudr.import.service.ts - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language