Vizzuality/landgriffon

View on GitHub

Showing 438 of 1,408 total issues

Function save has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async save(
    importData: EudrInputShape[],
    sourcingLocationGroupId?: string,
  ): Promise<{
    sourcingLocations: SourcingLocation[];
Severity: Major
Found in api/src/modules/import-data/eudr/eudr.dto-processor.service.ts - About 3 hrs to fix

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

    import { useCallback, useEffect, useMemo } from 'react';
    import Image from 'next/image';
    import { format } from 'date-fns';
    
    import LayersData from '../layers.json';
    Severity: Minor
    Found in client/src/containers/analysis-eudr/map/basemap/component.tsx - About 3 hrs to fix

      Function saveNewIntervention has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        async saveNewIntervention(
          newIntervention: ScenarioIntervention,
        ): Promise<any> {
          const queryRunner: QueryRunner = this.dataSource.createQueryRunner();
          await queryRunner.connect();

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

      const UserDataForm: React.FC = () => {
        const {
          register,
          handleSubmit,
          formState: { errors },
      Severity: Major
      Found in client/src/containers/update-profile-form/component.tsx - About 3 hrs to fix

        File impact.repository.ts has 300 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {
          Brackets,
          EntityManager,
          SelectQueryBuilder,
          WhereExpressionBuilder,
        Severity: Minor
        Found in api/src/modules/impact/impact.repository.ts - About 3 hrs to fix

          File dto-processor.service.ts has 298 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Injectable, Logger } from '@nestjs/common';
          import { CreateMaterialDto } from 'modules/materials/dto/create.material.dto';
          import { CreateBusinessUnitDto } from 'modules/business-units/dto/create.business-unit.dto';
          import { CreateSupplierDto } from 'modules/suppliers/dto/create.supplier.dto';
          import { CreateAdminRegionDto } from 'modules/admin-regions/dto/create.admin-region.dto';
          Severity: Minor
          Found in api/src/modules/import-data/sourcing-data/dto-processor.service.ts - About 3 hrs to fix

            Function UserPasswordForm has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const UserPasswordForm: React.FC = () => {
              const {
                register: registerPassword,
                handleSubmit: handleSubmitPassword,
                formState: { errors },
            Severity: Major
            Found in client/src/containers/update-password-form/component.tsx - About 3 hrs to fix

              Function InterventionForm has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              const InterventionForm: React.FC<InterventionFormProps> = ({
                intervention,
                isSubmitting,
                onSubmit,
              }) => {
              Severity: Minor
              Found in client/src/containers/interventions/form/component.tsx - About 3 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 Map has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              const Map: React.FC<MapProps> = ({ ingredientId, currentTradeFlow }) => {
                const queryClient = useQueryClient();
                const [hoverInfo, setHoverInfo] = useState<any>(null);
                const { x, y, reference, floating, strategy } = useFloating({
                  middleware: [flip(), offset(10)],
              Severity: Minor
              Found in cookie-traceability/src/components/map/component.tsx - About 3 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 save has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                async save(
                  importData: EudrInputShape[],
                  sourcingLocationGroupId?: string,
                ): Promise<{
                  sourcingLocations: SourcingLocation[];
              Severity: Minor
              Found in api/src/modules/import-data/eudr/eudr.dto-processor.service.ts - About 3 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 Features has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Features: React.FC = () => {
                return (
                  <section className="relative py-12 bg-white md:py-32">
                    <Wrapper>
                      <div className="space-y-10 md:space-y-20">
              Severity: Major
              Found in marketing/src/containers/home/features/component.tsx - About 3 hrs to fix

                Function buildMaps has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  buildMaps(): void {
                    this.soucingData.forEach((entity: Entities) => {
                      const {
                        supplierId,
                        materialId,

                  Function DataProviders has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const DataProviders: FC = () => {
                    const [slide, setSlide] = useState(0);
                    return (
                      <section className="bg-white py-12 space-y-1 bg-cover md:space-y-64 md:py-36">
                        <Wrapper>
                  Severity: Major
                  Found in marketing/src/containers/methodology/data-providers/component.tsx - About 3 hrs to fix

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

                    import { useState, useCallback, useEffect, useMemo } from 'react';
                    import DeckGL from '@deck.gl/react/typed';
                    import { GeoJsonLayer } from '@deck.gl/layers/typed';
                    import Map, { Source, Layer } from 'react-map-gl/maplibre';
                    import { WebMercatorViewport } from '@deck.gl/core/typed';
                    Severity: Minor
                    Found in client/src/containers/analysis-eudr/map/component.tsx - About 3 hrs to fix

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

                      import React, { useEffect, useMemo, useState } from 'react';
                      import { useQueryClient, useQueries } from '@tanstack/react-query';
                      import Flag from 'react-country-flag';
                      import axios from 'axios';
                      import DeckGL from '@deck.gl/react/typed';
                      Severity: Minor
                      Found in cookie-traceability/src/components/map/component.tsx - About 2 hrs to fix

                        Function clusterLocations has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function clusterLocations<L>(
                          locations: L[],
                          locationAccessors: LocationAccessors<L>,
                          getLocationWeight: LocationWeightGetter,
                          options?: Partial<Options>,
                        Severity: Major
                        Found in cookie-traceability/src/lib/flowmap/data/cluster/cluster.ts - About 2 hrs to fix

                          Function Step02 has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const Step02: 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: Major
                          Found in marketing/src/containers/the-service/steps/02/component.tsx - About 2 hrs to fix

                            Function Home has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const Home: React.FC = () => {
                              const mainElement = useRef<HTMLDivElement>(null);
                              const [currentTradeFlow, setCurrentTradeFlow] = useState<CountryTrade | null>(null);
                              const [ingredient, setIngredient] = useState<string>(INGREDIENTS[0].id);
                            
                            
                            Severity: Major
                            Found in cookie-traceability/src/pages/index.tsx - About 2 hrs to fix

                              Function Methodology has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const Methodology = (req: NextApiRequest, res: NextApiResponse): void => {
                                if (req.method === 'POST') {
                                  const { name, email, newsletter } = req.body;
                                  // Send a message to the user with Methodology link
                              
                              
                              Severity: Major
                              Found in marketing/src/pages/api/methodology.ts - About 2 hrs to fix

                                File scenario-interventions.service.ts has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import {
                                  BadRequestException,
                                  Injectable,
                                  NotFoundException,
                                } from '@nestjs/common';
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language