Vizzuality/landgriffon

View on GitHub

Showing 364 of 1,154 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 component.tsx has 1034 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

      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

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

        const AnalysisTable = () => {
          const [paginationState, setPaginationState] = useState<PaginationState>({
            pageIndex: 1,
            pageSize: DEFAULT_PAGE_SIZES[0],
          });

          Function MoreFilters has 316 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 673 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

              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 Contact has 257 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

                  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 540 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 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 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 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

                                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

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

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

                                    File component.tsx has 438 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 { ArrowLeftIcon } from '@heroicons/react/solid';
                                    
                                    
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language