Vizzuality/landgriffon

View on GitHub

Showing 438 of 1,408 total issues

Function AdminDataPage has 205 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminDataPage: React.FC = () => {
  const { push, query } = useRouter();
  const [sorting, setSorting] = useState<SortingState>([]);
  const { data: session } = useSession();
  const { data: task } = useLasTask();
Severity: Major
Found in client/src/containers/admin/data-table/index.tsx - About 1 day to fix

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

    import { useCallback, useEffect, useMemo, useState } from 'react';
    import { DownloadIcon, InformationCircleIcon } from '@heroicons/react/outline';
    import { uniq, omit } from 'lodash-es';
    import toast from 'react-hot-toast';
    import { ArrowLeftIcon } from '@heroicons/react/solid';
    Severity: Major
    Found in client/src/containers/analysis-visualization/analysis-table/index.tsx - About 1 day to fix

      Function InnerTreeSelect has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
      Open

      const InnerTreeSelect = <IsMulti extends boolean>(
        {
          current: currentRaw,
          loading,
          maxBadges = 5,
      Severity: Minor
      Found in client/src/components/tree-select/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

      Function UpdateScenarioPage has 198 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const UpdateScenarioPage: React.FC = () => {
        const { query } = useRouter();
        const queryClient = useQueryClient();
        const { data, isLoading } = useScenario(query?.scenarioId as string, { include: 'user' });
        const updateScenario = useUpdateScenario();
      Severity: Major
      Found in client/src/pages/data/scenarios/[scenarioId]/edit.tsx - About 7 hrs to fix

        Function ScenariosAdminPage has 195 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ScenariosAdminPage: React.FC = () => {
          const router = useRouter();
          const { query } = router;
        
          const [scenatioToDelete, setScenatioToDelete] = useState<string>(null);
        Severity: Major
        Found in client/src/pages/data/scenarios/index.tsx - About 7 hrs to fix

          Function AnalysisTable has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
          Open

          const AnalysisTable = () => {
            const searchParams = useSearchParams();
            const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));
          
            const [paginationState, setPaginationState] = useState<PaginationState>({
          Severity: Minor
          Found in client/src/containers/analysis-visualization/analysis-table/index.tsx - About 7 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 DeforestationAlertsChart has 187 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const DeforestationAlertsChart = (): JSX.Element => {
            const [selectedPlots, setSelectedPlots] = useState<string[]>([]);
            const [selectedDate, setSelectedDate] = useState<number>(null);
            const ticks = useRef<number[]>([]);
            const { supplierId }: { supplierId: string } = useParams();

            Function saveNewIntervention has 180 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function EUDRCompliance has 179 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const EUDRCompliance: React.FC = () => {
                return (
                  <section className="relative bg-white">
                    <Wrapper>
                      <div className="relative border-t border-black/10 md:py-32 py-12">
              Severity: Major
              Found in marketing/src/containers/compliance/eudr-compliance/component.tsx - About 7 hrs to fix

                Function Step03 has 174 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Step03: React.FC = () => {
                  return (
                    <article
                      className={cx({
                        'flex flex-col lg:flex-row-reverse justify-between space-y-10 lg:space-x-10 lg:space-x-reverse lg:space-y-0':
                Severity: Major
                Found in marketing/src/containers/the-service/steps/03/component.tsx - About 6 hrs to fix

                  Function buildDashboardDetail has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async buildDashboardDetail(
                      supplierId: string,
                      dto?: GetEUDRAlertDatesDto,
                    ): Promise<EUDRDashBoardDetail> {
                      const result: any = {};
                  Severity: Major
                  Found in api/src/modules/eudr-alerts/dashboard/eudr-dashboard.service.ts - About 6 hrs to fix

                    File colors.ts has 453 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import {
                      interpolateCool,
                      interpolateInferno,
                      interpolateMagma,
                      interpolatePlasma,
                    Severity: Minor
                    Found in cookie-traceability/src/lib/flowmap/data/colors.ts - About 6 hrs to fix

                      Function SuppliersStackedBar has 167 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const SuppliersStackedBar = () => {
                        const {
                          viewBy,
                          totalSuppliers,
                          filters: { dates, suppliers, origins, materials },

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

                        import { Injectable, Logger } from '@nestjs/common';
                        import {
                          GetActualVsScenarioImpactTableDto,
                          GetScenarioVsScenarioImpactTableDto,
                          GROUP_BY_VALUES,
                        Severity: Minor
                        Found in api/src/modules/impact/comparison/scenario-vs-scenario.service.ts - About 6 hrs to fix

                          Function Rason has 160 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const Rason: React.FC = () => {
                            return (
                              <section className="relative py-12 space-y-12 bg-blue-600 bg-cover md:space-y-64 md:py-64">
                                <Wrapper>
                                  <div className="space-y-10 text-white md:space-y-20">
                          Severity: Major
                          Found in marketing/src/containers/about/reason/component.tsx - About 6 hrs to fix

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

                              public async up(queryRunner: QueryRunner): Promise<void> {
                                await queryRunner.query(`CREATE OR REPLACE FUNCTION sum_h3_weighted_cropland_area(
                                geo_region_id uuid,
                                material_id uuid,
                                h3_data_type material_to_h3_type_enum
                            Severity: Major
                            Found in api/src/migrations/1664874035162-UpdatedMethodologyStoredFunctions.ts - About 6 hrs to fix

                              Function MethodologyForm has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const MethodologyForm: React.FC = () => {
                                const [submitting, setSubmitting] = useState(false);
                              
                                const { register, handleSubmit, formState } = useForm({
                                  resolver: yupResolver(schema),
                              Severity: Major
                              Found in marketing/src/containers/methodology-form/component.tsx - About 6 hrs to fix

                                Function Developed has 151 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

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

                                  Function Legend has 150 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const Legend: React.FC = () => {
                                    const [showLegend, setShowLegend] = useState<boolean>(true);
                                    const [showSettings, setShowSettings] = useState<boolean>(false);
                                  
                                    const dispatch = useAppDispatch();

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

                                    import React, { useCallback, useState, useMemo, useEffect } from 'react';
                                    import { FilterIcon } from '@heroicons/react/solid';
                                    import {
                                      offset,
                                      shift,
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language