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">
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");
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';
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>({
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,
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,
);
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 (
Function EUDRCompareMap
has 298 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EUDRCompareMap = () => {
const maps = useMap();
const {
planetLayer,
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');
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();
Function EUDRCompareMap
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
const EUDRCompareMap = () => {
const maps = useMap();
const {
planetLayer,
- Read upRead up
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,
- Read upRead up
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,
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);
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
$$
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,
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) {
- Read upRead up
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);
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 {