Vizzuality/landgriffon

View on GitHub

Showing 438 of 1,408 total issues

Function PrivacyPolicy has 660 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PrivacyPolicy: React.FC = () => {
  return (
    <section className="bg-white">
      <Wrapper>
        <div className="pt-12 pb-10 space-y-10 md:pt-32 md:pb-16 md:w-8/12">
Severity: Major
Found in marketing/src/containers/privacy-policy/component.tsx - About 3 days to fix

    File FlowMapSelectors.ts has 1034 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2022 FlowmapBlue
     * Copyright 2018-2020 Teralytics, modified by FlowmapBlue
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
    Severity: Major
    Found in cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts - About 2 days to fix

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

      import { useEffect, useMemo, useRef } from 'react';
      import { useRouter } from 'next/router';
      import { useForm, Controller } from 'react-hook-form';
      import { RadioGroup, Disclosure } from '@headlessui/react';
      import { yupResolver } from '@hookform/resolvers/yup';
      Severity: Major
      Found in client/src/containers/interventions/form/component.tsx - About 2 days to fix

        Function AnalysisTable has 460 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const AnalysisTable = () => {
          const searchParams = useSearchParams();
          const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));
        
          const [paginationState, setPaginationState] = useState<PaginationState>({
        Severity: Major
        Found in client/src/containers/analysis-visualization/analysis-table/index.tsx - About 2 days to fix

          Function MoreFilters has 353 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const MoreFilters = () => {
            const { query } = useRouter();
            const { scenarioId, compareScenarioId } = query;
          
            const dispatch = useAppDispatch();

            File h3-data.repository.ts has 679 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              Brackets,
              DataSource,
              ObjectLiteral,
              Repository,
            Severity: Major
            Found in api/src/modules/h3-data/h3-data.repository.ts - About 1 day to fix

              Function buildDashboard has 301 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async buildDashboard(dto: GetDashBoardDTO): Promise<EUDRDashboard> {
                  if (dto.originIds) {
                    dto.originIds = await this.adminRegionService.getAdminRegionDescendants(
                      dto.originIds,
                    );
              Severity: Major
              Found in api/src/modules/eudr-alerts/dashboard/eudr-dashboard.service.ts - About 1 day to fix

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

                import Wrapper from 'containers/wrapper';
                import Link from 'next/link';
                
                const PrivacyPolicy: React.FC = () => {
                  return (
                Severity: Major
                Found in marketing/src/containers/privacy-policy/component.tsx - About 1 day to fix

                  Function EUDRCompareMap has 298 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const EUDRCompareMap = () => {
                    const maps = useMap();
                  
                    const {
                      planetLayer,
                  Severity: Major
                  Found in client/src/containers/analysis-eudr/map/compare.tsx - About 1 day to fix

                    Function EUDRBasemapControl has 280 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const EUDRBasemapControl = () => {
                      const currentDate = useMemo(() => new Date(), []);
                      const dispatch = useAppDispatch();
                      const { basemap, planetLayer, planetCompareLayer } = useAppSelector((state) => state.eudr);
                      const basemapData = LayersData.find((layer) => layer.id === 'planet-data');
                    Severity: Major
                    Found in client/src/containers/analysis-eudr/map/basemap/component.tsx - About 1 day to fix

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

                      const Contact: React.FC = () => {
                        const [submitting, setSubmitting] = useState(false);
                        const [success, setSuccess] = useState(false);
                      
                        const { query } = useRouter();
                      Severity: Major
                      Found in marketing/src/containers/contact/component.tsx - About 1 day to fix

                        Function EUDRCompareMap has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const EUDRCompareMap = () => {
                          const maps = useMap();
                        
                          const {
                            planetLayer,
                        Severity: Minor
                        Found in client/src/containers/analysis-eudr/map/compare.tsx - About 1 day 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 EUDRMap has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const EUDRMap: React.FC<{ supplierId?: string }> = ({ supplierId }) => {
                          const {
                            planetLayer,
                            supplierLayer,
                            contextualLayers,
                        Severity: Minor
                        Found in client/src/containers/analysis-eudr/map/component.tsx - About 1 day 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

                        File eudr-dashboard.service.ts has 583 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { Inject, Injectable, NotFoundException } from '@nestjs/common';
                        import { DataSource, EntityManager, SelectQueryBuilder } from 'typeorm';
                        import {
                          AlertedGeoregionsBySupplier,
                          IEUDRAlertsRepository,
                        Severity: Major
                        Found in api/src/modules/eudr-alerts/dashboard/eudr-dashboard.service.ts - About 1 day to fix

                          FlowMapSelectors has 66 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          export default class FlowMapSelectors<L, F> {
                            accessors: FlowMapAggregateAccessors<L, F>;
                          
                            constructor(accessors: FlowMapDataAccessors<L, F>) {
                              this.accessors = new FlowMapAggregateAccessors(accessors);
                          Severity: Major
                          Found in cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts - About 1 day to fix

                            Function up has 240 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              public async up(queryRunner: QueryRunner): Promise<void> {
                                await queryRunner.query(`
                                  CREATE OR REPLACE FUNCTION get_h3_uncompact_geo_region(geo_region_id uuid, h3_resolution int)
                                  RETURNS TABLE (h3index h3index) AS
                                  $$
                            Severity: Major
                            Found in api/src/migrations/1645259040554-ImpactStoredFunctions.ts - About 1 day to fix

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

                              import React, { useCallback, useState, useMemo, useEffect, useRef } from 'react';
                              import classNames from 'classnames';
                              import {
                                flip,
                                offset,
                              Severity: Major
                              Found in client/src/components/tree-select/component.tsx - About 1 day to fix

                                Function buildIndex has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export function buildIndex<F>(clusterLevels: ClusterLevels): ClusterIndex<F> {
                                  const nodesByZoom = new Map<number, ClusterNode[]>();
                                  const clustersById = new Map<string, Cluster>();
                                  const minZoomByLocationId = new Map<string, number>();
                                  for (const { zoom, nodes } of clusterLevels) {
                                Severity: Minor
                                Found in cookie-traceability/src/lib/flowmap/data/cluster/ClusterIndex.ts - About 1 day 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 MoreFilters has 221 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const MoreFilters = () => {
                                  const dispatch = useAppDispatch();
                                  const {
                                    filters: { materials, origins, suppliers, plots },
                                  } = useAppSelector(eudr);
                                Severity: Major
                                Found in client/src/containers/analysis-eudr/filters/more-filters/index.tsx - About 1 day to fix

                                  Function SupplierSourcingInfoChart has 210 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const SupplierSourcingInfoChart = (): JSX.Element => {
                                    const [showBy, setShowBy] = useState<'byVolume' | 'byArea'>('byVolume');
                                    const [selectedPlots, setSelectedPlots] = useState<string[]>([]);
                                    const { supplierId }: { supplierId: string } = useParams();
                                    const {
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language