Vizzuality/landgriffon

View on GitHub

Showing 438 of 1,408 total issues

Function EUDRTool has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Function Hero has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Hero: React.FC = () => {
      return (
        <section className="relative overflow-hidden bg-white">
          <Wrapper>
            <motion.div
    Severity: Major
    Found in marketing/src/containers/about/hero/component.tsx - About 2 hrs to fix

      File intervention-creation.cy.ts has 264 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      beforeEach(() => {
        cy.interceptAllRequests();
      
        cy.intercept('GET', '/api/v1/indicators?filter[status]=active&include=unit&sort=name', {
          fixture: 'indicators/withUnits',
      Severity: Minor
      Found in client/cypress/e2e/intervention-creation.cy.ts - About 2 hrs to fix

        H3DataRepository has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Injectable()
        export class H3DataRepository extends Repository<H3Data> {
          constructor(private dataSource: DataSource) {
            super(H3Data, dataSource.createEntityManager());
          }
        Severity: Minor
        Found in api/src/modules/h3-data/h3-data.repository.ts - About 2 hrs to fix

          Function createScenarioIntervention has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async createScenarioIntervention(
              dto: CreateScenarioInterventionDto,
            ): Promise<Partial<ScenarioIntervention>> {
              // Validate new location. If it's validated, get the geolocated info. If not, throw an exception
          
          

            Function Header has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Header: React.FC = () => {
              const [open, setOpen] = useState(false);
            
              const { scrollDirection } = useScrollDirection();
              const prevDirection = useRef<string | number>(0);
            Severity: Major
            Found in marketing/src/containers/header/component.tsx - About 2 hrs to fix

              Function ScienceBasedTargets has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ScienceBasedTargets: React.FC = () => {
                return (
                  <section className="relative space-y-12 bg-blue-600 md:py-8 overflow-hidden">
                    <Wrapper>
                      <div className="space-y-10 text-white md:space-y-20 md:py-32 py-12">

                Function UploadTracker has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const UploadTracker: FC = () => {
                  const queryClient = useQueryClient();
                  const [isSettingUp, setIsSettingUp] = useState(true);
                  const [tasksProgress, setTaskProgress] = useState<ProgressTask['data'] | undefined>(undefined);
                
                
                Severity: Major
                Found in client/src/containers/uploader/tracker/index.tsx - About 2 hrs to fix

                  Function SuppliersListTable has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const SuppliersListTable = (): JSX.Element => {
                    const dispatch = useAppDispatch();
                    // const [rowSelection, setRowSelection] = useState({});
                    // const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
                    // const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);

                  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 clusterLocations has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function clusterLocations<L>(
                    locations: L[],
                    locationAccessors: LocationAccessors<L>,
                    getLocationWeight: LocationWeightGetter,
                    options?: Partial<Options>,
                  Severity: Minor
                  Found in cookie-traceability/src/lib/flowmap/data/cluster/cluster.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 calcLocationTotalsExtent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function calcLocationTotalsExtent(
                    locationTotals: Map<string, LocationTotals> | undefined,
                    locationIdsInViewport: Set<string> | undefined,
                  ) {
                    if (!locationTotals) return undefined;
                  Severity: Minor
                  Found in cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.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

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

                  import React, { cloneElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
                  import classnames from 'classnames';
                  import { Transition, Combobox } from '@headlessui/react';
                  import { ChevronUpIcon, ChevronDownIcon, XIcon } from '@heroicons/react/solid';
                  import { flip, useFloating, size, autoUpdate, offset } from '@floating-ui/react-dom';
                  Severity: Minor
                  Found in client/src/components/forms/select/autocomplete/component.tsx - About 2 hrs to fix

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

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

                      Function EUDRModal has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const EUDRModal: React.FC = () => {
                        const [isOpen, setIsOpen] = useState(false);
                      
                        const { start, stop } = useTimeout(() => {
                          setIsOpen(true);
                      Severity: Major
                      Found in marketing/src/containers/home/eudr-modal/component.tsx - About 2 hrs to fix

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

                        const Contact = (req: NextApiRequest, res: NextApiResponse): void => {
                          if (req.method === 'POST') {
                            const { name, email, message, company, topic, newsletter } = req.body;
                        
                            // Saving contacts and emails in Sendgrid
                        Severity: Major
                        Found in marketing/src/pages/api/contact.ts - About 2 hrs to fix

                          File 1645259040554-ImpactStoredFunctions.ts has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { MigrationInterface, QueryRunner } from 'typeorm';
                          
                          export class ImpactStoredFunctions1645259040554 implements MigrationInterface {
                            public async up(queryRunner: QueryRunner): Promise<void> {
                              await queryRunner.query(`
                          Severity: Minor
                          Found in api/src/migrations/1645259040554-ImpactStoredFunctions.ts - About 2 hrs to fix

                            Function handleSearchSelection has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                (newKey: Key) => {
                                  resetSearch();
                            
                                  const selectedNode = flatTreeData.find((data) => data.key === newKey);
                                  setKeyToScroll(newKey);
                            Severity: Major
                            Found in client/src/components/tree-select/component.tsx - About 2 hrs to fix

                              Function Video has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const Video: FC = () => {
                                const videoRef = useRef<HTMLVideoElement>();
                                const { ref, inView } = useInView();
                              
                                const onVideoEnded = useCallback(() => {
                              Severity: Major
                              Found in marketing/src/containers/compliance/hero/component.tsx - About 2 hrs to fix

                                Function ContactUs has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const ContactUs: FC = () => {
                                  return (
                                    <section className="bg-orange-500 xl:bg-white">
                                      <Wrapper>
                                        <div className="relative z-10 pt-12 bg-orange-500 md:pt-20 xl:-mt-10 xl:px-20 xl:-mx-20">
                                Severity: Major
                                Found in marketing/src/containers/methodology/contact-us/component.tsx - About 2 hrs to fix

                                  Function DatesRange has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const DatesRange = (): JSX.Element => {
                                    const dispatch = useAppDispatch();
                                    const {
                                      filters: { dates },
                                    } = useAppSelector(eudrDetail);
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language